# Conversion of cartesian position and velocity to spherical velocity

Let's say that there is a particle with Cartesian coordinates $$(x,y,z)=(1, 2, 3)$$ and Cartesian velocity $$(x', y', z')=(4, 5, 6)$$.

Converting the position to spherical coordinates is straightforward:

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

$$\theta = \text{atan2}(y,x)$$

$$\phi = \text{arccos}(z/r)$$

However, velocity eludes me, despite having the equation written in front of me.

From that same reference, $$\vec{v} = \dot{r} \hat{e}_r + r\dot{\theta}\text{sin}(\phi)\hat{e}_{\theta} + r\dot{\phi}\hat{e}_{\phi}$$.

Hold on...what I want are $$\dot{r}$$, $$\dot{\theta}$$, and $$\dot{\phi}!$$

What would be the way to get the spherical velocity components in terms of Cartesian position and velocity?

• $\dot{r}, \dot{\theta}, \dot{\phi}$ are time derivatives of the new coordinates $(r,\theta, \phi)$. You can calculate the velocity in the new reference frame by writing: $$\vec{r} = l \hat{e}_r$$ and calculating the derivative with respect to time, noticing that both $l$ and $\hat{e}_r$ my vary in time. – Socrates Apr 24 at 21:02
• @Socrates What is the $l$? – Dave Apr 24 at 21:08
• It is actually $r$, the distance from the origin, I can't edit it anymore. – Socrates Apr 24 at 21:09
• And $\hat{e}_r$ is the unit vector in the direction of increasing $r$, it can be calculated from this definition as follows: $\frac{ \partial \vec{r} }{ \partial r } / \left| \frac{\partial \vec{r}}{\partial r} \right|$ – Socrates Apr 24 at 21:12
• @Socrates Differentiate with respect to $r$? – Dave Apr 24 at 21:16

In spherical coordinates the velocity is: $$\vec{v} = v_r \hat{e_r} + v_\phi \hat{e_\phi} + v_\theta \hat{e_\theta}$$ which is the same as you write above. Since the unit vectors are orthogonal, to get $$v_r$$, you take the scalar product $$\vec{v}\cdot \hat{e_r} = v_r$$

However, the velocity vector is the same vector wether you write it using the spherical coordinates or Cartesian coordinates. In the Cartesian coordinate system, the velocity is given by: $$\vec{v} = v_x \hat{e_x} + v_y \hat{e_y} +v_z \hat{e_z}$$

So you can use the equation above to calculate $$v_r$$ in terms of the components of the velocity in the Cartesian system

$$v_r = \vec{v}\cdot \hat{e_r} = v_x \hat{e_x}\cdot \hat{e_r} + v_y \hat{e_y}\cdot \hat{e_r} +v_z \hat{e_z}\cdot \hat{e_r}$$

To calculate the scalar products above, it is best to sketch the unit vectors of the spherical system against the basis of the Cartesian unit vectors. You will get, for instance $$\hat{e_r}\cdot\hat{e_x} = \sin\theta\cos\phi$$ and so on for each component.

Sketch method

In the way I wrote above, you could get $$\hat{e_r}\cdot\hat{e_x}$$ by a sketch with which you could identify the angles. For instance, take the radial unit vector $$\hat{e_r}$$- it is pointing in the direction of increasing coordinate $$r$$. Now, you can decompose this unit vector $$\hat{e_r}$$ into a part in the direction of $$\hat{e_z}$$, and a part which is spanned by $$\hat{e_x}$$ and $$\hat{e_y}$$.

I will write this formally as (keep in mind that we are working with vectors of unit lenght): $$\hat{e_r} = a_1 \hat{e_x} + a_2 \hat{e_y} + a_3 \hat{e_z}$$ To visualize, see the Wikipedia image for the spherical coordinate system

From this sketch, you can see that the length of $$\hat{e_r}$$ in the direction $$\hat{e_z}$$ is exactly $$\cos\theta$$, hence $$a_3 = \hat{e_z}\cdot \hat{e_r} = \cos\theta$$

Now that the $$z$$ component is sorted out, lets look at the rest. You can view the remaining part $$a_1 \hat{e_x} + a_2 \hat{e_y}$$ as the orthogonal projection of the vector $$\hat{e_r}$$ to the $$xy$$ plane. The length of this projection is $$\sin\theta$$, so to get the part in the direction of the $$x$$ axis multiply this length with $$\cos\phi$$.

Finally, you obtain $$a_1 = \hat{e_r}\cdot\hat{e_x} = \sin\theta\cos\phi$$

and similarly for the component in the $$x$$ direction $$a_2 = \hat{e_r}\cdot\hat{e_y} = \sin\theta\sin\phi$$

Jacobians

(If I understand OP's comment, the question is why can't we apply the Jacobian matrix to perform the coordinate transformation)

From here down, we use the Einstein convention where repeated indices are summed over. I recommend 1 as a good textbook for a better understanding.

In a more precise definition, a basis for vector fields are the partial derivatives along the coordinate chart axes, so in the Cartesian system we have: $$\hat{e_x} = \frac{\partial}{\partial x}$$ and a vector can be written out as $$V = V^i \frac{\partial}{\partial x^i} = V^1 \frac{\partial}{\partial x^1} + V^2 \frac{\partial}{\partial x^2} + V^3 \frac{\partial}{\partial x^3}$$ and the components $$V^1, V^2, V^3$$ are the same as in $$V = V^1\hat{e_x} + V^2\hat{e_y} + V^3\hat{e_z}$$

If we want to change the coordinates, we just use the chain rule:

$$$$V = V^i \frac{\partial}{\partial x^i} = V^i \frac{\partial y^j}{\partial x^i}\frac{\partial}{\partial y^j} \tag{*}\label{one}$$$$

So we just read off the components in the new coordinate system $$y$$ as $$V'^i = V^i \frac{\partial y^j}{\partial x^i}$$ and find inside the inverse of the Jacobian matrix.

However, this method works if in both cases the basis vectors are the partial derivatives against the coordinate variables. For instance, in the case of the polar coordinate system, this is not true, e.g.

$$\hat{e_\phi} \neq \frac{\partial}{\partial_\phi}$$ but $$\hat{e_\phi} = \frac{1}{r} \frac{\partial}{\partial_\phi}$$

so it is not correct to apply the inverse of the Jacobian matrix for calculating new vector components in such a basis (formally known as non-coordinate basis). (See excercise 2.1 in 1) It does not mean that the non-coordinate bases are not useful, only that linear relations such as \ref{one} are not applicable.

1 Bernard Schutz: Geometrical Methods of mathematical physics

• I'm mostly following this and can work out most of the rest of the calculations. When it comes time to take $\hat{e}_r \cdot \hat{e}_y$, is that $\sin\theta\sin\phi$ or $r\cos\theta\cos\phi$? Then I think I can go through the Jacobian and get my function of spherical velocities in terms of Cartesian position and velocity. – Dave Apr 24 at 22:29
• They are all unit vectors, so $\hat{e_r}\cdot\hat{e_y}$ would be $\sin\theta \sin\phi$ – Mateo Apr 25 at 10:44
• I have been able to go through the calculation and get the full transformation. I remain confused, however, about why $\hat{e_r}\cdot \hat{e_{x}}=\sin\theta\cos\phi$ and the relationship to the Jacobian. Could you please elaborate on that? – Dave Apr 26 at 2:50
• Thanks for the long edit. What I meant is why $\hat{e_r}\cdot\hat{e_x}=\sin\theta\cos\phi$ or in general why $\hat{e}_{spherical}\cdot\hat{e}_{Cartesian}=\frac{\partial Cartesian}{\partial spherical}$ (the elements of the Jacobian matrix)? I thought I got your explanation until you said that it doesn’t work for polar coordinates. – Dave Apr 28 at 1:22
• The scalar products of the basis vectors in two systems are here not equal to the Jacobian matrix - en.wikipedia.org/wiki/… notice the factor of $r$ inside – Mateo Apr 28 at 14:36