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.

I am having trouble remembering linear algebra. I need to find the orthonormal transformation that will rotate a 3-dimensional vector to the x axis. I could not find any similar question on the net. Any tips?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Here's how I'd think about it.

Start with your arbitrary vector $\vec{v} = (x,y,z)$ (thought of as a column vector). First, we're going to rotate it to be in the $xy$ plane. We'll achieve this with a matrix of the form $$A=\begin{bmatrix} 1&0&0\\0 &\cos(\theta) & -\sin(\theta)\\ 0 & \sin(\theta) & \cos(\theta)\end{bmatrix}.$$

Applying this to $\vec{v}$ rotates $\vec{v}$ about the x-axis, giving the vector $$A\vec{v} = (x,\text{ }\cos(\theta)y - \sin(\theta)z,\text{ }\sin(\theta)y+\cos(\theta)z).$$ This will lie in the $xy$ plane precisely when the $z$ component is $0$, so we need to pick $\theta$ so that $\sin(\theta)y + \cos(\theta)z = 0$.

Solving this for $\theta$ gives $\theta = \arctan(-\frac{z}{y})$, so we actually know $A$. (There is some ambiguity in using $\arctan$ owing to the fact that $\tan$ is not 1-1. Turns out, if you use a different $\arctan$ function, then end result of $A\vec{v}$ may be different, but will still be in the $xy$ plane.)

Next, we're going to rotate this new vector to be on the $x$-axis. To do this, we'll use a matrix of the form $$B = \begin{bmatrix} \cos(\alpha) & -\sin(\alpha) & 0\\ \sin(\alpha) & \cos(\alpha) & 0\\ 0 & 0 &1\end{bmatrix}.$$

Applying $B$ to our new vector $A\vec{v}$ gives $$BA\vec{v} =(\cos(\alpha)x -\sin(\alpha)[\cos(\theta)y - \sin(\theta)z],\text{ }\sin(\alpha)x + \cos(\alpha)[\cos(\theta)y -\sin(\theta)z],\text{ }0).$$

This will lie along the $x$ axis when the $y$ component is $0$, i.e., when $\sin(\alpha)x + \cos(\alpha)[\cos(\theta)y - \sin(\theta)z]=0$. Solving this for $\alpha$ gives $\alpha = \arctan(-\frac{\cos(\theta)y-\sin(\theta)z}{x}),$ so we know the matrix $B$ as well.

To achieve this via a single orthogonal transformation, use $$BA = \begin{bmatrix} \cos(\alpha) & -\sin(\alpha)\cos(\theta) & \sin(\alpha)\sin(\theta)\\ \sin(\alpha) & \cos(\alpha)\cos(\theta) & -\cos(\alpha)\sin(\theta) \\ 0 & \sin(\theta) & \cos(\theta)\end{bmatrix}$$ where $\alpha$ and $\theta$ are as above.

share|improve this answer

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.