# Leibniz Notation Second Derivative Chain Rule?

I believe I understand the chain rule better from a few tutorials as the following:

$$\frac{d}{dx}(f(g(x)) ) = \frac{\partial f}{\partial g}\frac{\partial g}{\partial x}$$

But how would you represent equations that require the chain rule with leibniz notation for higher order derivatives. For example would the second derivative of a function requiring the chain rule be represented as follows:

$$\frac{d^2}{dx^2}(f(g(x)) ) = \frac{\partial^2 f}{\partial g}\frac{\partial g}{\partial x^2}$$

Or will the product rule be required somewhere? Any information would be appreciated

-
So does that mean what I have is correct? What you've pointed out is where I'm confused. So will we need to use the product rule and if so how would that work (ie taking a derivative of a partial derivative) –  Amateur Math Guy Mar 24 '14 at 14:03
So does this look right to you?: $$\frac{d^2}{dx^2}(f(g(x))) = (\frac{\partial^2 f}{\partial g^2} \frac{\partial g}{\partial x})(\frac{\partial g}{\partial x}) + (\frac{\partial f}{\partial g})(\frac{\partial^2 g}{\partial x^2})$$ –  Amateur Math Guy Mar 24 '14 at 14:28
@Ignore my comments. See Ted Shifrin's answer. I haven't noticed that $g$ is a single variable function! –  Américo Tavares Mar 24 '14 at 14:28
Were your original comments wrong? I'll look at his answer in a second I just wanted to make sure I was following what you were saying first correctly –  Amateur Math Guy Mar 24 '14 at 14:30
Ah I see, alright no problem. I'll take a look at his answer –  Amateur Math Guy Mar 24 '14 at 14:33

Please do not use notation like this. If $f=f(u)$ and $u=g(x)$, please write $$\frac d{dx}f(g(x)) = \frac{df}{du}\Big|_{u=g(x)}\cdot \frac{dg}{dx}.$$ You then need to use the product rule and chain rule to take the derivative again. In particular, $$\frac d{dx}\left(\frac{df}{du}\Big|_{u=g(x)}\right) = \frac{d^2f}{du^2}\Big|_{u=g(x)}\cdot\frac{dg}{dx}.$$ Now you finish up with the product rule.