# Find angles in $x$ and $y$ from origin to produce direction vector $[x,y,z]$?

I have a vector, $v$ which is a direction vector from the origin

An example is $[0.8,-0.2,-0.55]$

How would I go about calculating the angles you would have to rotate $[0,1,0]$ through the $x$, $y$ and $z$ (although I understand there would only be two angles) axes in order to produce this direction vector? I know how to use rotation matrices and assume they have something to do with it, but I can't make the mental step required to link it all together.

-

## 1 Answer

Let \begin{align} \mathbf{A}= \begin{bmatrix} \cos\theta \cos\psi & -\cos\phi \sin\psi + \sin\phi \sin\theta \cos\psi & \sin\phi \sin\psi + \cos\phi \sin\theta \cos\psi \\\\ \cos\theta \sin\psi & \cos\phi \cos\psi + \sin\phi \sin\theta \sin\psi & -\sin\phi \cos\psi + \cos\phi \sin\theta \sin\psi \\\\ -\sin\theta & \sin\phi \cos\theta & \cos\phi \cos\theta \\\\ \end{bmatrix} \end{align} which is the rotation matrix using standard Euler angles $\phi,\theta,\psi$. Right multiplying this matrix by a preimage vector $v$ will result in the vector $x$. In this case, we have fixed $x$ and are looking for $v$, so we use row reduction (which will result in a complicated expression) \begin{align} \mathbf{A} \begin{bmatrix} v_{1}\\ v_{2}\\ v_{3}\\ \end{bmatrix} = \begin{bmatrix} x_{1}\\ x_{2}\\ x_{3}\\ \end{bmatrix} \end{align} After row reduction, we would explicitily solve for the angles $\phi,\theta,\psi$ to find the angles needed to rotate $v$ into $x$, likely using a computer algebra system. In addition, since this is an orthogonal tranformation, make sure that the preimage vector and image vector have the same length, otherwise no solutions would exist. Hope this will help start you off.

-
Thanks this is exactly what I was looking for. When I come up with the final solution I'll post it up in an edit of the question, but I reckon this constitutes enough information for a correct answer. –  Nick Udell Apr 6 '12 at 10:03