4
$\begingroup$

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

2 Answers 2

2

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.

  • 0
    A$h$ yes, I see so it's just common sense to do that, or not in my case! Thanks, I understand now.2012-10-12
2

Your formula for $\phi$ is correct for $x>0$, but gives the wrong angle when $x<0$: in this case $\phi\in(\pi/2,3\pi/2)$, but $\arcsin$ gives a result in $[-\pi/2,\pi/2]$.

The formula shown by Wikipedia is obtained from

$ \sin\phi=y/\rho\\ \cos\phi=x/\rho $

and dividing the two's (when possible)

$ \tan\phi=y/x. $

From here it comes out $\arctan$, with all the warning of the case, leading to the atan2 function.

  • 0
    Thanks for taking the time to answer, could you provide some more clarification on _why_ I would divide $y$ by $x$? I can see now that, that would give me $\tan$ which is what I need but I don't understand why I would do this.2012-10-12