Proving double derivatives with the chain rule (I think?) Hey StackExchange I'm having trouble understating where to start with this problem, I'm supposed to prove something about double derivatives and the chain rule but I'm having trouble understanding exactly what I'm being asked and how to go about doing it.
If $y = f(u)$ and $u = g(x)$, where f and g are twice differentiable functions show that:
$$\frac{d^2y}{dx^2} = \frac{d^2y}{du^2}\left(\frac{du}{dx}\right)^2 + \frac{dy}{du}\left(\frac{d^2u}{dx^2}\right)$$

The first answer is great. But it wasn't detailed enough for me. So here's another answer that has more detail.
We start with the LHS:
$$\frac{d^2y}{dx^2}$$
Replacing $y$ by $f(u)$
$$\frac{d^2f(u)}{dx^2}$$
And expanding the $\frac{d}{dx}$
$$\frac{d}{dx}\left(\frac{df(u)}{dx}\right)$$
Now we use the chain rule
$$\frac{d}{dx}\left( \frac{df(u)}{du}\frac{du}{dx} \right)$$
Next, we use the product rule
$$\frac{df(u)}{du}\frac{d}{dx}\left(\frac{du}{dx}\right) + \frac{d}{dx}\left(\frac{df(u)}{du}\right)\frac{du}{dx}$$
Then we simplify the notation of the term on the left. We contract the two $\frac{d}{dx}$ and we replace $f(u)$ by $y$
$$\frac{dy}{du}\frac{d^2u}{dx^2} + \frac{d}{dx}\left(\frac{df(u)}{du}\right)\frac{du}{dx}$$
We're done with the term on the left. Now, for the term on the right, we use the chain rule. (see note 1 below)
$$\frac{dy}{du}\frac{d^2u}{dx^2} + \frac{d}{du}\left(\frac{df(u)}{du}\right)\frac{du}{dx} \frac{du}{dx}$$
We contract the notation of the term on the right. We group the $\frac{d}{du}$ and we group the $\frac{du}{dx}$
$$\frac{dy}{du}\frac{d^2u}{dx^2} + \frac{d^2f(u)}{du^2} \left(\frac{du}{dx}\right)^2$$
This is the RHS. Done.


Note 1:
This step was the hardest one for me to understand. It becomes clearer to me if we think of $\frac{df(u)}{du}$ as if it's some variable, like $v$ for example. Like this:
$$\frac{df(u)}{du} = v$$
And then, we would have this:
$$\frac{d}{dx}\left(\frac{df(u)}{du}\right) = \frac{dv}{dx}$$
If we apply the chain rule to this, we get this:
$$\frac{dv}{dx} = \frac{dv}{du}\frac{du}{dx}$$
If we replace $v$ with the original expression, we get this:
$$\frac{dv}{du}\frac{du}{dx} = \frac{d}{du}\left(\frac{df(u)}{du}\right)\frac{du}{dx}$$
