Quaternions and the Spacetime Algebra
The geometric algebra page showed that real quaternions $ℍ$ arise as the even subalgebra of the geometric algebra over $ℝ³$. This page extends that picture to four-dimensional Minkowski spacetime $ℝ^{3,1}$, where we simply include a fourth basis vector $𝐭$ which squares to $-1$. The geometric algebra over this space is a simple extension of the three-dimensional case, producing the "Spacetime Algebra" (STA).
By sheer coincidence the even subalgebra happens to be isomorphic to the complexified quaternions $ℍ(ℂ)$ — sometimes also called "biquaternions". The isomorphism also happens to be very simple: the unit imaginary scalar in the complexified quaternions corresponds to the pseudoscalar $𝐈 = 𝐭𝐱𝐲𝐳$ in the spacetime algebra, and the complex components of the bivectors represent timelike bivectors, which correspond to $𝐈$ times spatial bivectors. That is, we just think of the unit imaginary $i$ as being equivalent to the pseudoscalar $𝐈$.
The basic rotation machinery (reflections, the Cartan–Dieudonné theorem, the sandwich product) carries over unchanged from the three-dimensional case. And just as rotations are represented by unit quaternions in the three-dimensional case, general Lorentz transformations are represented by unit complexified quaternions in this more general algebra.
One crucial new feature is the spinor norm: for complex quaternions, the GA reverse gives $𝐐𝐐̃ = w² + x² + y² + z²$, which is a "complex" scalar, not the Euclidean norm $|w|² + |x|² + |y|² + |z|²$ which will always be real. The surprising point is that the normalization condition $𝐐𝐐̃ = 1$ is now two real conditions, because this says that the "imaginary" part is zero. This reduces the eight real degrees of freedom in a complex quaternion down to six, which is the correct number for a Lorentz transformation in four dimensions.
The spacetime algebra
The spacetime algebra (STA) is the geometric algebra over four-dimensional Minkowski space, and we use the metric signature ${-}{+}{+}{+}$. The basis vectors $𝐭, 𝐱, 𝐲, 𝐳$ satisfy
\[𝐭^2 = -1, \qquad 𝐱^2 = 𝐲^2 = 𝐳^2 = +1,\]
and all other products anticommute. The full algebra has dimension $2^4 = 16$, with basis elements grouped by grade:
\[\begin{array}{lll} \text{grade 0:} & 1 \text{ element} & \boldsymbol{1} \\[4pt] \text{grade 1:} & 4 \text{ elements} & 𝐭,\; 𝐱,\; 𝐲,\; 𝐳 \\[4pt] \text{grade 2:} & 6 \text{ elements} & 𝐭𝐱,\; 𝐭𝐲,\; 𝐭𝐳,\; 𝐱𝐲,\; 𝐱𝐳,\; 𝐲𝐳 \\[4pt] \text{grade 3:} & 4 \text{ elements} & 𝐭𝐱𝐲,\; 𝐭𝐱𝐳,\; 𝐭𝐲𝐳,\; 𝐱𝐲𝐳 \\[4pt] \text{grade 4:} & 1 \text{ element} & 𝐈 = 𝐭𝐱𝐲𝐳 \end{array}\]
The grade-2 elements split into two qualitatively different groups. The three spatial bivectors $𝐱𝐲$, $𝐱𝐳$, $𝐲𝐳$ involve only spatial directions and square to $-1$, exactly as in $ℝ³$. The three boost bivectors $𝐭𝐱$, $𝐭𝐲$, $𝐭𝐳$ each involve the timelike direction, and they square to $+1$ because of the sign in $𝐭^2 = -1$:
\[(𝐭𝐱)^2 = 𝐭𝐱𝐭𝐱 = -𝐭𝐭𝐱𝐱 = -(𝐭^2)(𝐱^2) = -(-1)(+1) = +1.\]
This sign difference is what distinguishes boosts from rotations.
The pseudoscalar in four dimensions
The pseudoscalar $𝐈 = 𝐭𝐱𝐲𝐳$ has several properties that differ markedly from its three-dimensional counterpart:
It still squares to $-1$. Though the inclusion of an extra basis factor gives the permutation a different sign, the fact that $𝐭² = -1$ means that the overall result is unchanged.
Its reverse is itself. The reverse of a grade-$r$ blade picks up a sign $(-1)^{r(r-1)/2}$. For $r = 4$, this is $(-1)^6 = +1$, so
\[\widetilde{𝐈} = +𝐈.\]
Contrast the (grade 3) three-dimensional pseudoscalar $𝐈_{3}$, for which $\widetilde{𝐈}_{3} = -𝐈_{3}$.
It does not commute with everything. Whereas $𝐈_{3}$ commutes with everything in its three-dimensional algebra, $𝐈$ does not commute with everything in the four-dimensional algebra. In particular, $𝐈$ anti-commutes with vectors and trivectors. However, it does commute with every element of the even subalgebra (grades 0, 2, and 4), which is an important property.
The even subalgebra: Complexified quaternions
Products of an even number of vectors — grades 0, 2, and 4 — form a closed subalgebra, the even subalgebra, spanned by $\{1, 𝐱𝐲, 𝐲𝐳, 𝐳𝐱, 𝐭𝐱, 𝐭𝐲, 𝐭𝐳, 𝐈\}$. This algebra happens to be precisely isomorphic to the one spanned by $\{1, 𝐱𝐲, 𝐲𝐳, 𝐳𝐱, i𝐱𝐲, i𝐲𝐳, i𝐳𝐱, i\}$, where $i$ is the unit imaginary — which is of course precisely the algebra of complexified quaternions $ℍ(ℂ)$.
Pseudoscalar → imaginary unit. Since $𝐈^2 = -1$ and $𝐈$ commutes with all scalars, bivectors, and the pseudoscalar, it plays the role of the imaginary unit $i = \sqrt{-1}$ on the even subalgebra. Thus, we have this basic identification:
\[i \;\leftrightarrow\; 𝐈 = 𝐭𝐱𝐲𝐳.\]
We will abuse notation and terminology to write complex numbers interchangeably as both $a + i b$ and $a + 𝐈 b$, and speak of linear combinations of $\{1,i\}$ and $\{1,𝐈\}$ as complex numbers.
Spatial bivectors → quaternion units. The three spatial bivectors that generated right-handed rotations in $ℝ³$ are unchanged:
\[𝐢 = 𝐳𝐲, \qquad 𝐣 = 𝐱𝐳, \qquad 𝐤 = 𝐲𝐱.\]
They still square to $-1$ and satisfy $𝐢𝐣𝐤 = -\boldsymbol{1}$.
Boost bivectors → $i \times$ quaternion units. The three boost bivectors are products of $𝐈$ with the spatial bivectors. For example:
\[𝐈\,𝐢 = (𝐭𝐱𝐲𝐳)(𝐳𝐲) = 𝐭𝐱𝐲(𝐳𝐳)𝐲 = 𝐭𝐱𝐲𝐲 = 𝐭𝐱(𝐲^2) = 𝐭𝐱,\]
and similarly $𝐈\,𝐣 = 𝐭𝐲$ and $𝐈\,𝐤 = 𝐭𝐳$. In the complexified quaternion picture these are $i𝐢$, $i𝐣$, $i𝐤$. Consistent with $(𝐭𝐱)^2 = +1$, we have $(i𝐢)^2 = i^2 𝐢^2 = (-1)(-1) = +1$, and so on.
A general element of the even subalgebra is therefore a quaternion
\[\begin{aligned} 𝐐 &= w\,\boldsymbol{1} + x\,𝐢 + y\,𝐣 + z\,𝐤 \\ &= \Re\{w\}\,\boldsymbol{1} + \Re\{x\}\,𝐳𝐲 + \Re\{y\}\,𝐱𝐳 + \Re\{z\}\,𝐲𝐱 + \Im\{x\}\,𝐭𝐱 + \Im\{y\}\,𝐭𝐲 + \Im\{z\}\,𝐭𝐳 + \Im\{w\}\,𝐈 \end{aligned}\]
with complex coefficients $(w, x, y, z) \in \mathbb{C}$, represented by the Quaternion{Complex{T}} type in this package.
The reverse and the spinor norm
As usual in Geometric Algebra, the reverse of a multivector is computed by reversing the order of all products. Obviously, the reverse of a scalar is itself, and — as mentioned above — the reverse of the pseudoscalar is itself. The reverse applied to a bivector is just negation. Therefore, the reverse applied to a general complex quaternion is exactly the same as for a real quaternion: the scalar part is unchanged, and the vector part is negated. The complex components themselves are not conjugated:
\[\widetilde{𝐐} = w - x\,𝐢 - y\,𝐣 - z\,𝐤 = \texttt{conj(Q)},\]
exactly as for real quaternions.
Now, we have to be careful to distinguish between two different notions of "norm" for complex quaternions: the spinor norm and the Euclidean norm. The spinor norm,
\[𝐐\,\widetilde{𝐐} = w^2 + x^2 + y^2 + z^2,\]
is the one that arises from the GA reverse, and it is the physically meaningful notion of "unit" for Lorentz transformations. Notably, the result is a complex number. On the other hand, the Euclidean norm,
\[𝐐\,𝐐^\dagger = |w|^2 + |x|^2 + |y|^2 + |z|^2,\]
is always a positive real number, and does not have a direct geometric meaning in this context. The relevant condition that defines a spinor (in this case, a Lorentz rotor) is that the spinor norm equals 1:
\[𝐐\,\widetilde{𝐐} = 1 + 0i.\]
The code functions abs2(Q) and abs(Q) compute the spinor norm and its (complex) square root.
One possibly surprising consequence of this is that a pure phase $\exp(𝐈\alpha)$ is not generally a Lorentz rotor. Its spinor norm is
\[\exp(𝐈\alpha)\,\widetilde{\exp(𝐈\alpha)} = \exp(𝐈\alpha)^2 = \exp(2𝐈\alpha),\]
which is not equal to $1$ in general. Phase factors therefore do not belong to the Lorentz rotor group, even though they are unit elements under the Euclidean norm ($|\exp(i\varphi)| = 1$).
For real quaternions, $𝐐\,\widetilde{𝐐} = \sum r_i^2 = \sum |r_i|^2$, so the spinor and Euclidean norms coincide. This is why the distinction never arises on the GA page. For complex quaternions they diverge, and only the spinor norm has the correct geometric meaning for Lorentz transformations.
Rotors in the STA
A rotation rotor is an element of the even subalgebra with purely real components and spinor norm 1. It has the same form as in the three-dimensional case:
\[R = \exp\!\left(\frac{\vartheta}{2}\,\hat{B}\right) = \cos\frac{\vartheta}{2} + \sin\frac{\vartheta}{2}\,\hat{B},\]
where $\hat{B} \in \{𝐳𝐲, 𝐱𝐳, 𝐲𝐱\}$ is a unit spatial bivector. The components are real, and the spinor norm happens to equal the Euclidean norm: $R\widetilde{R} = \cos^2(\vartheta/2) + \sin^2(\vartheta/2) = 1$.
A boost in the $𝐯$-direction by rapidity $\varphi$ uses the boost bivector $𝐭𝐯$:
\[B = \exp\!\left(\frac{\varphi}{2}\,𝐭𝐯\right) = \cosh\frac{\varphi}{2} + \sinh\frac{\varphi}{2}\,𝐭𝐯.\]
The sign convention $+\varphi/2$ makes a positive rapidity correspond to a boost in the positive $𝐯$-direction.[boost] The spinor norm is
\[B\,\widetilde{B} = \cosh^2\!\frac{\varphi}{2} + \left(𝐭𝐯\sinh\frac{\varphi}{2}\right)^{\!2} = \cosh^2\!\frac{\varphi}{2} - \sinh^2\!\frac{\varphi}{2} = 1,\]
while the Euclidean norm is $\cosh^2(\varphi/2) + \sinh^2(\varphi/2) = \cosh\varphi \neq 1$ for $\varphi \neq 0$. This concretely shows why the spinor norm is the physically correct notion of "unit" for Lorentz transformations.
API reference
Quaternionic.Lorentz — Type
Lorentz{T<:Real}A proper orthochronous Lorentz transformation, an element of Spin⁺(3,1) — the double cover of the restricted Lorentz group SO⁺(3,1).
We work in the spacetime algebra $Cl(3,1)$ with metric signature ${−}{+}{+}{+}$ and basis vectors 𝐭, 𝐱, 𝐲, 𝐳 satisfying 𝐭² = −1, 𝐱² = 𝐲² = 𝐳² = +1, all mutually anticommuting. The pseudoscalar $𝐈 = 𝐭𝐱𝐲𝐳$ satisfies $𝐈² = −𝟏$.
Elements of $𝐑 ∈ \mathrm{Spin}⁺(3,1)$ live in the even subalgebra (grades 0, 2, 4) and satisfy $𝐑 𝐑̃ = 𝟏$, where $𝐑̃$ is the GA reverse. In particular, note that that product could include a term proportional to the pseudoscalar; it is zero: $𝐑 𝐑̃ = 𝟏 + 0 𝐈$. This subalgebra splits into two parts:
- Rotation subgroup: generated by the spatial bivectors
𝐲𝐳,𝐱𝐳,𝐱𝐲. - Boost sector: generated by the timelike bivectors
𝐭𝐱,𝐭𝐲,𝐭𝐳.
All elements of this algebra commute with the pseudoscalar $𝐈$, which acts as the complex unit for this subalgebra. Note that $i𝐢 = 𝐭𝐱$, $i𝐣 = 𝐭𝐲$, $i𝐤 = 𝐭𝐳$, relating spatial-rotation generators to boost generators (all with positive signs). A boost along $\hat{𝐧} = n^x\,𝐢 + n^y\,𝐣 + n^z\,𝐤$ (a unit QuatVec) with rapidity $η$ is thus
\[𝐑 = \cosh(η/2)·𝟏 + \sinh(η/2)·(nˣ 𝐭𝐱 + nʸ 𝐭𝐲 + nᶻ 𝐭𝐳)\]
The two elements $±R ∈ \mathrm{Spin}⁺(3,1)$ represent the same Lorentz transformation. The real GA components and their encoding are described in ga_components; as usual, you can get the plain (complex) coefficients with components.
Operations
Compose with *, invert with inv, obtain the identity with one. Apply to a Minkowski 4-vector v = [vᵗ, vˣ, vʸ, vᶻ] by calling Λ(v). Access the GA components via ga_components.
Constructors
Use the named constructor Boost. For a pure rotation, use Lorentz(R).
Quaternionic.Lorentz — Method
(Λ::Lorentz)(v::AbstractVector) → similar(v)Apply Λ to the Minkowski 4-vector v = [vᵗ, vˣ, vʸ, vᶻ] (signature −+++) and return the transformed vector in a fresh container of the same type with element type T.
The action is the Spin⁺(3,1) sandwich V′ = R·V·R̃ in Cl(3,1), where R̃ is the GA reverse. The eight real GA components (R¹, Rᶻʸ, …, Rᵗˣʸᶻ) are extracted via ga_components(::Lorentz), and the bilinear expansion of the grade-1 projection of R·V·R̃ is applied directly.
Quaternionic.BR — Method
BR(Λ::Lorentz{T}) → (B::Lorentz{T}, R::Rotor{T})Polar decomposition Λ = B * R: pure boost B followed by pure rotation R.
The algorithm here is the same as for RB, but with the order of multiplication by inv(R) reversed.
Quaternionic.Boost — Method
Boost(η::T, n̂::AbstractVector) → Lorentz{T}
Boost(η::T, n̂::QuatVec) → Lorentz{T}Construct the pure boost with rapidity η along the unit direction n̂.
The second argument may be either a 3-element AbstractVector [nˣ, nʸ, nᶻ] or a QuatVec (whose x, y, z components are used as the direction).
In the even subalgebra of Cl(3,1) the rotor is
\[𝐑 = \cosh(η/2)·𝟏 + \sinh(η/2)·(nˣ\,𝐭𝐱 + nʸ\,𝐭𝐲 + nᶻ\,𝐭𝐳).\]
See ga_components(::Lorentz) for the correspondence between this GA form and the quaternion storage.
Quaternionic.RB — Method
RB(Λ::Lorentz{T}) → (R::Rotor{T}, B::Lorentz{T})Polar decomposition Λ = R * B: pure rotation R followed by pure boost B.
Since Spin⁺(3,1) is a double cover of SO⁺(3,1), both (R, B) and (-R, -B) represent the same Lorentz transformation. The scalar part of the returned R has the same sign as the scalar part of Λ.
The general Lorentz transformation Λ can be expressed as the product of a pure rotation R and a pure boost B in either order. For this function, we assume Λ = R * B. The boost is, in turn, determined by a rapidity η ≥ 0 and a unit direction n̂, so that B = cosh(η/2) + im*sinh(η/2)*n̂ in the quaternionic encoding. Therefore, we have
Λ = R * B = cosh(η/2)*R + im*sinh(η/2)*(R*n̂).Since cosh(η/2) is 1 for no boost, and grows smoothly with η, we can find R very simply by normalizing the complex-real part of Λ. And since the norm of R is 1, we can find cosh(η/2) as the magnitude of the complex-real part of Λ. Then, we find sinh(η/2)*n̂ simply by multiplying the complex-imaginary part of Λ by inv(R), and reconstruct B simply by adding the result to cosh(η/2).
See also BR.
Quaternionic.Rv — Method
Rv(Λ::Lorentz{T}) → (R::Rotor{T}, v⃗::QuatVec{T})Return the pure rotation R and (vectorial) boost velocity v⃗ such that Λ = R * Boost(η, v⃗) where η = atanh(β) is the associated rapidity with β = norm(v⃗) as the boost parameter.
The boost spinor is B = cosh(η/2) + im*sinh(η/2)*v̂ in the quaternionic encoding. Note that v̂ is the unit vector in the direction of v⃗. We can immediately obtain the values of those cosh and sinh factors by taking the scalar part and the norm of the vector part. Using that information, the stable way to compute the velocity vector is to take the second term (the complex-imaginary part of B), and multiply by β / sinh(η/2). We can use half-angle formulas to show that
\[\frac{β}{\sinh(η/2)} = \frac{\tanh(η)}{\sinh(η/2)} = \frac{2 \cosh(η/2)}{\cosh^2(η/2) + \sinh^2(η/2)},\]
which is made up of those factors we easily obtain from the components of B, and does not involve any cancellation or division by small numbers.
Quaternionic.ga_components — Method
ga_components(Λ::Lorentz{T}) → SVector{8, T}Return the eight real geometric-algebra components of Λ in Cl(3,1), ordered as in the even-subalgebra expansion of a Spin⁺(3,1) rotor:
\[𝐑 = R^1 + R^𝐢\,𝐢 + R^𝐣\,𝐣 + R^𝐤\,𝐤 + R^{𝐭𝐱}\,𝐭𝐱 + R^{𝐭𝐲}\,𝐭𝐲 + R^{𝐭𝐳}\,𝐭𝐳 + R^𝐈\,𝐈\]
where $𝐈 = 𝐭𝐱𝐲𝐳$ is the pseudoscalar of $\mathrm{Cl}(3,1)$.
Storage mapping
Lorentz{T} stores a unit quaternion $𝐑 = w𝟏 + x𝐢 + y𝐣 + z𝐤$ with complex coefficients $w, x, y, z ∈ ℂ$, where the quaternionic basis elements 𝐢, 𝐣, 𝐤 correspond to spatial bivectors according to
\[\begin{gather} 𝐢 = 𝐳𝐲 = -𝐲𝐳, \\ 𝐣 = 𝐱𝐳 = -𝐳𝐱, \\ 𝐤 = 𝐲𝐱 = -𝐱𝐲, \end{gather}\]
and the complex unit $i ∈ ℂ$ maps to the pseudoscalar $𝐈 = 𝐭𝐱𝐲𝐳$, so that
\[\begin{gather} i𝐢 = 𝐭𝐱𝐲𝐳𝐳𝐲 = 𝐭𝐱, \\ i𝐣 = 𝐭𝐱𝐲𝐳𝐱𝐳 = 𝐭𝐲, \\ i𝐤 = 𝐭𝐱𝐲𝐳𝐲𝐱 = 𝐭𝐳, \end{gather}\]
The eight real GA components read off from w, x, y, z as:
| GA component | quaternion expression | Cl(3,1) basis |
|---|---|---|
R¹ | $\Re(w)$ | $𝟏$ |
Rᶻʸ | $\Re(x)$ | $𝐳𝐲 = 𝐢$ |
Rˣᶻ | $\Re(y)$ | $𝐱𝐳 = 𝐣$ |
Rʸˣ | $\Re(z)$ | $𝐲𝐱 = 𝐤$ |
Rᵗˣ | $\Im(x)$ | $𝐭𝐱$ |
Rᵗʸ | $\Im(y)$ | $𝐭𝐲$ |
Rᵗᶻ | $\Im(z)$ | $𝐭𝐳$ |
Rᵗˣʸᶻ | $\Im(w)$ | $𝐭𝐱𝐲𝐳$ |
The unit-norm condition $𝐑𝐑̃ = 𝟏$ — i.e., $w² + x² + y² + z² = 1$ with complex arithmetic — translates to two real conditions on the GA components:
\[\begin{gather} (R¹)² + (Rᶻʸ)² + (Rˣᶻ)² + (Rʸˣ)² - (Rᵗˣ)² - (Rᵗʸ)² - (Rᵗᶻ)² - (Rᵗˣʸᶻ)² = 1, \\ R¹ Rᵗˣʸᶻ + Rᶻʸ Rᵗˣ + Rˣᶻ Rᵗʸ + Rʸˣ Rᵗᶻ = 0. \end{gather}\]
Quaternionic.vR — Method
vR(Λ::Lorentz{T}) → (v⃗::QuatVec{T}, R::Rotor{T})Return the boost velocity v⃗ and pure rotation R such that Λ = Boost(η, v⃗) * R.
Quaternionic.ℂconj — Method
ℂconj(Λ::Lorentz{T}) → Lorentz{T}Component-wise complex conjugate of Λ: conjugate each complex coefficient (w, x, y, z) → (w̄, x̄, ȳ, z̄).
This is distinct from the GA reverse, which is conj(Λ) and just negates the quaternion "vector" part. For Λ = R*B with R a pure rotation and B a pure boost, ℂconj(Λ) = R * B⁻¹, since ℂconj(B) = B⁻¹ for pure boosts and ℂconj(R) = R for real rotors.
Quaternionic.ℂimag — Method
ℂimag(Λ::Lorentz{T}) → Quaternion{T}Imaginary-part of Λ: Quaternion(imag(Λ[1]), imag(Λ[2]), imag(Λ[3]), imag(Λ[4])).
For Λ = R*B where R is a pure rotation and B is a pure boost with rapidity η in direction n̂, this equals sinh(η/2)*R*n̂.
This is distinct from the GA "imaginary" part, given by imag(Λ), which is constructed from the reverse, rather than the complex-conjugate. That will just be the quaternion "vector" part of Λ, but may be complex; this function returns a full quaternion, with all components real.
Quaternionic.ℂreal — Method
ℂreal(Λ::Lorentz{T}) → Quaternion{T}Complex-real part of Λ: Quaternion(real(Λ[1]), real(Λ[2]), real(Λ[3]), real(Λ[4])).
For Λ = R*B where R is a pure rotation and B is a pure boost with rapidity η, this equals cosh(η/2)*R. Its Euclidean norm is cosh(η/2) ≥ 1.
This is distinct from the GA "real" part, given by real(Λ), which is constructed from the reverse, rather than the complex-conjugate. That will just be the scalar part of Λ, but may be complex; this function returns a full quaternion, with all components real.
Quaternionic.ℂreim — Method
ℂreim(Λ::Lorentz{T}) → (Quaternion{T}, Quaternion{T})Return (ℂreal(Λ), ℂimag(Λ)) as a single call.
Further reading
The spacetime algebra and its application to relativistic physics are developed in detail in Doran and Lasenby [6].
- [6]
- C. Doran and A. Lasenby. Geometric Algebra for Physicists (Cambridge University Press, Cambridge, 2003).
- boostThe sign can be verified by expanding the Lorentz transformation $\Lambda\,𝐯\,\widetilde{\Lambda}$ on the 4-vector $𝐯 = t\,𝐭 + x\,𝐱$ and confirming that a positive rapidity boosts $t \to \cosh\varphi\,t + \sinh\varphi\,x$ and $x \to \sinh\varphi\,t + \cosh\varphi\,x$.