[Physics] Convert magnetic field from cylindrical to cartesian coordinates

coordinate systemshomework-and-exercisesmagnetic fieldsVector Fields

It's been a while since I had to convert cylindrical to cartesian unit vectors, and even though I have the transformation rules, I can't seem to grasp how to go about the following:

How would I (what are the steps) resolve the cylindrical unit vector $\textbf e_\phi $ along the x- and y-axes in order to convert:

$\textbf B(r) = AJ_z r \textbf e_\phi $ (where $A$ and $J_z$ are constants)

into cartesian? Of form such as:

$\textbf B(x,y,z) = AJ_z (-y\textbf e_x + x \textbf e_y)$

Best Answer

For how to do this mathematically ina simple way, see here, where they use \theta instead of \phi. This might also help. So, assuming that your $\phi$ coordinate is the azimuthal angle in the x-y plane, then the transformation to find the directional vector is

$$ \vec{e}_{\phi} = \frac{\partial \vec{r}}{\partial \phi} = -rsin(\phi)\hat{e}_{x} + rcos(\phi)\hat{e}_{y}$$

The unit vector is defined as, since the directional vectors are not necessarily of unit length,

$$ \hat{e}_{\phi} = \frac{\vec{e}_{\phi}}{|\vec{e}_{\phi}|}$$

So we have that,

$$ \hat{e}_{\phi} = \frac{\vec{e}_{\phi}}{r}$$

Next, to remove the explicit $\phi$ and $r$ dependence, we apply the coordinate transformation equations given here:

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

$$ \phi = arctan\Big(\frac{y}{x}\Big)$$

So, we have,

$$ \hat{e}_{\phi} = \frac{\vec{e}_{\phi}}{\sqrt{(rcos(\phi))^{2} + (rsin(\phi))^{2}}} = \frac{\vec{e}_{\phi}}{r}$$

$$ \hat{e}_{\phi} = \frac{-rsin(\phi)\hat{e}_{x} + rcos(\phi)\hat{e}_{y}}{r} = \frac{-y\vec{e}_{x} + x\vec{e}_{y}}{\sqrt{x^{2} + y^{2}}}$$

where we used the fact that $x = rcos(\phi)$ and $y = rsin(\phi)$.