I tried to convert a partial differential equation from rectangular to polar coordinates in 2D.
As one of the steps required, I expressed the first derivatives of each of the rectangular coordinates in terms of the polar coordinates by using the chain rule, and I got:
$\frac{\partial w}{\partial x} \;=\; \frac{\partial w}{\partial r}\!\cdot\!\color{red}{\cos{\theta}} \;+\; \frac{\partial w}{\partial \theta}\!\cdot\!\frac{\color{red}{-\sin{\theta}}}{\color{blue}{r}}$
$\frac{\partial w}{\partial y} \;=\; \frac{\partial w}{\partial r}\!\cdot\!\color{red}{\sin{\theta}} \;+\; \frac{\partial w}{\partial \theta}\!\cdot\!\frac{\color{red}{\cos{\theta}}}{\color{blue}{r}}$
Now this looks oddly familiar! The coefficients I marked with red colour look awful lot like the elements of a transformation matrix that rotates something by the angle $\theta$ ! :o
$\color{red}{\begin{bmatrix}\cos{\theta}&-\sin{\theta}\\\sin{\theta}&\cos{\theta}\end{bmatrix}}$
But the $\theta$ coordinate is additionally divided by $\color{blue}{r}$ to compensate, similarly to how we divide the arc length by the radius to get the angle (the corresponding arc length on a unit circle).
My question is then:
Is there any linear algebra trick underlying this that would show this relation more explicitly? (Of the sorts of matrix-by-vector multiplication involving the partial derivatives.)
Aside:
In case there were are any doubts about the correctness of my calculations, here they are:
First, we have the following relations between the coordinates that will be used:
$\begin{cases} x = r\cdot\cos\theta \\[2ex] y = r\cdot\sin\theta\end{cases}$ $\begin{cases} r = \sqrt{x^2 + y^2} = \color{green}{(x^2 + y^2)^{\frac{1}{2}}} \\[2ex] \theta = \color{green}{\arctan \left( \frac{y}{x} \right)} \end{cases}$
Now, by the chain rule, we got:
$\begin{cases} \frac{\partial w}{\partial x} = \frac{\partial w}{\partial r} \color{red}{\frac{\partial r}{\partial x}} + \frac{\partial w}{\partial\theta} \color{red}{\frac{\partial\theta}{\partial x}} \\[2ex] \frac{\partial w}{\partial y} = \frac{\partial w}{\partial r} \color{red}{\frac{\partial r}{\partial y}} + \frac{\partial w}{\partial\theta} \color{red}{\frac{\partial\theta}{\partial y}} \end{cases}$
Now let's calculate the $\color{red}{\frac{\partial r}{\partial x}}$ and $\color{red}{\frac{\partial r}{\partial y}}$ that are used in these equations:
$\color{red}{\frac{\partial r}{\partial x}} = \frac{\partial}{\partial x}\left[ \color{green}{(x^2 + y^2)^{\frac{1}{2}}} \right] = (2x)\!\cdot\!\frac{1}{2}\left(x^2 + y^2\right)^{-\frac{1}{2}} = \frac{x}{\sqrt{x^2 + y^2}} = \frac{x}{r} = \frac{r\cdot\cos\theta}{r} = \color{red}{\cos\theta}$
$\color{red}{\frac{\partial r}{\partial y}} = \frac{\partial}{\partial y}\left[ \color{green}{(x^2 + y^2)^{\frac{1}{2}}} \right] = (2y)\!\cdot\!\frac{1}{2}\left(x^2 + y^2\right)^{-\frac{1}{2}} = \frac{y}{\sqrt{x^2 + y^2}} = \frac{y}{r} = \frac{r\cdot\sin\theta}{r} = \color{red}{\sin\theta}$
and also the other two, $\color{red}{\frac{\partial\theta}{\partial x}}$ and $\color{red}{\frac{\partial\theta}{\partial y}}$:
$\color{red}{\frac{\partial\theta}{\partial x}} = \frac{\partial}{\partial x}\left[ \color{green}{\arctan \left( \frac{y}{x} \right)} \right] = \frac{1}{\left(\frac{y}{x}\right)^2 \;+\; 1} \cdot \frac{-y}{x^2} = \frac{-y}{\left( \frac{y^2}{x^2} \;+\; 1 \right)\cdot x^2} = \frac{-y}{y^2 \;+\; x^2} = \frac{-y}{r^2} = \frac{-r\cdot\sin\theta}{r^2} = \frac{\color{red}{-\sin\theta}}{\color{blue}{r}}$
$\color{red}{\frac{\partial\theta}{\partial y}} = \frac{\partial}{\partial y}\left[ \color{green}{\arctan \left( \frac{y}{x} \right)} \right] = \frac{1}{\left(\frac{y}{x}\right)^2 \;+\; 1} \cdot \frac{1}{x} = \frac{1}{\left( \frac{y^2}{x^2} \;+\; 1 \right)\cdot x} = \frac{1}{\frac{y^2}{x} \;+\; x} = \frac{1}{\frac{y^2 \;+\; x^2}{x}} = \frac{x}{x^2 \;+\; y^2} = \frac{x}{r^2} = \frac{r\cdot\cos\theta}{r^2} = \frac{\color{red}{\cos\theta}}{\color{blue}{r}}$
If you still think that there is some error with these $\color{blue}{r}$s, kindly point them out.
Also it would be nice if someone corrected the formatting, because some symbols turned out to be very small and I don't know how to fix it.