# I have a vector of length 1, and two angles (in $xz$ plane and $yz$ plane), how do i get the $x,y,z$ compontents of this vector?

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?

-
No, its no homework (not really). Context is: I get two angles from 4 solar panels (which means I compute those angles from the currents of the panels) – Daniel Jour Nov 21 '12 at 21:12
Suggested a homework tag -- looks like a homework problem. – gt6989b Nov 21 '12 at 21:12
but nonetheless the homework tag won't hurt ^^ – Daniel Jour Nov 21 '12 at 21:17
I suppose if you are planning to install the panels on your roof, then it is literally a home-work problem. – Gerry Myerson Nov 21 '12 at 23:16

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$.
$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