Converting Rectangular Coordinates to Spherical Coordinates

If the rectangular coordinates of a point \(P\) are \(( 1,\sqrt{3} ,-2) \), find the spherical coordinates of \(P\).

Solution We use the equations (2) to convert rectangular coordinates to spherical coordinates. Then \begin{eqnarray*} \rho &=&\sqrt{x^{2}+y^{2}+z^{2}}=\sqrt{1+3+4}=\sqrt{8}=2\sqrt{2} \\ \tan \theta &=&\dfrac{y}{x}=\dfrac{\sqrt{3}}{1}, \hbox{ so }\theta =\tan ^{-1}\sqrt{3}=\dfrac{\pi }{3}\qquad \\ \cos \phi &=&\dfrac{z}{\rho }=\dfrac{-2}{2\sqrt{2}}=-\dfrac{\sqrt{2}}{2}, \hbox{ so }\phi =\cos ^{-1}\!\left( -\dfrac{\sqrt{2}}{2}\right) =\dfrac{ 3\pi }{4} \end{eqnarray*}

The spherical coordinates of \(P\) are \(\!\left( 2\sqrt{2},\dfrac{\pi }{3},\dfrac{3\pi }{4}\right) \).