Solution (source code)

= Solution

Since $AA^T=I$ and $\det A=1$, $A$ is an <orthogonal matrix> in the <special orthogonal group>. It also satisfies $A^TA=I$ and thus preserves the <dot product>. Normalize the fixed <eigenvector> to $e_3=v/\|v\|$. For $u\cdot e_3=0$,
$$
(Au)\cdot e_3=(Au)\cdot(Ae_3)=u\cdot e_3=0,
$$
so the <orthogonal complement> of the fixed axis is invariant. Choose an oriented <orthonormal basis> $e_1,e_2,e_3$. In this basis the <matrix> has form $\operatorname{diag}(B,1)$, where $B$ is a real $2\times2$ orthogonal matrix of determinant one.

Write the first column of $B$ as $(\cos\theta,\sin\theta)^T$. Its unit second column must be perpendicular to the first; positivity of the determinant selects $(-\sin\theta,\cos\theta)^T$. Thus $B=R(\theta)$, and $A$ fixes the axis through $v$ while rotating its perpendicular plane by $\theta$. Since <trace> is invariant under change of basis,
$$
\operatorname{tr}A=1+2\cos\theta,\qquad \boxed{\cos\theta=\frac{\operatorname{tr}A-1}{2}.}
$$
This proves that $A$ is the required axial <rotation>. The trace determines the unsigned angle; the action in the oriented perpendicular plane determines its sign. The identity case has angle zero and any axis.