Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose we have $x=\sin a \cos b, y=\sin a\sin b, z=\cos a$. I want to invert them to get $a,b$ in terms of $x,y,z$. At first sight it appears very simple, for example my first reaction would be to say that $a= \cos^{-1} z, b= \cos^{-1}{\left(x\over \sqrt{1-z^2}\right)}$. But it doesn't feel right for example that I used only $x,z$ for $b$ since $y$ also involves $b$. I think the inverse like this might not give the right range of angles, since where $\sin,\cos$ are positive don't necessarily overlap. How might I find $a,b$ in terms of more variables? I have to get $a$ to be unique in $(0,\pi)$ and $b$ unique in $(0,2\pi)$.

share|improve this question
    
Your inverses are correct. There is no $y$ in the picture since $x$,$y$, $z$ are constrained to move on a sphere i.e. $x^2 + y^2 + z^2 = 1$. –  user17762 Mar 11 '12 at 22:31
add comment

2 Answers 2

Your formula is correct when $y$ is positive. But when $y$ is negative, $$b=2\pi -\arccos\left(\frac{x}{\sqrt{1-z^2}}\right).$$

Remark: Alternately, one can use $\arctan$ to almost compute $b$. But again adjustment needs to be made, depending on the sign of $y$. In a computing setting, you may be able to use the two-variable $\text{atan}$ function, which deals with the sign issue automatically.

share|improve this answer
add comment

$a= \cos^{-1} z$ and $\frac{y}{x} = \tan(b) \Rightarrow b=\tan^{-1} \frac{y}{x}$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.