Partial Differentiation using chain rule I am trying to express $\frac{\partial^2u}{\partial y^2}$ and $\frac{\partial^2u}{\partial x\partial y}$ of the function $u=f(x,y,g(x,y))$ with partial derivative notation of $f$ and $g$.
However I am having a hard time doing so because I am a bit confused with the notation.
I know that $\frac{\partial u}{\partial y}=\frac{\partial f}{\partial y}+ \frac{\partial f}{\partial g}\frac{\partial g}{\partial y}$. But the problem is that I am not sure how to express $\frac{\partial^2u}{\partial y^2}$. If I differentiate the $\frac{\partial u}{\partial y}$ by $y$, I am thinking I will get $\frac{\partial^2 u}{\partial y^2}=\frac{\partial^2 f}{\partial y^2}+ ...$ , but I am not quite sure how the second term of the right hand side ($\frac{\partial f}{\partial g}\frac{\partial g}{\partial y}$) will look like. Similarly, I have trouble in expressing $\frac{\partial^2u}{\partial x\partial y}$ using partial differentiation notation of $f$ and $g$.
How should it be done?
Thanks.
 A: Edit: As pointed out by Ted Shifrin, it's a bit misleading to write $\frac{\partial f}{\partial g}$ when in reality I mean $\frac{\partial f}{\partial z}$ because $f$ is a function of three variables: $x,y,z$.  I just so happens that everywhere it's relevant we evaluate $f$ at $(x,y,g(x,y))$.
It becomes clearer when you add back in the arguments.  You already have
$$\frac{\partial u}{\partial y}=\frac{\partial f}{\partial y}(x,y,g(x,y))+ \frac{\partial f}{\partial z}(x,y,g(x,y))\frac{\partial z}{\partial y}(x,y).$$  So, to find $\frac{\partial^{2} u}{\partial y^{2}}$, we compute the derivatives the same way again.
\begin{align}
\frac{\partial^{2} u}{\partial y^{2}} &=\frac{\partial}{\partial y}\frac{\partial f}{\partial y}(x,y,g(x,y))+ \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial z}(x,y,g(x,y))\frac{\partial g}{\partial y}(x,y)\right)\\
&=\frac{\partial^{2} f}{\partial y^{2}}(x,y,g(x,y)) + \frac{\partial^{2}f}{\partial z\partial y}(x,y,g(x,y))\frac{\partial g}{\partial y}(x,y)\\ &\quad + \left(\frac{\partial^{2}f}{\partial y\partial z}(x,y,g(x,y)) + \frac{\partial^{2}f}{\partial z^{2}}(x,y,g(x,y))\frac{\partial g}{\partial y}(x,y)\right)\frac{\partial g}{\partial y}(x,y)\\ &\quad+ \frac{\partial f}{\partial z}(x,y,g(x,y))\frac{\partial^{2} g}{\partial y^{2}}(x,y)
\end{align}
Suppressing the arguments again, we have
$$\frac{\partial^{2} u}{\partial y^{2}} = \frac{\partial^{2} f}{\partial y^{2}} + \frac{\partial^{2}f}{\partial z\partial y}\frac{\partial g}{\partial y} + \left(\frac{\partial^{2}f}{\partial y\partial z} + \frac{\partial^{2}f}{\partial z^{2}}\frac{\partial g}{\partial y}\right)\frac{\partial g}{\partial y}+ \frac{\partial f}{\partial z}\frac{\partial^{2} g}{\partial y^{2}} $$
which if you know that the second order partial derivatives are continuous becomes
$$\frac{\partial^{2} u}{\partial y^{2}} = \frac{\partial^{2} f}{\partial y^{2}} + 2\frac{\partial^{2}f}{\partial y\partial z}\frac{\partial g}{\partial y} + \frac{\partial^{2}f}{\partial z^{2}}\left(\frac{\partial g}{\partial y}\right)^{2}+ \frac{\partial f}{\partial z}\frac{\partial^{2} g}{\partial y^{2}}.$$  You can compute the other second order partial derivative in a similar manner.  Suppressing the arguments this time from the start:
\begin{align}
\frac{\partial^2u}{\partial x\partial y} &= \frac{\partial}{\partial x}\frac{\partial f}{\partial y}+ \frac{\partial}{\partial x}\left(\frac{\partial f}{\partial z}\frac{\partial g}{\partial y}\right)\\
&=\frac{\partial^{2}f}{\partial x\partial y} + \frac{\partial^{2}f}{\partial z\partial y}\frac{\partial g}{\partial x} + \left(\frac{\partial^{2}f}{\partial x\partial z} + \frac{\partial^{2}f}{\partial z^{2}}\frac{\partial g}{\partial x}\right)\frac{\partial g}{\partial y} + \frac{\partial f}{\partial z}\frac{\partial^{2}g}{\partial x\partial y}.
\end{align}
A: First lets start by $\frac{\partial u}{\partial y}$.
You already evaluated this one right:
\begin{equation}
\left( \frac{\partial u}{\partial y} \right)_x = \left( \frac{\partial f(x,y,g)}{\partial y} \right)_x = \left( \frac{\partial f}{\partial y} \right)_{g,x} + \left( \frac{\partial f}{\partial g} \right)_{x,y} \left(\frac{\partial g}{\partial y}\right)_x
\end{equation}
For the next one, we want:
\begin{equation}
\left( \frac{\partial }{\partial y} \left( \frac{\partial u}{\partial y} \right)_x \right)_{x}
\end{equation}
We can evaluate this using the chain rule:
\begin{equation}
\left( \frac{\partial }{\partial y} \left( \frac{\partial u}{\partial y} \right) \right)_{x} =  \left(\frac{\partial}{\partial y} \left( \frac{\partial f}{\partial y} \right)_{g,x} \right)_x + \left( \frac{\partial}{\partial y} \left( \frac{\partial f}{\partial g} \right)_{x,y}  \right)_x  \left(\frac{\partial g}{\partial y}\right)_x + \left( \frac{\partial}{\partial y} \left(\frac{\partial g(x,y)}{\partial y}\right)_x \right)_x \left( \frac{\partial f}{\partial g} \right)_{x,y}
\end{equation}
Lets evaluate term by term:
Note that the variables we are keeping constant are also an indicative that the final derivative will depend on them, so for the terms that contains $f$, the first and the second, you can replace the partial derivative with this operator:
\begin{equation}
\left(\frac{\partial}{\partial y} \right)_x = \left( \frac{\partial }{\partial y} \right)_{x,g} + \left( \frac{\partial }{\partial g} \right)_{x,y} \left( \frac{\partial g}{\partial y} \right)_{x}
\end{equation}
And for the last derivative you simply get:
\begin{equation}
\left( \frac{\partial}{\partial y} \left(\frac{\partial g(x,y)}{\partial y}\right)_x \right)_x \left( \frac{\partial f}{\partial g} \right)_{x,y} = \frac{\partial^2 g}{\partial y ^2} \left( \frac{\partial f}{\partial g} \right)_{x,y}
\end{equation}
If do this calculation you will get:
\begin{equation}
2 \frac{\partial }{\partial g} \left( \frac{\partial f}{\partial y} \right) \frac{\partial g}{\partial y}+ \frac{\partial^2 f}{\partial y^2} + \left(\frac{\partial g}{\partial y}\right)^2 \frac{\partial^2 f}{\partial g^2} +\frac{\partial f}{\partial g} \frac{\partial^2 g}{\partial y^2}
\end{equation}
Where in this last equation I have not stated the variables kept constant, but you may identify them easily.
With this headstart, I think you can easily do the other derivative, which I won't put here cause it is too much to type in latex.
Any question just ask!
