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 just can't see what's wrong, this should be relatively simple...

I have a vector which has length 1. Then, I have two angles. The first ($\gamma$) is the angle between the projection of the vector in the $xz$ plane and the $z$ axis. The second ($\beta$) is the angle between the projection of the vector in the $yz$ plane and the $z$ axis.

All I need now are the (cartesian) vector components $(x,y,z)$.

How do I calculate them?

I got: $x = \sin(\gamma)\\ y = \sin(\beta)\\ z = \cos(\gamma) \cdot \cos(\beta)$

But this can't be correct, because the length of this vector is not always 1. Can you help me and find the error, please?

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

I think you got $x=\sin\gamma$ by saying that you have a right triangle in the $xz$-plane with side $x$ opposite angle $\gamma$, but then you are also assuming the length of the hypotenuse is $1$. It isn't. The hypotenuse is a projection of a vector of length $1$, but (unless the $y$-coordinate turns out to be zero) it is itself a vector of length strictly less than $1$.

Perhaps a more fruitful approach begins with $\tan\gamma=x/z$.

share|cite|improve this answer
Yes! I think this would lead much more quickly to the solution than the dot product approach I used in my answer. +1. – coffeemath Nov 22 '12 at 0:04
$x = z\tan\gamma$ and $y=z\tan\beta$ and $x^2+y^2+z^2=1$ so $z=\pm1/\sqrt{1+\tan^2\gamma+\tan^2\beta}$, huzzah! – Rahul Nov 22 '12 at 0:10
This is indeed much quicker, but I liked coffeemath's answer, too. And there is one more good about it: actually, I do have the tangens values of both angles. – Daniel Jour Nov 22 '12 at 8:41

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.