[Math] Converting from Cartesian coordinates to Spherical coordinates

spherical coordinates

I want to understand how to convert from Cartesian coordinates to spherical coordinates. I have the following definitions:

\begin{align} x & =r\sin\theta\cos\phi \\[6pt]
y & =r\sin\theta\sin\phi \\[6pt]
z & =r\cos\theta \\[6pt]
\rho & =r\sin\theta
\end{align}

In written terms: $r$ is the distance from the origin to the point, $\phi$ is the angle needed to rotate around $z$ to get to the point, $\theta$ is the angle from the positive $z$-axis, $\rho$ is the distance between the point and the $z$-axis.

On the basis that $(x,y,z)=(r,\theta,\phi)$ I have,

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

using Pythagoras' Theorem gives

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

Next take $z=r\cos\theta$ which gives

$$\theta=\arccos\left(\frac{z}{r}\right).$$ Both of these agree with what I have found on wikipedia, however I can't understand how the last coordinate $\phi$ is reached. This is what I get:

$$y=r\sin\theta\sin\phi$$
$$\frac{y}{r\sin\theta}=\sin\phi$$

from here I use the relationship that $\rho=\sqrt{x^2+y^2}=r\sin\theta$ and write

$$\frac{y}{\rho}=\sin\phi$$
$$\arcsin\left(\frac{y}{\rho}\right)=\phi.$$

Have I gone wrong somewhere? Can it be explained to me how my last result differs from that provided by wikipedia?

Thanks

Best Answer

In most texts, $\theta$ is the angle in the $xy$ plane and $\phi$ is the angle down from the $z$ axis. That is, I think you (and wiki) have things not as usual. Nevertheless, using their definitions, both answers are correct.

The wiki terms for $y$ and $x$, when one computes $y/x$ the $r \sin(\theta)$ cancels and the result is $\sin(\phi)/\cos(\phi) = \tan(\phi)$. so you can say $\phi = \tan^{-1}(y/x)$ as wiki does.

For your version, you use the extra symbol $\rho$, which is really $r \sin(\theta)$. So using the same formulas from wiki gives $y/\rho = y/(r \sin(\theta) )$. This time the $y$ in wiki is $r\sin(\theta)\sin(\phi)$, so things cancel and you get $y/\rho = \sin(\phi)$. Thus you can also say that $\phi = \arcsin(y/\rho)$. But note that $\rho$ is not one of the spherical coordinates, but is just $r\sin(\theta)$ in terms of the spherical coordinates. It's not usual to give the inverse in terms of other symbols than the direct variables.

Related Question