# 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 v is a vector in $\mathbb{R}^3$ and k is a unit vector describing an axis of rotation about which we want to rotate v by an angle θ 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 z represented by a unit vector k = (kX, kY, kZ), and a vector v = (vX, vY, vZ) that we wish to rotate about z, the vector

$\mathbf{v}_z = (\mathbf{k} \cdot \mathbf{v}) \mathbf{k}$

is the component of v parallel to z, also called the vector projection of v on k, and the vector

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

is the projection of v onto the xy plane orthogonal to z, also called the vector rejection of v from k.

Notice that we chose to define a reference frame xyz in which the z axis is aligned with the rotation axis, and the x axis with the rejection of v from k. This simplifies the demonstration, as it implies that v lies on the xz plane, and its component vy is null (see figure). However, xyz does not coincide with the reference frame XYZ in which vectors v, k, vx, and vz are actually represented. For instance, v = (vX, vY, vZ) ≠ (vx, vy, vz). In other words, Rodrigues' formula is independent of the orientation in space of the reference frame XYZ in which v and k are represented.

Next let

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

Notice that vx and w have the same length. By definition of the cross product, the length of w is:

$|\mathbf{w}| = |\mathbf{k} \times \mathbf{v}| = |\mathbf{k}| \, |\mathbf{v}| \sin \varphi \$

where φ denotes the angle between z and v. Since k has unit length,

$|\mathbf{w}| = |\mathbf{k} \times \mathbf{v}| = |\mathbf{v}| \sin \varphi.$

This coincides with the length of vx, computed trigonometrically as follows:

$|\mathbf{v}_x| = |\mathbf{v}| \cos(\pi/2-\varphi) = |\mathbf{v}| \sin \varphi.$

So w can be viewed as a copy of vx rotated by 90° about z. Using trigonometry, we can now rotate vx by θ around z to obtain vx rot. Its two components with respect of x and y are vxcosθ and wsinθ, respectively. Thus,

\begin{align} \mathbf{v}_{x\ \mathrm{rot}} &= \mathbf{v}_x\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}

vx rot can be also described as the projection on xy (or rejection from z) of the rotated vector vrot (see figure). Since vz is obviously not affected by a rotation about z, the other component of vrot (i.e. its projection on z) coincides with vz. Thus,

\begin{align} \mathbf{v}_{\mathrm{rot}} &= \mathbf{v}_{x\ \mathrm{rot}} + \mathbf{v}_{z\ \mathrm{rot}} \\ &= \mathbf{v}_{x\ \mathrm{rot}} + \mathbf{v}_z \\ &= (\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

By representing v and k as column matrices, and defining a matrix $[\mathbf{k}]_\times$ as the "cross-product matrix" for $\mathbf{k}$, i.e.,

$[\mathbf{k}]_\times \mathbf{v} = \mathbf{k}\times\mathbf{v} = \left[\begin{array}{ccc} 0 & -k_3 & k_2 \\ k_3 & 0 & -k_1 \\ -k_2 & k_1 & 0 \end{array}\right]\mathbf{v}$,

Rodrigues' formula can be written in matrix notation:

\begin{align} \mathbf{v}_{\mathrm{rot}} &= \mathbf{v} \cos\theta + ([\mathbf{k}]_\times \mathbf{v}) \sin\theta + \mathbf{k} (\mathbf{k}^\mathsf{T} \mathbf{v}) (1 - \cos\theta) \\ &= \mathbf{v} \cos\theta + [\mathbf{k}]_\times \mathbf{v} \sin\theta + \mathbf{k} \mathbf{k}^\mathsf{T} \mathbf{v} (1 - \cos\theta). \end{align}

Using the triple product expansion it can be written as:

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

since $\mathbf{k}^\mathsf{T} \mathbf{k}=1$ for a normalized vector.

## Conversion to rotation matrix

The equation can be also written as

\begin{align} \mathbf{v}_{\mathrm{rot}} &= (I\cos\theta) \mathbf{v} + ([\mathbf{k}]_\times \sin\theta) \mathbf{v} + (1 - \cos\theta) \mathbf{k} \mathbf{k}^\mathsf{T} \mathbf{v} \\ &= \left( I \cos\theta + [\mathbf{k}]_\times \sin\theta + (1 - \cos\theta) \mathbf{k} \mathbf{k}^\mathsf{T} \right) \mathbf{v}\\ &= R\mathbf{v} \end{align}

where I is the 3×3 identity matrix. Thus we have a formula for the rotation matrix R corresponding to an axis angle representation [k θ]:

$R = I \cos\theta + [\mathbf{k}]_\times \sin\theta + (1 - \cos\theta) \mathbf{k} \mathbf{k}^\mathsf{T}$.

Noting that, using the outer product $\mathbf{k} \mathbf{k}^\mathsf{T} = [\mathbf{k}]_\times^2 + I$, we have

$R = I + [\mathbf{k}]_\times \sin\theta + (1 - \cos\theta) [\mathbf{k}]_\times^2$

or, equivalently,

$R = I + \sin\theta [\mathbf{k}]_\times + (1 - \cos\theta) (\mathbf{k} \mathbf{k}^\mathsf{T}-I)$.

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