[Math] When is the second derivative the same as the product of two first derivatives

derivatives

In the book Mathematical Methods for Physics and Engineering by RIley Hobson and Bence, an example is given in chapter 5 of using partial differentiation.
The example problem

Now the first partial derivatives are evaluated, which appears perfectly understandable to me. The issue arises when these are then used to calculate the value of the two senond derivatives as below:

Calculation of the second derivative wrt x

Plane polar coordinates, ρ and φ, and Cartesian coordinates, x and y, are related by the
expressions
$ x = ρ cos φ$, $y = ρ sin φ$. An arbitrary function $f(x, y)$ can be re-expressed as a
function $g(ρ, φ)$. Transform the expression
$$\frac{∂^{2}f}{
∂x^{2}} +
\frac{∂^{2}f
}{∂y^{2}}$$

into one in ρ and φ.

So after differentiation I get the same as the book for the first derivative wrt x:
$$\frac{∂}{∂x} = cos φ \frac{∂}{∂ρ} − sinρ\frac{φ}{∂φ}$$

Then it says:

Now it's only a matter of writing:
$$\frac{∂^{2}f}{∂x^{2}} =
\frac{∂}{∂x}(\frac{∂f}{∂x}) = \frac{∂}{∂x}(\frac{∂}{∂x})f$$

$$=(cos φ \frac{∂}{∂ρ} − sinρ\frac{φ}{∂φ})(cos φ \frac{∂}{∂ρ} − sinρ\frac{φ}{∂φ})g$$
$$=cos^{2} φ \frac{∂^{2}g}{∂ρ^{2}} − \frac{2 cos φ sin φ}{ρ^{2}}\frac{∂g}{∂φ} – \frac{2 cos φ sin φ}{ρ}\frac{∂^{2}g}{∂ρ∂φ} + \frac{sin^{2}φ}{ρ}\frac{∂g}{∂ρ}+\frac{sin^{2}φ}{ρ^{2}}\frac{∂^{2}g}{∂φ^{2}}$$

I don't understand why we can just square the first derivate to get the second. I understand that there are specific examples where this is true, but it seems completely incorrect as general rule.

It would be great if someone could explain the intuition behind this and under what circumstances this rule applies.

Best Answer

He is not squaring the first derivative to get the second derivative, he is squaring the "derivative with respect to $x$ operator", which is just notation for composing it with itself. Let $T$ be an operator which eats a function to give you a function, you are confusing $(T(f))^2 $ with $T^2(f) =T(T(f))$.

Suppose $T= d/dx $, the "first derivative operator". Then $T(f)= \frac{df}{dx}=f'$ and $$T^2(f)=\left(\frac{d}{dx}\right)^2f=\frac{d}{dx}\left(\frac{df}{dx}\right)=\frac{d^2f}{dx^2}=f^{"},$$ while $$(T(f))^2 =\left( \frac{df}{dx}\right)^2=\left(f^{\prime}\right)^2.$$

Related Question