How to calculate first and second order partial derivatives of $g(x,y)=\phi(x^2+y^2)$ How to calculate first and second order partial derivatives of $g$ where:
$g(x,y)=\phi(x^2+y^2)$
Here's what I did :
$g(x,y)=\phi(x^2+y^2)=(\phi\circ h)(x,y)$ where :  $h(x,y)=x^2+y^2$
$\frac{\partial g(x,y)}{\partial x}$=$\frac{\partial \phi(h(x,y))}{\partial x}$$\times$$\frac{\partial h(x,y)}{\partial x}$ =$\frac{\partial \phi(x^2+y^2)}{\partial x}\times 2x$
$\frac{\partial g(x,y)}{\partial y}$=$\frac{\partial \phi(h(x,y))}{\partial y}$$\times$$\frac{\partial h(x,y)}{\partial y}$ =$\frac{\partial \phi(x^2+y^2)}{\partial y}\times 2y$
and :
$\frac{\partial^2 g(x,y)}{\partial x^2}$=$\frac{\partial^2 \phi(h(x,y))}{\partial x^2} \times 2x +2\times \frac{\partial \phi(h(x,y))}{\partial x}$
$\frac{\partial^2 g(x,y)}{\partial y^2}$=$\frac{\partial^2 \phi(h(x,y))}{\partial y^2} \times 2y +2\times \frac{\partial \phi(h(x,y))}{\partial y}$
are these steps correct ?
 A: Your second derivatives are wrong because you made a small mistake in taking the first partial derivative.
$g(x,y)=\phi(h(x,y))\implies\frac{\partial g}{\partial x}=\frac{\partial \phi(h)}{\partial \color{red}h}\times \frac{\partial h}{\partial x}=2x\phi'(h)$
So the second derivative is$$\begin{align*}\frac{\partial g^2}{\partial^2x}&=2\phi'(h)+2x\times\frac{\partial \phi'(h)}{\partial x}=2\phi'(h)+2x\times\frac{\partial \phi'(h)}{\partial h}\times\frac{\partial h}{\partial x}\\&=2\phi'(h)+4x^2\phi''(h)\end{align*}$$
By symmetry you can obtain $g_y,g_{yy}$ by substituting $y$ instead of $x$ in the above expressions. The mixed partial derivative will be$$\frac{\partial g^2}{\partial y\partial x}=\frac{\partial}{\partial y}[2x\phi'(h)]=4xy\phi''(h)$$
A: It is useful to adopt a different notation for derivatives when a function is of one or several variables.
$\phi$ is mapping $\Bbb R\to\Bbb R$, so we can just denote its derivatives as $\phi',\;\phi''$ and so on.
$h:\Bbb R^2\to\Bbb R$, so here it is the case to distinguish which variable we are differentiating with respect to.
Hence $g:=\phi\circ h:\Bbb R^2\to\Bbb R$ and the chain rule says
\begin{align*}
\frac{\partial g}{\partial x}(x,y)
&=\phi'(h(x,y))\cdot \frac{\partial h}{\partial x}(x,y)\\
&=\phi'(x^2+y^2)\cdot 2x
\end{align*}
hence
\begin{align*}
\frac{\partial^2 g}{\partial x^2}(x,y)
&=\phi''(h(x,y))\cdot \frac{\partial h}{\partial x}(x,y)\cdot2x+\phi'(x^2+y^2)\cdot2\\
&=4x^2\cdot\phi''(x^2+y^2)+2\cdot \phi'(x^2+y^2)\;.
\end{align*}
Similarly for $y$-derivatives.
