# Transforming vector field into spherical coordinates. Why and how does this method work?

Transform the vector field:

$$\vec{F}=(\frac{x}{r},\frac{y}{r},\frac{z}{r}), \space\space \space > r=\sqrt{x^2+y^2+z^2}$$

into spherical coordinates.

My attempt: The transformation matrix for transforming a vector(field) from cartesian coordinates to spherical coordinates is given by:

$$\begin{pmatrix}v_r\\v_{\theta} \\ v_{\phi}\end{pmatrix}=\begin{pmatrix}\cos{\phi}\sin{\theta}&\sin{\phi}\sin{\theta}&\cos{\theta}\\\cos{\phi}\cos{\theta}&\sin{\phi}\cos{\theta}&-\sin{\theta}\\-\sin{\phi}&\cos{\phi}&0\end{pmatrix} \begin{pmatrix}v_x\\v_{y} \\ v_{z}\end{pmatrix}\\$$

So my vector field in spherical coordinates would be:

$$\vec{F}_{\text{spherical}}=\begin{pmatrix}\cos{\phi}\sin{\theta}\frac{x}{r}+\sin{\phi}\sin{\theta}\frac{y}{r}+\cos{\theta}\frac{z}{r}\\ \cos{\theta}\cos{\phi}\frac{x}{r}+\sin{\phi}\cos{\theta}\frac{y}{r}-\sin{\theta}\frac{z}{r}\\-\sin{\phi\frac{x}{r}+\cos{\phi}\frac{y}{r}}\end{pmatrix}$$

1st question: Is this correct or do I also have to substitute in $x,y,z$?

2nd question: Why does this method work? How can you arrive at this matrix? Is this like a rotation matrix?

There are two different questions here combined into one. One is translating the values of the components of a vector field from one basis to another. The other one is expressing those components with respect to one coordinate system or the other. You may have done the first task correctly (more on that in a second) but you haven't yet done the second step. You may now want to change your expressions so they are all in one set of variables. In the majority of situations, it would make sense to express everything with respect to the spherical variables since that appears to be the coordinate system you are going to.

Now, when you do that step, you will know whether you've done your calculation correctly. I can tell you that the correct answer is easily seen to be $$\begin{bmatrix}1\\ 0\\ 0 \end{bmatrix}$$ since your vector field points along the radial direction and has length one, so it coincides with the first vector from the spherical basis.

One final note. You will find essentially three different spherical bases in literature. In all cases, the three vectors point in the same three orthogonal directions, but the scaling is different. Perhaps the most common choice - which makes the least amount of sense - is to normalize all the vectors to one. The two other, far more elegant, choices are called covariant and contravariant. (Look up "Tensor Calculus" on YouTube.) For your particular problem, the choice won't matter since all three bases agree on the first vector in the triplet.

• Thank you very much. Perfect answer to my first question and why the transformed vector field should look like that! – bluemoon May 3 '16 at 22:32
• Yes, why does it work. It works because it's nothing but the Chain Rule. When you apply the Chain Rule you will see that the relationship between the sets of partial derivatives can be expressed by a matrix product. It is a very important exercise to work out. – Lemma May 4 '16 at 16:51

1st question: Is this correct or do I also have to substitute in $x,y,z$?

Yes, you can substitute in for $x$, $y$, and $z$ using the conversions to spherical coordinates.

2nd question: Why does this method work? How can you arrive at this matrix? Is this like a rotation matrix?

The transformation matrix is something called a Jacobian, referred to by some as the "total derivative" of a linear transformation, which in this case is denoted by1 $$\mathbf{J}=\frac{\partial(x,y,z)}{\partial(r,\theta,\phi)}$$ The entry in the $i$th row and $j$th column is the partial derivative of Cartesian coordinate $i$ with respect to spherical coordinate $j$. For example, $$\mathbf{J}^2_3=\frac{\partial y}{\partial\phi}=\frac{\partial}{\partial\phi}\left[r\sin\theta\sin\phi\right]=r\sin\theta\cos\phi$$ You can indeed connect the Jacobian with a rotation matrix. For example, try finding the Jacobian for a transformation in two dimensional polar coordinates. Surprisingly enough, the Jacobian turns out to have a form similar to a rotation matrix, although not quite the same.

1 This notation sometimes refers to the Jacobian determinant. I'm using it to refer to the matrix itself for clarity about the coordinate systems.

• Thank you very much for your answer. The jacobian is something I will take a closer look at. Now it actually makes sense where this matrix comes from. – bluemoon May 3 '16 at 22:31