Rotating two vectors to point in the same direction I have two vectors, $v$ and $u$.  How do I rotate $u$ around the x-, y-, and z-axes (or one axis) so that it points in the same direction as $v$?
Two 3-vectors define a plane. Rotation in that plane (i.e. about normal vector of that plane) brings one vector to another. So the quick sketch for the solution would be:


find normal vector to the common plane (I think this is just the vector product $u \times v$)
find rotation angle $\theta$ using dot product ($\theta = \cos^{-1}(\frac{u \cdot v}{||u|| ||v||})$)
express the rotation using some axis-angle representation (axis is the normal vector from 1. and angle is the $\theta$ from 2.)


I am curious if someone expresses the straightforward formula here...
If $u,v\in\mathbb R^2$, Find the angle between $u$ and $v$ by $$\cos\theta=\frac{&lt;u,v&gt;}{|u|.|v|}$$
Now take matrix of rotation $A_\theta$ of angle $\theta$. Now take $A_\theta u$ or $A_{-\theta} u$. These will rotate $u$ to the direction of $v$.
$$A_\theta= \left(
  \begin{array}{cc}
  \cos\theta   &amp;-\sin\theta   \\
    \sin\theta &amp;\cos\theta   \\
  \end{array}
\right) $$

For $u,v\in \mathbb R^3$,
Write $v= (a,b,c)$ and $u= (x,y,z)$. If all x,y,z is non zero, then we want $T$ such that $Tu = v$ , define $T$ such that $$T(e_1)= \frac{a}{x} e_1$$
$$T(e_2)=\frac{b}{y} e_2$$
$$T(e_3)= \frac{c}{z}e_3$$  Then we have $T(x,y,z)= (a,b,c)$.  That is rotation matrix is matrix of $T$ that is $$\left(
  \begin{array}{ccc}
   \frac{a}{x } &amp;0  &amp; 0 \\
    0 &amp;\frac{b}{y}  &amp;0  \\
    0 &amp; 0 &amp;\frac{c}{z}  \\
  \end{array}
\right)$$  

If some of x,y,z is zero, then case reduces to $\mathbb R^2$ keeping one axis fixed.

Example:   Assume $u= (1,2,3)$ and $v= (2,-5,6)$  Then rotation matrix which take $u$ to $v$ is $\left(
  \begin{array}{ccc}
   \frac{2}{1} &amp;0  &amp; 0 \\
    0 &amp;\frac{-5}{2}  &amp;0 \\
    0 &amp; 0 &amp;\frac{6}{3}\\
  \end{array}
\right)= $
$\left(
  \begin{array}{ccc}
   2 &amp;0  &amp; 0 \\
    0 &amp;\frac{-5}{2}  &amp;0  \\
    0 &amp; 0 &amp;2  \\
  \end{array}
\right)$

putting value of $a,b,c$ and $x,y,z $ you may have many more example.... If some of $x,y,z$ is what happen see and if didn't get comment it.. i will give example for that too.