# Computing partial derivatives.

I am having trouble solving this problem: If $f$ is $C^{2}$ and $f(x,y)=g(r,\theta)$ where $(r,\theta)$ are polar coordinates in $\mathbb{R}^{2}$, then $$\left(\frac{\partial^{2}}{\partial x^{2}}+\frac{\partial^{2}}{\partial y^{2}}\right)f(x,y)=\left(\frac{\partial^{2}}{\partial r^{2}}+\frac{1}{r}\frac{\partial}{\partial r}+\frac{1}{r^{2}}\frac{\partial^{2}}{\partial\theta^{2}}\right)g(r,\theta)$$ for all $(x,y)\ne(0,0)$. I computed $$\frac{\partial f}{\partial x}=\frac{\partial f}{\partial r}\frac{\partial r}{\partial x}+\frac{\partial f}{\partial\theta}\frac{\partial\theta}{\partial x}=\cos\theta\frac{\partial f}{\partial r}-\frac{\sin\theta}{r}\frac{\partial f}{\partial\theta}$$ and $$\frac{\partial f}{\partial y}=\frac{\partial f}{\partial r}\frac{\partial r}{\partial y}+\frac{\partial f}{\partial\theta}\frac{\partial\theta}{\partial y}=\sin\theta\frac{\partial f}{\partial r}+\frac{\cos\theta}{r}\frac{\partial f}{\partial\theta}$$ but I do not know how to compute the second derivatives. Any help is appreciated.

-
Check the partial derivatives, e.g. $\frac{\partial r}{\partial x}=\frac{ \partial }{\partial x}\frac{x}{\cos \theta }=\frac{1}{\cos \theta }$, because $x=r\cos \theta$. –  Américo Tavares Mar 5 '12 at 22:09
@AméricoTavares I tried to do implicit differentiation on $r^2=x^2+y^2$. Then $2r\partial r/\partial x=2x$ so $\partial r/\partial x=x/r=\cos\theta$. –  MathMajor Mar 6 '12 at 0:23
Now I have no good explanation for these two contradictory results, at least apparently. –  Américo Tavares Mar 6 '12 at 1:00
Sorry. Please ignore my comment, because I think I was wrong. In general $\partial x/\partial r\neq 1/(\partial r/\partial x)$. –  Américo Tavares Mar 6 '12 at 12:10

I assigned this as homework and when no one could do it was wrote out a solution. Maybe it is useful. The formatting didn't transfer perfectly.

We are given $z=f(x,y)$ where $x=r \cos \theta$ and $y= r \sin \theta$. We want to show $$\frac{\partial^2z}{\partial x^2}+\frac{\partial^2z}{\partial y^2}= \frac{\partial^2z}{\partial r^2} +\frac{1}{r^2} \frac{\partial^2z}{\partial \theta^2} +\frac 1 r \frac{\partial z}{\partial r}$$

Using the chain rule (case 2), we have

\begin{align} \frac{\partial z}{\partial r}&=\frac{\partial f}{\partial x}\frac{\partial x}{\partial r}+\frac{\partial f}{\partial y}\frac{\partial y}{\partial r}\\ &=\frac{\partial f}{\partial x} \cos \theta +\frac{\partial f}{\partial y} \sin \theta \\&= \frac{\partial f}{\partial x}\frac{x}{\sqrt{x^2+y^2}} +\frac{\partial f}{\partial y} \frac{y}{\sqrt{x^2+y^2}} \end{align}

and

\begin{align} \frac{\partial z}{\partial \theta}&=\frac{\partial f}{\partial x}\frac{\partial x}{\partial \theta}+\frac{\partial f}{\partial y}\frac{\partial y}{\partial \theta}\\ &=\frac{\partial f}{\partial x} (-r \sin \theta) +\frac{\partial f}{\partial y} (r\cos \theta)\\ &=\frac{\partial f}{\partial x} (-y) +\frac{\partial f}{\partial y} x. \end{align}

Using the chain rule, the above formula for $\frac{\partial z}{\partial r}$ and the fact that $\cos \theta$ and $\sin \theta$ are constants with respect to $r$, we have

\begin{align} \frac{\partial^2 z}{\partial r^2}&=\cos \theta \frac{\partial}{\partial r}\left(\frac{\partial f}{\partial x}\right )+ \sin \theta \frac{\partial}{\partial r}\left(\frac{\partial f}{\partial y}\right)\\ &= \cos \theta \left(\frac{\partial^2 f}{\partial x^2}\frac{\partial x}{\partial r}+\frac{\partial^2 f}{\partial y \partial x}\frac{\partial y}{\partial r}\right)+ \sin \theta \left(\frac{\partial^2 f}{\partial x \partial y}\frac{\partial x}{\partial r}+\frac{\partial^2 f}{\partial y^2}\frac{\partial y}{\partial r}\right)\\ &=\cos \theta \left(\frac{\partial^2 f}{\partial x^2}\cos \theta+\frac{\partial^2 f}{\partial y \partial x}\sin \theta \right)+ \sin \theta \left(\frac{\partial^2 f}{\partial x \partial y}\cos \theta+\frac{\partial^2 f}{\partial y^2}\sin \theta \right)\\ &= \cos^2 \theta \frac{\partial^2 f}{\partial x^2} + \sin^2 \theta \frac{\partial^2 f}{\partial y^2}+2 \cos \theta \sin \theta \frac{\partial^2 f}{\partial x \partial y}\\ &= \frac{x^2}{x^2+y^2} \frac{\partial^2 f}{\partial x^2} + \frac{y^2}{x^2+y^2}\frac{\partial^2 f}{\partial y^2}+ \frac{2xy}{x^2+y^2} \frac{\partial^2 f}{\partial x \partial y} \end{align}

Using the chain rule, the above formula for $\frac{\partial z}{\partial \theta}$ and the product rule, we have

\begin{align} \frac{\partial^2 z}{\partial \theta^2}&= \frac{\partial}{\partial \theta}\left(\frac{\partial f}{\partial x} (-y) +\frac{\partial f}{\partial y} x\right) \\ &= -y \frac{\partial}{\partial \theta}\left(\frac{\partial f}{\partial x}\right)+\frac{\partial f}{\partial x} \frac{\partial}{\partial \theta} (-y) + x \frac{\partial}{\partial \theta}\left(\frac{\partial f}{\partial y}\right)+\frac{\partial f}{\partial y} \frac{\partial}{\partial \theta} (x) \\ &=-y \left(\frac{\partial^2 f}{\partial x^2}(-y)+\frac{\partial^2 f}{\partial y \partial x} x\right)+\frac{\partial f}{\partial x} (-r \cos \theta) + x \left(\frac{\partial^2 f}{\partial x \partial y}(-y)+\frac{\partial^2 f}{\partial y^2} x\right)+ \frac{\partial f}{\partial y} (-r \sin \theta)\\ &=y^2\frac{\partial^2 f}{\partial x^2} + x^2 \frac{\partial^2 f}{\partial y^2}-2xy\frac{\partial^2 f}{\partial x \partial y}-x \frac{\partial f}{\partial x}-y\frac{\partial f}{\partial y} \end{align}

Putting this all together, we have

\begin{align} \frac{\partial^2z}{\partial r^2} +\frac{1}{r^2} \frac{\partial^2z}{\partial \theta^2} +\frac 1 r \frac{\partial z}{\partial r}&= \frac{\partial^2z}{\partial r^2} +\frac{1}{x^2+y^2} \frac{\partial^2z}{\partial \theta^2} +\frac {1}{\sqrt{x^2+y^2}} \frac{\partial z}{\partial r}\\ &= \frac{x^2}{x^2+y^2} \frac{\partial^2 f}{\partial x^2} + \frac{y^2}{x^2+y^2}\frac{\partial^2 f}{\partial y^2}+ \frac{2xy}{x^2+y^2} \frac{\partial^2 f}{\partial x \partial y} \\ & + \frac{1}{x^2+y^2} \left(y^2\frac{\partial^2 f}{\partial x^2} + x^2 \frac{\partial^2 f}{\partial y^2}-2xy\frac{\partial^2 f}{\partial x \partial y}-x \frac{\partial f}{\partial x}-y\frac{\partial f}{\partial y}\right)\\ & +\frac {1}{\sqrt{x^2+y^2}}\left(\frac{\partial f}{\partial x}\frac{x}{\sqrt{x^2+y^2}} +\frac{\partial f}{\partial y} \frac{y}{\sqrt{x^2+y^2}}\right)\\ &=\frac{\partial^2z}{\partial x^2}+\frac{\partial^2z}{\partial y^2} \end{align}

-
I think there is a typo in the last term of $\frac{\partial^2 z}{\partial r^2}$ in the first line. $$\frac{\partial^2 z}{\partial r^2}=\cos \theta \frac{\partial}{\partial r}\left(\frac{\partial f}{\partial x}\right )+ \sin \theta \frac{\partial}{\partial r}\left(\frac{\partial f}{\partial y}\right)$$ –  Américo Tavares Mar 6 '12 at 11:48
Thanks for catching that. –  ShawnD Mar 6 '12 at 16:30

An other way ?

$\dfrac{\partial^{2}f}{\partial x^{2}}=\dfrac{\partial}{\partial x}\left(\cos\theta\dfrac{\partial f}{\partial r}-\dfrac{\sin\theta}{r}\dfrac{\partial f}{\partial\theta}\right)=\cos\theta\left(\dfrac{\partial^{2}f}{\partial r^{2}}\dfrac{\partial r}{\partial x}+\dfrac{\partial^{2}f}{\partial r\partial\theta}\dfrac{\partial\theta}{\partial x}\right)+\left(\dfrac{\partial \cos\theta}{\partial r}\dfrac{\partial r}{\partial x}+\dfrac{\partial \cos\theta}{\partial\theta}\dfrac{\partial\theta}{\partial x}\right)\dfrac{\partial f}{\partial r}-\dfrac{\sin\theta}{r}\left(\dfrac{\partial^{2}f}{\partial\theta\partial r}\dfrac{\partial r}{\partial x}+\dfrac{\partial^{2}f}{\partial\theta^{2}}\dfrac{\partial\theta}{\partial x}\right)-\dfrac{\partial f}{\partial\theta}\left(\dfrac{\partial\dfrac{\sin\theta}{r}}{\partial r}\dfrac{\partial r}{\partial x}+\dfrac{\partial\dfrac{\sin\theta}{r}}{\partial\theta}\dfrac{\partial\theta}{\partial x}\right)$

$\dfrac{\partial^{2}f}{\partial x^{2}}=\cos^{2}\theta\dfrac{\partial^{2}f}{\partial r^{2}}-2\cos\theta\dfrac{\sin\theta}{r}\dfrac{\partial^{2}f}{\partial r\partial\theta}+\dfrac{\sin^{2}\theta}{r^{2}}\dfrac{\partial^{2}f}{\partial\theta^{2}}+\dfrac{\sin^{2}\theta}{r}\dfrac{\partial f}{\partial r}$

And $\dfrac{\partial^{2}f}{\partial y^{2}}=\dfrac{\partial}{\partial y}\left(\sin\theta\dfrac{\partial f}{\partial r}+\dfrac{\cos\theta}{r}\dfrac{\partial f}{\partial\theta}\right)=\sin\theta\left(\dfrac{\partial^{2}f}{\partial r^{2}}\dfrac{\partial r}{\partial x}+\dfrac{\partial^{2}f}{\partial r\partial\theta}\dfrac{\partial\theta}{\partial x}\right)+\left(\dfrac{\partial \sin\theta}{\partial r}\dfrac{\partial r}{\partial x}+\dfrac{\partial \sin\theta}{\partial\theta}\dfrac{\partial\theta}{\partial x}\right)\dfrac{\partial f}{\partial r}+\dfrac{\cos\theta}{r}\left(\dfrac{\partial^{2}f}{\partial\theta\partial r}\dfrac{\partial r}{\partial x}+\dfrac{\partial^{2}f}{\partial\theta^{2}}\dfrac{\partial\theta}{\partial x}\right)+\dfrac{\partial f}{\partial\theta}\left(\dfrac{\partial\dfrac{\cos\theta}{r}}{\partial r}\dfrac{\partial r}{\partial x}+\dfrac{\partial\dfrac{\cos\theta}{r}}{\partial\theta}\dfrac{\partial\theta}{\partial x}\right)$

$\dfrac{\partial^{2}f}{\partial y^{2}}=\sin^{2}\theta\dfrac{\partial^{2}f}{\partial r^{2}}+2\cos\theta\dfrac{\sin\theta}{r}\dfrac{\partial^{2}f}{\partial r\partial\theta}+\dfrac{\cos^{2}\theta}{r^{2}}\dfrac{\partial^{2}f}{\partial\theta^{2}}+\dfrac{\cos^{2}\theta}{r}\dfrac{\partial f}{\partial r}$

So $\nabla f=\left(\dfrac{\partial^{2}}{\partial x^{2}}+\dfrac{\partial^{2}}{\partial y^{2}}\right)f=\left(\dfrac{\partial^{2}}{\partial r^{2}}+\dfrac{1}{r}\dfrac{\partial}{\partial r}+\dfrac{1}{r^{2}}\dfrac{\partial^{2}}{\partial\theta^{2}}\right)f$

-