Solution (source code)

= Solution

The imaginary <quaternions> form Euclidean $\mathbb R^3$. Conjugation by a <unit quaternion> acts by
$$
v\longmapsto qvq^{-1}.
$$
It preserves the imaginary subspace and its <norm>, and continuity from $q=1$ gives <determinant> $+1$. The kernel consists of <quaternions> commuting with all imaginary <quaternions>, hence is $\{\pm1\}$.

For a unit imaginary <quaternion> $n$, take $q=\cos(\theta/2)+n\sin(\theta/2)$. If $v$ is perpendicular to $n$, <quaternion> multiplication gives
$$
qvq^{-1}=v\cos\theta+(n\times v)\sin\theta,
$$
while the component parallel to $n$ is unchanged. This produces the rotation through angle $\theta$ about axis $n$, and every element of $SO(3)$ has such an axis-angle description. The map is surjective, yielding
$$
\boxed{SO(3)\cong SU(2)/\{\pm I\}.}
$$
The half-angle also explains why $q$ and $-q$ give the same rotation.