Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a graphics problem that reduces to this:

(Computer equation)

alpha = arctan(X / ((Y / (Z * cos(alpha) - k)) * Z * cos(alpha)))

$$\alpha = \arctan \left( \displaystyle \frac{x}{\displaystyle \left( \frac{yz\cos(\alpha)}{z\cos(\alpha)-k} \right)} \right)$$

I need to solve for $\alpha$. Obviously, there's no closed form. I know $\alpha$ is around $13.5^{\circ}$. Is it "wimpy" of me just to use $13.5$ on the right hand side to get an approximation? Or would "a real man" use Newton-Raphson, or bisection, or something?

share|cite|improve this question
up vote 5 down vote accepted

Take $\tan$ on both sides and you get an algebraic equation in $\cos \alpha$, once you replace $\tan \alpha = \sin \alpha/ \cos \alpha$ and use $\sin^2 \alpha + \cos^2 \alpha=1$.

share|cite|improve this answer
See a solution by Wolfram Alpha. – lhf Jun 1 '11 at 16:25
I just implemented the Wolfram Alpha solution in my Java program, and yes, it really works. :-) Thanks so much; I'll think twice before ever saying "Obviously, there's no closed form" again. :-) – George Freeman Jun 2 '11 at 2:33

If you have an approximate solution, iteration can be a good way to get a numeric answer. If you think of your iteration as $\alpha_{i+1}=f(\alpha_i)$, it will converge as long as $\left|\frac{d\alpha_{i+1}}{d\alpha_i}\right|\lt 1$ and will converge quickly if it is much less than $1$. It saves you the work of taking the derivative for Newton-Raphson and converges faster than bisection if the absolute value of the derivative is less than 0.5. You lose the bracketing property of bisection, so want to make sure your function is well-behaved.

share|cite|improve this answer
+1 If the iteration in this form does not converge , you can also try "inverting" it, isolating the cosine, and getting a similar iteration with $\alpha = arccos(...)$ – leonbloy Jun 1 '11 at 16:05

Your Answer


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.