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