PlanetPhysics/Transformation Between Cartesian Coordinates and Polar Coordinates

From the definition of a contravariant vector (contravariant tensor of rank 1)

$$ \bar{T}^{i} = T^{j}\frac{\partial \bar{x}^{i}}{\partial x^{j}} $$

we get the transformation matrix from the partial derivatives

$$ A_{ij} = \frac{\partial \bar{x}^{i}}{\partial x^{j}} $$

In order to calculate the transformation matrix, we need the equations relating the two coordinates systems. For cartesian to polar, we have

$$ r = \sqrt{ x^2 + y^2 } $$

$$ \theta = tan^{-1}\left( \frac{y}{x} \right) $$

and for polar to cartesian

$$ x = r \cos \theta $$

$$ y = r \sin \theta $$

So if we designate $$(x,y)$$ as the bar coordinates, then the transformation components from polar coordinates $$(r,\theta)$$ to cartesian coordinates $$(x,y)$$ is calculated as

$$ A_{11} = \frac{\partial \bar{x}^{1}}{\partial x^{1}} = \frac{\partial x}{\partial r} = \cos \theta$$

$$ A_{12} = \frac{\partial \bar{x}^{1}}{\partial x^{2}} = \frac{\partial x}{\partial \theta} = -r \sin \theta$$

$$ A_{21} = \frac{\partial \bar{x}^{2}}{\partial x^{1}} = \frac{\partial y}{\partial r} = \sin \theta$$

$$ A_{22} = \frac{\partial \bar{x}^{2}}{\partial x^{2}} = \frac{\partial y}{\partial \theta} = r \cos \theta$$

The components from cartesian coordinates to polar coordinates transform the same way, but now the polar coordinates have the bar

$$ B_{11} = \frac{\partial \bar{x}^{1}}{\partial {x}^{1}} = \frac{\partial r}{\partial x} = \frac{x}{\sqrt{x^2 + y^2}}$$

$$ B_{12} = \frac{\partial \bar{x}^{1}}{\partial {x}^{2}} = \frac{\partial r}{\partial y} = \frac{y}{\sqrt{x^2 + y^2}}$$

$$ B_{21} = \frac{\partial \bar{x}^{2}}{\partial {x}^{1}} = \frac{\partial \theta}{\partial x} = -\frac{y}{x^2 + y^2}$$

$$ B_{22} = \frac{\partial \bar{x}^{2}}{\partial {x}^{2}} = \frac{\partial \theta}{\partial y} = \frac{x}{x^2 + y^2}$$

In summary, the {\mathbf components of contravariant vectors} in cartesian coordinates and polar coordinates transform between each other according to

$$ \left[ \begin{matrix} x \\ y \end{matrix} \right] = \left[ \begin{matrix} \cos \theta & -r \sin \theta \\ \sin \theta & r \cos \theta \end{matrix} \right] \left[ \begin{matrix} r \\ \theta \end{matrix} \right]$$

$$ \left[ \begin{matrix} r \\ \theta \end{matrix} \right] = \left[ \begin{matrix} \frac{x}{\sqrt{x^2 + y^2}} & \frac{y}{\sqrt{x^2 + y^2}} \\ -\frac{y}{x^2 + y^2} & \frac{x}{x^2 + y^2} \end{matrix} \right] \left[ \begin{matrix} x \\ y \end{matrix} \right]$$