Transforming to polar coordinates

231 Views Asked by At

I want to transform from planar $x,y$ coordinates to $r,\theta$ coordinates, where

$$r = \sqrt{x^2+y^2},\quad \theta = \arctan(y/x)$$ $$x = r\cos\theta, \quad y = r\sin\theta.$$

To do this I wish to compute the Jacobian matrix. One first step is computing $\partial r/\partial x$. I find

$$\frac{\partial r}{\partial x} = \left(\frac{\partial x}{\partial r}\right)^{-1} = \left(\frac{\partial{(r \cos\theta)}}{\partial r}\right)^{-1} = \frac{1}{\cos\theta}.$$

However I also find

$$\frac{\partial r}{\partial x} = \frac{\partial}{\partial x} \sqrt{x^2+y^2} = \frac{x}{\sqrt{x^2+y^2}} = \frac{r\cos\theta}{r} = \cos \theta.$$

Why do I get these contradictory results?

2

There are 2 best solutions below

0
On

As said in the comments you cannot just "reverse" the partial derivative like this.

Instead you can actually calculate $\dfrac{\partial r}{\partial x}$ by considering also derivating $\theta$ respectively to $x$ (while $y$ is fixed).


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


$\begin{align}\dfrac{\partial r}{\partial x} &=\dfrac{\partial}{\partial x}\left(\dfrac{x}{\cos \theta}\right) =\dfrac 1{\cos \theta}+x\dfrac{\partial}{\partial \theta}\left(\dfrac 1{\cos \theta}\right)\dfrac{\partial \theta}{\partial x} =\dfrac 1{\cos \theta}+x\left(\dfrac{\sin \theta}{\cos^2 \theta}\right)\left(\dfrac{-\sin \theta}{r}\right)\\\\ &=\dfrac 1{\cos \theta}+x\left(\dfrac{-\sin^2 \theta}{x\cos \theta}\right) =\dfrac{1-\sin^2 \theta}{\cos \theta}=\cos \theta \end{align}$

Now both results agree.

Yet you can notice that you still needed to express $\theta$ in term of $x,y$ to get its proper derivative. Thus what you somehow tried to avoid for $r$ you have to do for $\theta$, so it was preferable to go for your second calculation right away.

0
On

Your strategy failed because you conflated partial derivatives that hold different things constant. Often, what's held constant is shown as a subscript outside brackets. In particular, $\left(\frac{\partial r}{\partial x}\right)_\theta=\left(\frac{\partial x}{\partial r}\right)_\theta^{-1}=\sec\theta$ but $\left(\frac{\partial r}{\partial x}\right)_y=\frac{x}{r}$. So strictly speaking, the Jacobian should be written as$$\frac{dxdy}{drd\theta}=\left|\begin{array}{cc} \left(\frac{\partial x}{\partial r}\right)_{\theta} & \left(\frac{\partial x}{\partial\theta}\right)_{r}\\ \left(\frac{\partial y}{\partial r}\right)_{\theta} & \left(\frac{\partial y}{\partial\theta}\right)_{r} \end{array}\right|=\left|\begin{array}{cc} \cos\theta & -r\sin\theta\\ \sin\theta & r\cos\theta \end{array}\right|=r,$$or in the other direction$$\frac{drd\theta}{dxdy}=\left|\begin{array}{cc} \left(\frac{\partial r}{\partial x}\right)_{y} & \left(\frac{\partial r}{\partial y}\right)_{x}\\ \left(\frac{\partial\theta}{\partial x}\right)_{y} & \left(\frac{\partial\theta}{\partial y}\right)_{x} \end{array}\right|=\left|\begin{array}{cc} \frac{x}{r} & \frac{y}{r}\\ -\frac{y}{r^{2}} & \frac{x}{r^{2}} \end{array}\right|=\frac{1}{r}.$$