Scholarly Expositions • Substack • Bigganblog

Research Blog, Essays & Science Writing

Technical tutorials on quantum algorithms and open quantum systems, philosophical essays on epistemology and logic on Substack, and popular mathematics & physics articles in Bengali on Bigganblog.

← Back to All Articles

Electron Spin, Gimbal Lock & Quaternions: Why Spinors Need 720° to Return Home

Electron Spin, Gimbal Lock & Quaternions: Why Spinors Need 720° to Return Home

3D spatial rotations are elements of the special orthogonal group $SO(3)$. In classical mechanics, robotics, and aerospace engineering, describing rotations with three Euler angles can produce gimbal lock: at certain orientations, two rotation axes align and the angle parametrization becomes singular. Unit quaternions provide a smooth alternative using four real components constrained to have unit norm. Their representation is two-to-one: $q$ and $-q$ describe the same spatial rotation.

Remarkably, the group of unit quaternions is isomorphic to the special unitary group $SU(2)$:

$$U(1, \mathbb{H}) \simeq SU(2)$$

In quantum mechanics, pure single-qubit states correspond to unit vectors on the surface of the Bloch sphere. Unitary transformations act smoothly on these vectors. The relationship between $SU(2)$ and $SO(3)$ also explains the familiar $720^\circ$ puzzle discussed by Stephen Hawking in A Brief History of Time: a $360^\circ$ rotation changes a spin-$1/2$ state vector from $|\psi\rangle$ to $-|\psi\rangle$, while a $720^\circ$ rotation restores that vector exactly.

There is an essential distinction here. The vectors $|\psi\rangle$ and $-|\psi\rangle$ already describe the same isolated physical quantum state. Their density matrices and measurement probabilities are identical. The sign becomes observable as a relative phase when only one branch of a coherent superposition is rotated. This distinction between a vector and the physical state it represents will guide the discussion.

The connection is easier to understand in four steps: see where Euler angles fail, replace them with unit quaternions, connect those quaternions to quantum rotation matrices, and track what happens to a spinor during one and two full turns.


We use $I_d$ for the $d\times d$ identity matrix, $T$ for transpose, and $\dagger$ for conjugate transpose. A ket $|\psi\rangle$ is a column vector and its bra is the row $\langle\psi|=|\psi\rangle^\dagger$.

1. 3D Rotations in $SO(3)$ and the Geometry of Gimbal Lock

A proper 3D rotation is a $3 \times 3$ real orthogonal matrix with determinant $+1$:

$$SO(3) := \left\{ R \in \mathbb{R}^{3 \times 3} : R^T R = I_3, \quad \det R = +1 \right\}$$

Because a $3 \times 3$ matrix has $9$ entries and the orthogonality condition $R^T R = I_3$ imposes $6$ independent constraints, $SO(3)$ is a $3$-dimensional manifold. A familiar parametrization uses roll $\phi$ about $x$, pitch $\theta$ about $y$, and yaw $\psi$ about $z$. This is the Tait–Bryan convention, often included under the broader term Euler angles. For active rotations of column vectors, the rightmost matrix acts first:

$$R(\psi, \theta, \phi) = R_z(\psi)\,R_y(\theta)\,R_x(\phi)$$

where the elementary rotation matrices are:

$$R_z(\psi) = \begin{pmatrix} \cos\psi & -\sin\psi & 0 \\ \sin\psi & \cos\psi & 0 \\ 0 & 0 & 1 \end{pmatrix}, \quad R_y(\theta) = \begin{pmatrix} \cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\ -\sin\theta & 0 & \cos\theta \end{pmatrix}, \quad R_x(\phi) = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos\phi & -\sin\phi \\ 0 & \sin\phi & \cos\phi \end{pmatrix}$$

Why Gimbal Lock Happens at $\theta = \pm 90^\circ$

Watch what happens when the middle pitch angle reaches $\theta = +\frac{\pi}{2}$ ($90^\circ$), so $\cos\theta = 0$ and $\sin\theta = 1$:

$$R\!\left(\psi, \frac{\pi}{2}, \phi\right) = \begin{pmatrix} \cos\psi & -\sin\psi & 0 \\ \sin\psi & \cos\psi & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ -1 & 0 & 0 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos\phi & -\sin\phi \\ 0 & \sin\phi & \cos\phi \end{pmatrix}$$

Multiplying the three matrices out and applying the angle-subtraction identities $\sin(\psi - \phi) = \sin\psi\cos\phi - \cos\psi\sin\phi$ and $\cos(\psi - \phi) = \cos\psi\cos\phi + \sin\psi\sin\phi$ yields:

$$R\!\left(\psi, \frac{\pi}{2}, \phi\right) = \begin{pmatrix} 0 & -\sin(\psi - \phi) & \cos(\psi - \phi) \\ 0 & \cos(\psi - \phi) & \sin(\psi - \phi) \\ -1 & 0 & 0 \end{pmatrix}$$

Look closely at the result: the angles $\psi$ and $\phi$ appear only through their difference $\psi-\phi$. At this orientation, changing yaw and roll no longer gives two independent infinitesimal changes of orientation. Indeed, $\partial R/\partial\psi=-\partial R/\partial\phi$ at $\theta=\pi/2$. The Euler-angle map loses rank, which is the coordinate singularity called gimbal lock.

The space $SO(3)$ still has three dimensions. It is the chosen coordinates that fail. A physical three-gimbal mechanism can also lose an independently controllable rotation axis when two gimbals align; changing the software representation does not change the mechanism. Unit quaternions address the coordinate problem by using constrained, redundant coordinates.


2. Unit Quaternions and Their Connection to $SU(2)$

A standard alternative uses Hamilton's quaternions $\mathbb H$. They have four real components. The bold quaternion units below are distinct from the ordinary complex unit $i$:

$$\mathbb{H} := \left\{ q = a\mathbf{1} + b\mathbf{i} + c\mathbf{j} + d\mathbf{k} \;\middle|\; a, b, c, d \in \mathbb{R} \right\}$$

governed by the fundamental multiplication rules:

$$\mathbf{i}^2 = \mathbf{j}^2 = \mathbf{k}^2 = \mathbf{i}\mathbf{j}\mathbf{k} = -\mathbf{1}, \qquad \mathbf{i}\mathbf{j} = \mathbf{k} = -\mathbf{j}\mathbf{i}, \quad \mathbf{j}\mathbf{k} = \mathbf{i} = -\mathbf{k}\mathbf{j}, \quad \mathbf{k}\mathbf{i} = \mathbf{j} = -\mathbf{i}\mathbf{k}$$

The quaternion conjugate is $\bar q=a\mathbf{1}-b\mathbf{i}-c\mathbf{j}-d\mathbf{k}$. The unit quaternions, satisfying $|q|^2=q\bar q=a^2+b^2+c^2+d^2=1$, form the multiplicative group $U(1,\mathbb{H})$, more commonly denoted $\operatorname{Sp}(1)$. As a manifold, this group is the 3-sphere $S^3\subset\mathbb{R}^4$. The unit-norm constraint leaves three independent degrees of freedom.

How a quaternion rotates a spatial vector

Represent $\vec v=(v_x,v_y,v_z)$ by the imaginary quaternion $\mathbf v=v_x\mathbf i+v_y\mathbf j+v_z\mathbf k$. A unit quaternion acts through conjugation,

$$\mathbf v'=q\mathbf vq^{-1},\qquad q^{-1}=\bar q.$$

For a unit axis $\hat n$, choose

$$q_{\hat n}(\theta)=\cos(\theta/2)+(n_x\mathbf i+n_y\mathbf j+n_z\mathbf k)\sin(\theta/2).$$

Expanding the products gives the ordinary rotation formula

$$\vec v'=\vec v\cos\theta+(\hat n\times\vec v)\sin\theta +\hat n(\hat n\cdot\vec v)(1-\cos\theta).$$

The component parallel to the axis stays fixed, while the perpendicular component rotates by $\theta$. The half-angle in $q$ produces a full angle in the conjugation. Replacing $q$ by $-q$ cancels both minus signs, so the same spatial rotation has two quaternion representatives.

Why the Same Algebra Appears in $SU(2)$

Now compare this group with the special unitary group of degree 2:

$$SU(2) := \left\{ U \in \mathbb{C}^{2 \times 2} : U^\dagger U = I_2, \quad \det U = 1 \right\}$$

Writing out the conditions $U^\dagger U = I_2$ and $\det U = 1$ for a $2 \times 2$ complex matrix shows that every matrix $U \in SU(2)$ has the exact form:

$$U = \begin{pmatrix} \alpha & -\bar{\beta} \\ \beta & \bar{\alpha} \end{pmatrix}, \qquad \alpha, \beta \in \mathbb{C}, \quad |\alpha|^2 + |\beta|^2 = 1$$

If we write the two complex numbers in terms of four real parameters as $\alpha = a - id$ and $\beta = c - ib$ (with $a, b, c, d \in \mathbb{R}$), the condition $|\alpha|^2 + |\beta|^2 = 1$ becomes $a^2 + b^2 + c^2 + d^2 = 1$, and $U$ decomposes as a real linear combination of the identity $I_2$ and the three Pauli matrices $\sigma_x, \sigma_y, \sigma_z$:

$$U = \begin{pmatrix} a - id & -c - ib \\ c - ib & a + id \end{pmatrix} = a I_2 + b(-i\sigma_x) + c(-i\sigma_y) + d(-i\sigma_z)$$

A matrix is anti-Hermitian when its conjugate transpose equals its negative. Now inspect the three anti-Hermitian matrices $\mathbf{I} := -i\sigma_x$, $\mathbf{J} := -i\sigma_y$, and $\mathbf{K} := -i\sigma_z$:

$$\mathbf{I} = \begin{pmatrix} 0 & -i \\ -i & 0 \end{pmatrix}, \qquad \mathbf{J} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}, \qquad \mathbf{K} = \begin{pmatrix} -i & 0 \\ 0 & i \end{pmatrix}$$

The Pauli matrices square to $I_2$ and satisfy $\sigma_x\sigma_y=i\sigma_z$, $\sigma_y\sigma_z=i\sigma_x$, and $\sigma_z\sigma_x=i\sigma_y$. Reversing a product's order changes its sign. These relations give:

$$\mathbf{I}^2 = \mathbf{J}^2 = \mathbf{K}^2 = \mathbf{I}\mathbf{J}\mathbf{K} = -I_2$$

They obey Hamilton's exact quaternion multiplication table! Therefore, the map $\Phi: U(1, \mathbb{H}) \to SU(2)$ defined by

$$\Phi(a\mathbf{1} + b\mathbf{i} + c\mathbf{j} + d\mathbf{k}) = a I_2 - i(b\sigma_x + c\sigma_y + d\sigma_z)$$

is a bijective group homomorphism (an isomorphism of Lie groups):

$$\operatorname{Sp}(1)=U(1,\mathbb{H})\simeq SU(2)$$

The underlying manifold of either group is $S^3$. This statement concerns the group of transformations; the space of physical pure qubit states will instead be $S^2$.

Unit quaternions Sp(1) = U(1, H) isomorphic to SU(2) bypass Euler-angle gimbal lock coordinates via the double cover of SO(3).

Unit quaternions $\operatorname{Sp}(1) = U(1, \mathbb{H}) \cong SU(2)$ avoid the coordinate singularity of three Euler angles at $\theta = \pm 90^\circ$ by parametrizing rotations smoothly on $S^3$ as a two-to-one cover of $SO(3)$. Open this meme in the collection.


3. The Bloch Sphere and Smooth Unitary Rotations

A normalized pure state of a single qubit is represented by a two-component complex spinor, using basis vectors $|0\rangle=(1,0)^T$ and $|1\rangle=(0,1)^T$. After choosing an overall phase, it can be written with polar angle $\vartheta\in[0,\pi]$ and azimuthal angle $\varphi\in[0,2\pi)$:

$$|\psi\rangle=\cos\!\left(\frac{\vartheta}{2}\right)|0\rangle+e^{i\varphi}\sin\!\left(\frac{\vartheta}{2}\right)|1\rangle$$

A ray is the equivalence class of nonzero state vectors differing by a nonzero complex factor. For normalized vectors, only an overall phase remains. Thus $|\psi\rangle$ and $e^{i\chi}|\psi\rangle$ represent the same physical pure state. Its density matrix $\rho=|\psi\rangle\langle\psi|$ corresponds to the unit Bloch vector $\vec r=(\sin\vartheta\cos\varphi,\sin\vartheta\sin\varphi,\cos\vartheta)\in S^2$:

$$\rho = |\psi\rangle\langle\psi| = \frac{1}{2}\left(I_2 + \vec{r}\cdot\vec{\sigma}\right)$$

Pure states lie on the sphere's surface, where $|\vec r|=1$. Mixed states lie inside the Bloch ball, where $|\vec r|<1$. A general single-qubit unitary belongs to $U(2)$ and can be written as $V=e^{i\chi}U$ with $U\in SU(2)$. The overall phase cancels from $V\rho V^\dagger$, so $SU(2)$ suffices to describe its Bloch-sphere action.

An electron's spin-$1/2$ angular-momentum operators are $S_j=\hbar\sigma_j/2$. Here $\hbar$ is the reduced Planck constant. Angular momentum generates rotations, so a rotation by $\theta$ about the unit axis $\hat n$ acts through $U=\exp(-i\theta\,\hat n\cdot\vec S/\hbar)$. Substitution produces the half-angle:

$$U_{\hat{n}}(\theta) = \exp\!\left(-i\frac{\theta}{2}\,\hat{n}\cdot\vec{\sigma}\right) = \cos\!\left(\frac{\theta}{2}\right)I_2 - i\sin\!\left(\frac{\theta}{2}\right)(\hat{n}\cdot\vec{\sigma})$$

Because $(\hat n\cdot\vec\sigma)^2=I_2$, even powers of the exponential sum to the cosine and odd powers to the sine. The spin-$1/2$ character of the electron is physical input; the quaternion representation makes its rotational structure explicit.

The density matrix transforms by conjugation, $\rho\mapsto U\rho U^\dagger$:

$$U\left(\vec{r}\cdot\vec{\sigma}\right)U^\dagger = (R_U\vec{r})\cdot\vec{\sigma}$$

The expression defining $\Phi$ extends it to a real-linear algebra homomorphism on all of $\mathbb H$. To see the quaternion connection precisely, identify $\vec r$ with the imaginary quaternion $\mathbf r=r_x\mathbf i+r_y\mathbf j+r_z\mathbf k$. Then $\Phi(\mathbf r)=-i\,\vec r\cdot\vec\sigma$. If $U=\Phi(q)$, quaternion conjugation becomes

$$\Phi(q\mathbf r q^{-1})=U(-i\,\vec r\cdot\vec\sigma)U^\dagger.$$

The factor $-i$ cancels when comparing the two rotation laws. Thus the Bloch-vector transformation is exactly the quaternion rotation $\mathbf r\mapsto q\mathbf r q^{-1}$.

Both rotation matrices and unit quaternions describe rotations smoothly without using Euler-angle coordinates. Quantum gates expressed as matrices share this advantage. An Euler-angle parametrization of an $SU(2)$ gate can still have coordinate singularities, and the Bloch sphere's azimuthal coordinate is undefined at its poles. The transformations and physical states remain well defined there.


4. Hawking's $720^\circ$ Puzzle: Why a Spinor Needs Two Full Turns

Hawking's discussion of spin-$1/2$ particles motivates a precise question: after a full spatial rotation, has the spinor returned as a vector, or has only the physical state returned? For an electron's spin, these answers differ.

With the $SU(2)$ rotation formula $U_{\hat{n}}(\theta) = \cos(\theta/2)I_2 - i\sin(\theta/2)(\hat{n}\cdot\vec{\sigma})$ in hand, we can see why in one line of algebra: notice the half-angle $\theta/2$:

One Full Spatial Turn: $\theta=360^\circ=2\pi$

$$U_{\hat n}(2\pi)=\cos(\pi)I_2-i\sin(\pi)(\hat n\cdot\vec\sigma)=-I_2 \quad\Longrightarrow\quad |\psi\rangle\longmapsto-|\psi\rangle.$$

The state vector changes sign, but its density matrix is already unchanged:

$$(-|\psi\rangle)(-\langle\psi|)=|\psi\rangle\langle\psi|=\rho.$$

Two Full Spatial Turns: $\theta=720^\circ=4\pi$

$$U_{\hat n}(4\pi)=\cos(2\pi)I_2-i\sin(2\pi)(\hat n\cdot\vec\sigma)=I_2 \quad\Longrightarrow\quad |\psi\rangle\longmapsto|\psi\rangle.$$

The spinor vector now returns exactly. The $720^\circ$ statement concerns this vector and the lifted rotation operator, while the isolated physical state already returns after $360^\circ$.

For an eigenstate of $\hat n\cdot\vec\sigma$ with eigenvalue $\pm1$, the rotation contributes only the phase $e^{\mp i\theta/2}$, so its physical ray stays fixed throughout the motion. The two-turn period belongs to this spin-rotation operator; an evolution that returns to the same physical ray can multiply the vector by a phase factor other than $+1$ or $-1$.

Why Both $+U$ and $-U$ Give the Same 3D Rotation (The Double Cover $SU(2) \xrightarrow{2:1} SO(3)$)

Why don't classical 3D vectors notice this minus sign after $360^\circ$? Look at how the 3D Bloch vector $\vec{r}$ transforms under conjugation $\rho' = U\rho U^\dagger$: because $U$ appears twice (once as $U$ and once as $U^\dagger$), replacing $U \to -U$ cancels the minus signs:

$$(-U)\,\rho\,(-U)^\dagger = (-1)^2\,U\rho U^\dagger = U\rho U^\dagger$$

Thus two distinct matrices $+U$ and $-U$ in $SU(2)$ map to the exact same 3D spatial rotation $R \in SO(3)$! In group-theoretic terms, the map $\pi: SU(2) \to SO(3)$ is a $2$-to-$1$ surjective homomorphism (universal double cover) with kernel $\ker(\pi) = \{+I_2, -I_2\} \cong \mathbb{Z}_2$:

$$SO(3) \cong SU(2) / \{\pm I_2\} \cong U(1, \mathbb{H}) / \{\pm \mathbf{1}\}$$

Omni-Man labeled SU(2) watches two fighter jets labeled SO(3) and says Look what they need to mimic a fraction of our power.

Because $SO(3) \cong SU(2)/\{\pm I_2\}$ quotients out the central sign $\{\pm I_2\}$, ordinary 3D rotation matrices forget the spinor sign flip acquired after $360^\circ$ that $SU(2)$ tracks faithfully. Open this meme in the collection.

A global sign cannot be measured on an isolated spin. It can, however, become a relative phase when the rotation is applied to one path of an interferometer. Prepare an electron or neutron in a coherent superposition of orthogonal path states $|A\rangle$ and $|B\rangle$, with the same spin state in each path. Applying a $2\pi$ spin rotation only in path $B$ gives:

$$\frac{|A\rangle+|B\rangle}{\sqrt2}\otimes|\psi\rangle \;\xrightarrow{\,2\pi\text{ spin rotation on }B\,}\; \frac{|A\rangle-|B\rangle}{\sqrt2}\otimes|\psi\rangle.$$

The paths now differ by a relative phase of $\pi$. Start with an ideal balanced interferometer, with additional relative path phases compensated to zero and held fixed. The recombiner measures the path basis $(|A\rangle\pm|B\rangle)/\sqrt2$. Before the rotation the plus output is bright; after a $2\pi$ rotation in path $B$, the minus output is bright. The spin density matrix alone remains unchanged, while the joint path-and-spin state changes.

For a general angle $\theta$, the plus-port spin amplitude is $(I_2+U_{\hat n}(\theta))|\psi\rangle/2$. Its squared norm is

$$p_+=\frac{1+\operatorname{Re}\langle\psi|U_{\hat n}(\theta)|\psi\rangle}{2} =\cos^2(\theta/4),\qquad p_-=\sin^2(\theta/4).$$

Thus the port probabilities return after $4\pi$. Applying the same $2\pi$ spin rotation in both paths would instead produce a global minus sign and leave the interference unchanged.

Dirac's belt trick illustrates the topology. In the usual setup, a single full twist cannot be continuously removed while keeping both end orientations fixed and without cutting or passing the belt through itself. Two full twists can be removed by moving the belt around the held end. The belt records a path through the space of orientations: one full turn represents a noncontractible loop, whereas two full turns represent a contractible one:

$$\pi_1(SO(3))\cong\mathbb Z_2,\qquad \pi_1(SU(2))=\pi_1(S^3)=0.$$

Here $\pi_1$ denotes the fundamental group, which classifies based loops up to continuous deformation. Lifting the $2\pi$ loop to $SU(2)$ takes $I_2$ to $-I_2$; lifting the $4\pi$ loop returns to $I_2$.