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've two vectors $a = (a_1, a_2, a_3)$ and $b = (b_1, b_2, b_3)$. How to find transformation matrix for transform from a to b?

share|cite|improve this question
You need some restrictions. For example if a=(0,0,0) and b is anything else, there's no possible transformation matrix. – coffeemath Oct 9 '12 at 17:22
@coffeemath sure, you can check my answer, in that case one will not be able to find axis of rotation (and angle of course). – Yola Feb 18 at 16:37

Try the dyadic product $$ \mathbf{a b} \equiv \mathbf{a}\otimes\mathbf{b} \equiv \mathbf{a b}^\mathrm{T} = \begin{pmatrix} a_1 \\ a_2 \\ a_3 \end{pmatrix}\begin{pmatrix} b_1 & b_2 & b_3 \end{pmatrix} = \begin{pmatrix} a_1b_1 & a_1b_2 & a_1b_3 \\ a_2b_1 & a_2b_2 & a_2b_3 \\ a_3b_1 & a_3b_2 & a_3b_3 \end{pmatrix}. $$ Maybe you should include a normalization factor.

share|cite|improve this answer
and interchange a and b... – draks ... Oct 9 '12 at 10:28
up vote 0 down vote accepted

One can use axis-angle representation to get the rotation matrix.

$$Rot(u,\phi)=I \cos\phi + u u^T(1-\cos\phi) + \hat{u}\sin\phi$$ where $u$ is unit axis vector and $\phi$ is angle of rotation.

To find axis vector you need to use cross product of given two vectors $(\overline a\times\overline b)$, and from this cross product you can get first $\sin\phi$ and then $\cos\phi$.

share|cite|improve this answer

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.