# Rodrigues' rotation formula

In the theory of three-dimensional rotation, Rodrigues' rotation formula (named after Olinde Rodrigues) is an efficient algorithm for rotating a vector in space, given an axis and angle of rotation. By extension, this can be used to transform all three basis vectors to compute a rotation matrix from an axis–angle representation. In other words, the Rodrigues formula provides an algorithm to compute the exponential map from so(3) to SO(3) without computing the full matrix exponent.

If $\mathbf{v}$ is a vector in $\mathbb{R}^3$ and $\mathbf{k}$ is a unit vector describing an axis of rotation about which we want to rotate $\mathbf{v}$ by an angle $\theta$ according to the right hand rule, the Rodrigues formula is:

$\mathbf{v}_\mathrm{rot} = \mathbf{v} \cos\theta + (\mathbf{k} \times \mathbf{v})\sin\theta + \mathbf{k} (\mathbf{k} \cdot \mathbf{v}) (1 - \cos\theta).$

## Derivation

Rodrigues' rotation formula rotates v by an angle θ around an axis z by decomposing it into its components parallel and perpendicular to z, and rotating only the perpendicular component.

Given a rotation axis represented by a unit vector $\mathbf{k}$ and a vector $\mathbf{v}$ that we wish to rotate about $\mathbf{k}$ by the angle $\theta$,

$\mathbf{v}_{\parallel} = (\mathbf{k} \cdot \mathbf{v}) \mathbf{k}$

is the component of $\mathbf{v}$ parallel to $\mathbf{k}$, also called the vector projection of $\mathbf{v}$ on $\mathbf{k}$, and

$\mathbf{v}_{\perp} = \mathbf{v} - \mathbf{v}_{\parallel} = \mathbf{v} - (\mathbf{k} \cdot \mathbf{v}) \mathbf{k}$

is the component of $\mathbf{v}$ orthogonal to $\mathbf{k}$, also called the vector rejection of $\mathbf{v}$ from $\mathbf{k}$.

Let

$\mathbf{w} = \mathbf{k}\times\mathbf{v}$.

The vectors $\mathbf{v}_\perp$ and $\mathbf{w}$ have the same length, but $\mathbf{w}$ is perpendicular to both $\mathbf{k}$ and $\mathbf{v}_\perp$. This can be shown via

$\mathbf{w} = \mathbf{k} \times \mathbf{v} = \mathbf{k} \times (\mathbf{v}_{\parallel} + \mathbf{v}_{\perp}) = \mathbf{k} \times \mathbf{v}_{\parallel} + \mathbf{k} \times \mathbf{v}_{\perp} = \mathbf{k} \times \mathbf{v}_{\perp} ,$

since $\mathbf{k}$ has unit length, is parallel to $\mathbf{v}_\parallel$ and is perpendicular to $\mathbf{v}_\perp$.

The vector $\mathbf{w}$ can be viewed as a copy of $\mathbf{v}_\perp$ rotated by 90° about $\mathbf{k}$. Using trigonometry, we can now rotate $\mathbf{v}_\perp$ by $\theta$ around $\mathbf{k}$ to obtain $\mathbf{v}_{\perp\ \mathrm{rot}}$. Thus,

\begin{align} \mathbf{v}_{\perp\ \mathrm{rot}} &= \mathbf{v}_{\perp}\cos\theta + \mathbf{w}\sin\theta\\ &= (\mathbf{v} - (\mathbf{k} \cdot \mathbf{v}) \mathbf{k})\cos\theta + (\mathbf{k} \times \mathbf{v})\sin\theta. \end{align}

$\mathbf{v}_{\perp\ \mathrm{rot}}$ is also the rejection from $\mathbf{k}$ of the vector $\mathbf{v}_{\mathrm{rot}}$, defined as the desired vector, $\mathbf{v}$ rotated about $\mathbf{k}$ by the angle $\theta$. Since v is not affected by a rotation about $\mathbf{k}$, the projection of $\mathbf{v}_\mathrm{rot}$ on $\mathbf{k}$ coincides with $\mathbf{v}_\parallel$. Thus,

\begin{align} \mathbf{v}_{\mathrm{rot}} &= \mathbf{v}_{\perp\ \mathrm{rot}} + \mathbf{v}_{\parallel\ \mathrm{rot}} \\ &= \mathbf{v}_{\perp\ \mathrm{rot}} + \mathbf{v}_{\parallel} \\ &= (\mathbf{v} - (\mathbf{k} \cdot \mathbf{v}) \mathbf{k}) \cos\theta + (\mathbf{k} \times \mathbf{v})\sin\theta + (\mathbf{k} \cdot \mathbf{v}) \mathbf{k} \\ &= \mathbf{v} \cos\theta + (\mathbf{k} \times \mathbf{v})\sin\theta + \mathbf{k} (\mathbf{k} \cdot \mathbf{v}) (1 - \cos\theta), \end{align}

as required.

### Matrix notation

We first represent $\mathbf{v}$ and $\mathbf{k}$ as column matrices, and defining a matrix $\mathbf{K}$ as the "cross-product matrix" for the vector $\mathbf{k}$, i.e.,

$\mathbf{K}= \left[\begin{array}{ccc} 0 & -k_3 & k_2 \\ k_3 & 0 & -k_1 \\ -k_2 & k_1 & 0 \end{array}\right]$.

This can easily be checked to have the property that

$\mathbf{K}\mathbf{v} = \mathbf{k}\times\mathbf{v}$

for any vector $\mathbf{v}$ (in fact, $\mathbf{K}$ is the unique matrix with this property).

Now, from the last equation in the previous sub-section, we may write:

\begin{align} \mathbf{v}_{\mathrm{rot}} &= \mathbf{v} \cos\theta + (\mathbf{k} \times \mathbf{v})\sin\theta + \mathbf{k} (\mathbf{k} \cdot \mathbf{v}) (1 - \cos\theta) \\ &= \mathbf{v} \cos\theta + (\mathbf{K} \mathbf{v})\sin\theta + (\mathbf{k} (\mathbf{k} \cdot \mathbf{v}) - \mathbf{v}) (1 - \cos\theta). \end{align}

To simplify further we use the well-known formula for the vector triple product:

$\mathbf{a}\times (\mathbf{b}\times \mathbf{c}) = \mathbf{b}(\mathbf{a}\cdot\mathbf{c}) - \mathbf{c}(\mathbf{a}\cdot\mathbf{b})$

with $\mathbf{a} = \mathbf{b} = \mathbf{k}$, and $\mathbf{c} = \mathbf{v}$, we obtain

$(\mathbf{k} (\mathbf{k} \cdot \mathbf{v}) - \mathbf{v}) = \mathbf{k} \times (\mathbf{k} \times \mathbf{v})$

or

$\mathbf{k} (\mathbf{k} \cdot \mathbf{v}) - \mathbf{v} = \mathbf{K}^2 \mathbf{v}$.

This means (substituting the above equation in the last one for $\mathbf{v}_{\mathrm{rot}}$) :

$\mathbf{v}_{\mathrm{rot}} = \mathbf{v} + (\sin\theta) \mathbf{K}\mathbf{v} + (1-\cos\theta)\mathbf{K}^2\mathbf{v}$.

Hence we can write Rodrigues' formula in matrix notation:

\begin{align} \mathbf{v}_{\mathrm{rot}} &= \mathbf{M}\mathbf{v} \end{align}

where $\mathbf{M}$ is the rotation matrix:

\begin{align} \mathbf{M} = \mathbf{I} + (\sin\theta) \mathbf{K} + (1-\cos\theta)\mathbf{K}^2 \end{align}

Since $\mathbf{K}$ is defined in terms of the components of the rotation axis $\mathbf{k}$, and $\theta$ is the rotation angle, $\mathbf{M}$ is the rotation matrix about $\mathbf{k}$ by angle $\theta$, and is very easy to compute.

$\mathbf{M}$ is a member of the rotation group SO(3) of R3, and $\mathbf{K}$ is a member of the Lie algebra so(3) of that Lie group. In terms of the matrix exponential, we have

$\mathbf{M} = \mathbf{exp}(\theta\mathbf{K})$.

For an alternative derivation based on this exponential relationship, see https://en.wikipedia.org/wiki/Axis-angle_representation#Relationship_to_other_representations in the subsection Exponential map from so(3) to SO(3) .

For the inverse mapping, see Log map from SO(3) to so(3).