\(
% Arcus cosine.
\def\acos{\cos^{-1}}
% Vector projection.
\def\projection#1#2{{proj_{#1}\left(#2\right)}}
% Vector rejection.
\def\rejection#1#2{{rej_{#1}\left(#2\right)}}
% Norm.
\def\norm#1{{\left\|#1\right\|}}
% Cross product.
\def\cross#1#2{\mathit{cross}\left(#1,#2\right)}
% Dot product.
\def\dot#1#2{{#1 \cdot #2}}
% Magnitude.
\def\mag#1{{\left|#1\right}}
\def\group#1{\left(#1\right)}}
\def\sbgrp#1{\left\{#1\right\}}
\)
Axis angle to matrix
An axis angle \(\left(\hat{r},\alpha\right)\) represents a rotation by
an angle \(\alpha\) around an axis \(\hat{r}\). The matrix representing the same transformation is given by a rotation matrix
\[
R =
\left[\begin{matrix}
t \hat{r}_x^2 + c & t \hat{r}_x \hat{r}_y - s \hat{r}_z & t \hat{r}_x \hat{r}_z + s \hat{r}_y \\
t \hat{r}_x \hat{r}_y + s \hat{r}_z & t \hat{r}_y^2 + c & t \hat{r}_y \hat{r}_z - s \hat{r}_x \\
t \hat{r}_x \hat{r}_z - s \hat{r}_y & t \hat{r}_y \hat{r}_z + s \hat{r}_x & t \hat{r}_z^2 + c
\end{matrix}\right]
\]
with \(c = \cos\group{\alpha}\), \(s = \sin\group{\alpha}\), and \(t = 1 - \cos\group{\alpha}\).
Proof
An axis angle \(\left(\hat{r},\alpha\right)\) represents a rotation by
an angle \(\alpha\) around an axis \(\hat{r}\). Furthermore, we have an
explicit matrix representation for such transformations. Substituting the \(\alpha\) and \(\hat{r}\) into that matrix gives
\[
R =
\left[\begin{matrix}
t \hat{r}_x^2 + c & t \hat{r}_x \hat{r}_y - s \hat{r}_z & t \hat{r}_x \hat{r}_z + s \hat{r}_y \\
t \hat{r}_x \hat{r}_y + s \hat{r}_z & t \hat{r}_y^2 + c & t \hat{r}_y \hat{r}_z - s \hat{r}_x \\
t \hat{r}_x \hat{r}_z - s \hat{r}_y & t \hat{r}_y \hat{r}_z + s \hat{r}_x & t \hat{r}_z^2 + c
\end{matrix}\right]
\]
with \(c = \cos\group{\alpha}\), \(s = \sin\group{\alpha}\), and \(t = 1 - \cos\group{\alpha}\).