# Could there be a linear algebra way for converting a PDE to another coordinate system?

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.

• Those r's are definitely correct right? Commented Oct 13, 2017 at 13:25
• At first look the calculations seems right, but I can check them one more time if you think there's any error... (What makes you think that there is?) Commented Oct 13, 2017 at 13:32
• OK I added my calculations under the question. You can check if they're correct. As you can see, the $r$s are there. Commented Oct 13, 2017 at 15:22
• There are two ways to make the fractions bigger: enclose the whole equations in double dollar signs instead of single dollar signs, or write \dfrac instead of \frac. Commented Oct 14, 2017 at 11:28
• Thanks. I tried the double dollars before, but it was also centering them. I'll try the \dfrac approach later. Commented Oct 14, 2017 at 22:38

Anyway, to keep this more basic, the partial derivative $\partial/\partial x$ tells you what happens to the function as you move (with unit speed) in the direction of the unit vector $\mathbf{e}_x=(1,0)$. Similarly, $\partial/\partial r$ should tell you what happens to the function as you move in the direction of the unit vector $\mathbf{e}_r=(\cos\theta,\sin\theta)$.
But $\partial/\partial \theta$ is a little bit trickier; it tells you what happens to the function as you vary $\theta$ with unit speed, which actually means moving in the $xy$ plane with speed $r$ (the further out you are, the larger will the effect of varying $\theta$ be). So $\partial/\partial \theta$ corresponds to the vector $r \, \mathbf{e}_\theta = (-r \sin\theta,r \cos\theta)$ in the $\theta$ direction. Or put differently, it's the scaled operator $(1/r) \partial/\partial \theta$ that corresponds to the unit vector $\mathbf{e}_\theta = (-\sin\theta, \cos\theta)$.
With these correspondences, the relations between the differential operators are exactly as for the corresponding vectors: $$\mathbf{e}_r=(\cos\theta,\sin\theta) = \cos\theta \, \mathbf{e}_x + \sin\theta \, \mathbf{e}_y$$ gives $$\frac{\partial}{\partial r}= \cos\theta \, \frac{\partial}{\partial x} + \sin\theta \, \frac{\partial}{\partial y}$$ and $$\mathbf{e}_\theta=(-\sin\theta,\cos\theta) = -\sin\theta \, \mathbf{e}_x + \cos\theta \, \mathbf{e}_y$$ gives $$\frac{1}{r} \frac{\partial}{\partial \theta}= -\sin\theta \, \frac{\partial}{\partial x} + \cos\theta \, \frac{\partial}{\partial y} .$$ Or with matrix notation: $$\begin{pmatrix} \frac{\partial}{\partial r} \\ \frac{1}{r} \frac{\partial}{\partial \theta} \end{pmatrix} = \begin{pmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{pmatrix} \begin{pmatrix} \frac{\partial}{\partial x} \\ \frac{\partial}{\partial y} \end{pmatrix} ,$$ which gives (if we invert the matrix) $$\begin{pmatrix} \frac{\partial}{\partial x} \\ \frac{\partial}{\partial y} \end{pmatrix} = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} \begin{pmatrix} \frac{\partial}{\partial r} \\ \frac{1}{r} \frac{\partial}{\partial \theta} \end{pmatrix} ,$$ as you found using the chain rule.