Quaternions are not difficult because the math is hard. Quaternions are difficult because the spatial intuition for a 4D number system rotating 3D objects is not something the human visual system evolved to process. We learn to work with them by accepting the algebra before the geometry arrives.
But when the geometry does arrive, it changes how you see rotation — and, unexpectedly, how you see attention.
What a quaternion actually is
A quaternion q = w + xi + yj + zk is a 4D complex number. The i, j, k components obey i² = j² = k² = ijk = -1. For rotation, we use unit quaternions (|q| = 1): q = cos(θ/2) + sin(θ/2)(xi + yj + zk), where (x,y,z) is a 3D axis and θ is the rotation angle around it.
The half-angle is the first thing that surprises people. A 90° rotation is represented by a quaternion with angle 45°. The full rotation requires multiplying by the quaternion on one side and its conjugate on the other: v' = qvq⁻¹. The conjugation is what makes it a double cover of SO(3) — a 720° rotation in quaternion space maps back to a 360° rotation of the object.
This double-cover property is usually presented as a mathematical curiosity. I think it's the key to understanding something else entirely.
The double cover and attention
Attention — the cognitive kind — has a similar double-cover structure.
When you attend to something, two things happen simultaneously. Your focus narrows onto the object of attention (the axis of rotation), and your awareness rotates around that axis to view it from multiple perspectives. The narrowing is the axis. The rotation is the angle.
A quaternion describes this perfectly. The axis (x,y,z) is what you're attending to. The angle θ is how much your perspective has rotated around it. The half-angle — the fact that the quaternion uses θ/2 — captures something subtle: attention has a subject and an object, and both rotate. When I turn my attention toward something, I am also turning away from something else. The total displacement is distributed across both directions. The quaternion encodes this as a single operation.
// Attention as quaternion rotation
// axis: direction of focus (normalized 3D vector)
// angle: depth of attention (0 = peripheral, π = fully absorbed)
vec4 attentionQuat(vec3 focus, float depth) {
float halfAngle = depth * 0.5;
return vec4(
sin(halfAngle) * focus, // vector part (where)
cos(halfAngle) // scalar part (how much)
);
}
// The half-angle encodes that attending is always
// both a turning-toward and a turning-away.
From metaphor to structure
This might sound like a metaphor. But metaphors are load-bearing in mathematics too. The reason quaternions work for 3D rotation is not that someone designed them for that purpose — Hamilton was trying to extend complex numbers to 3D, and the rotation interpretation came later. The structure was discovered, not invented.
Attention might work the same way. If you can model the direction and depth of attention as a 4D rotation, then the composition of attention — shifting from one focus to another — is quaternion multiplication. The smooth interpolation between attentional states is slerp. The fact that attention cannot be decomposed into independent x-y-z rotations (it gimbals) is exactly why Euler angles fail for 3D rotation and why we need quaternions.
Gimbal lock of the mind
This is the most provocative part of the analogy. Euler angles suffer from gimbal lock: at certain orientations, two rotation axes align and you lose a degree of freedom. The object can no longer rotate freely in all directions from that configuration.
Attention has its own gimbal locks. A state of extreme focus on a single thing — what Csikszentmihalyi called "flow" — is a gimbal lock of attention. You cannot shift smoothly to a new focus because two of your attentional axes have collapsed into one. You need to reset the orientation entirely — step back, disengage, then re-approach. Quaternion rotation never gimbals. Slerp always produces a smooth path between any two orientations.
What would it mean to train attention to operate in quaternion space instead of Euler space? I don't know yet. But it's where the geometry points.
The thread I'm pulling
I came to this through game mathematics. I was learning quaternions to avoid gimbal lock in camera control. But once I understood the double cover — the 720° identity — I couldn't stop thinking about what else has that structure.
Here's a partial list, speculative:
- Perception and motor action: the sensorimotor loop has a double-cover structure. Perceiving an object and acting on it are conjugate operations in the same space.
- Sleep and wakefulness: the transition is not linear. It's a rotation in a space where the half-angle might correspond to the depth of slow-wave activity.
- Learning: understanding something new is a rotation of your existing knowledge structure, not an addition to it. The axis is the concept. The angle is how much it reorganizes everything else. The half-angle is the fact that learning always involves unlearning.
Each of these is a hypothesis. Some will be wrong. The point is that quaternions are not just a tool for rotating 3D objects. They are a language for describing orientation change in any space where the change has an axis and a depth. That includes quite a lot.
Next
I'm building a quaternion visualizer — an interactive tool that shows what happens when you compose rotations, interpolate between orientations, and push the system toward gimbal lock. It's meant as an educational tool for game developers. But I'm also using it to explore the attention hypothesis. If attention really is a 4D rotation, then visual inspection might reveal patterns the algebra alone would miss.
Watch this space.