Derivation (rotation matrix)

We find $\vec x'$ by $\vec{OA'} = \vec{OB} + \vec{BC} + \vec{CA'}$.

$\vec{OB}$ is found by projecting $\vec x$ onto $\hat n$, $$ \vec{OB} = (\vec x\cdot\hat n)\hat n. $$ $\vec{BC}$ has direction along $\vec{BA}$ and magnitude $|\vec{BA'}|\cos\theta = |\vec{BA}|\cos\theta$, so $$\begin{align*} \vec{BC} &= \vec{BA}\cos\theta \\ &= (\vec{OA} - \vec{OB})\cos\theta \\ &= (\vec x - (\vec x\cdot\hat n)\hat n)\cos\theta. \end{align*}$$

For $\vec{CA'}$, its magnitude is $$ |\vec{CA'}| = |\vec{BA'}|\sin\theta = |\vec{BA}|\sin\theta = |\hat n\times\vec x|\sin\theta, $$ and its direction is perpendicular to both $\vec x$ and $\hat n$ so it is along $\hat n\times\vec x$. Therefore $$ \vec{CA'} = (\hat n\times\vec x)\sin\theta. $$

Combining, $$\begin{align*} \vec x' &= (\vec x\cdot\hat n)\hat n + (\vec x-(\vec x\cdot\hat n)\hat n)\cos\theta + (\hat n\times\vec x)\sin\theta \\ &= \vec x\cos\theta + (1-\cos\theta)(\hat n\cdot\vec x)\hat n + (\hat n\times\vec x)\sin\theta \\ x'_i &= x_i\cos\theta + (1-\cos\theta)n_jx_jn_i - \epsilon_{ijk}x_jn_k\sin\theta \\ &= (\delta_{ij}\cos\theta + (1-\cos\theta)n_in_j - \epsilon_{ijk}n_k\sin\theta)x_j. \end{align*}$$ Therefore letting $x_i' = R_{ij} x_j$, we have the matrix $$ R_{ij} = \delta_{ij}\cos\theta + (1-\cos\theta)n_in_j - \epsilon_{ijk}n_k\sin\theta. $$