The correct formula to convert from cylindrical to spherical coordinates

cylindrical coordinatesspherical coordinates

To convert the polar angle θ from cylindrical to spherical coordinates the equation is:

Note: $r$ is the radial distance of the cylindrical representation

$$
\theta = \arctan\left(\frac rz\right)
$$

Wikipedia:

According to my own derivation the equation should be

$$\theta = \arccos\left(\frac z{\sqrt{r^2+z^2}}\right)$$

Can someone please help here? Which is correct?

Best Answer

So after looking deeper in the internet I found this site which also uses the formula that I derived.

The thing is actually both are correct, but Wikipedia's is only defined for $0<θ< {pi\over 2}$ while the one I derived is defined for $0 < \theta < \pi$.

To see how I derived it it's actually pretty easy: radius r, coordinate z and $\sqrt[2]{r^2+z^2}$ form a right angle triangle where $\sqrt[2]{r^2+z^2}$ is the hypothenuse and coordinate z is adjacent of θ, which means that r is opposite of $\theta$. To get $\theta$, one can now use cosine or tangent as all three sides of the triangle are known, but when z is negative using tangent will give an incorrect angle.

Related Question