# Second partial derivatives and chain rule doubt

In a problem in my textbook i had the following expression:

If $z = f(x,y)$ has continuous second-order partial derivatives and $x = r^{2}+s^{2}$ and $y = 2rs$, find $\displaystyle\frac{\partial z}{\partial r}$ and with this, $\displaystyle\frac{\partial^{2}z}{\partial r^{2}}$

I obtained that $\displaystyle\frac{\partial z}{\partial r}$ was:

$\displaystyle\frac{\partial z}{\partial r} = 2\displaystyle\frac{\partial z}{\partial x}+2r\displaystyle\frac{\partial z}{\partial x}+2s\displaystyle\frac{\partial z}{\partial y}$

However, I'm not sure on how to begin in order to find the second order partial derivative. I saw that in my textbook they obtained that:

$\displaystyle\frac{\partial}{\partial r} (\displaystyle\frac{\partial z}{\partial x})=\displaystyle\frac{\partial}{\partial x}(\displaystyle\frac{\partial z}{\partial x})\displaystyle\frac{\partial x}{\partial r}+\displaystyle\frac{\partial}{\partial y}(\displaystyle\frac{\partial z}{\partial x})\displaystyle\frac{\partial y}{\partial r}$

And similarly the same case for $\displaystyle\frac{\partial}{\partial r} (\displaystyle\frac{\partial z}{\partial y})$

So essentially from what I can understand from this, they are assuming that $\displaystyle\frac{\partial z}{\partial x}$ is a function of both x and y? How can we know that though? Or is it something that i should just know? (what could happen if the partial derivative is just expressed in terms of only x or only y?)

$$\frac{\partial z}{\partial r}=\frac{\partial z}{\partial x} \frac{\partial x}{\partial r}+\frac{\partial z}{\partial y}\frac{\partial y}{\partial r}= \frac{\partial z}{\partial x} 2r+\frac{\partial z}{\partial y}2s.$$
$$\frac{\partial z}{\partial r}=g\cdot 2r+ h\cdot 2s,$$
with $\frac{\partial z}{\partial x}:=g(x,y)$ and $\frac{\partial z}{\partial y}=h(x,y)$. All you need is to apply the partial derivative, as before. This answer can help you with notation.
• it follows from the fact that $z=f(x,y)$: we cannot say that, for example, that $\frac{\partial z}{\partial x}$ is a function of $x$ alone, like in the case $z=x^2+y$. The partial derivatives are functions both of $x$ and $y$, due to generality. – Avitus Nov 18 '13 at 21:24