Symmetries that come in families
Put a book flat on a table. Turn it a quarter turn about a vertical axis, then a quarter turn about the axis pointing towards you. Start again and do the same two turns in the opposite order. The book ends up in two different positions. Rotations of the plane can be done in any order — they are just angles, and angles add — but rotations of space cannot.
Rotations are not isolated symmetries like the six symmetries of an equilateral triangle. They come in continuous families: you can turn a little, or a little more, and the rotations near the identity look like a small piece of three-dimensional space. A drone's flight controller, written perhaps by a robotics team in Bengaluru or Lagos, must store and combine such rotations hundreds of times a second without drifting, and almost all of them use quaternions, four numbers per rotation, rather than matrices or three angles. A physicist adds a stranger fact: rotating an electron's state through multiplies it by , and only a rotation through brings it back.
These are all statements about matrix groups: groups of invertible matrices that are at the same time geometric spaces, so that we can speak of paths, of tangent vectors and of size. This lesson studies the most important ones and the bridge between their algebra and their geometry, the matrix exponential.
Groups that are also spaces
The rotations of the plane are the matrices . As varies they trace out a circle inside the four-dimensional space of matrices, and : the group law is addition of angles. The velocity of the curve at is the matrix — an "infinitesimal rotation" — and the whole circle can be recovered from it as , where is the familiar power series with matrices in it.
The same idea works for every matrix group . Curves in through the identity have velocity vectors, and these form a vector space, the Lie algebra — the linearisation of . The exponential map goes back from to . Linear algebra in then tells us about the group: the dimension of is the number of parameters of , and the failure of to be commutative is measured by the bracket in .
The rotations of space form a three-dimensional group . It is covered twice by the group of unit quaternions, which is the three-dimensional sphere . Shrinking a path of rotations from down to nothing is possible; from it is not. That topological fact is the electron's sign.
Definitions
Definition— matrix group
and are the groups of invertible real or complex matrices, viewed as open subsets of and . A matrix group (or linear Lie group) is a subgroup of that is a closed subset of it. Topological words — continuous, compact, connected, path — refer to this topology.
Definition— the classical groups
- , the special linear group ( or ).
- , the orthogonal group, and , the rotation group.
- with , the unitary group, and .
- The Euclidean group of isometries of (, ), realised as the matrices acting on vectors .
Definition— quaternions
The quaternions are the real vector space with basis and the associative multiplication determined by Hamilton's rules (so , , ). For , the conjugate is and . A quaternion is pure if ; we identify the pure quaternions with .
Definition— matrix exponential and one-parameter subgroup
For a square matrix , . A one-parameter subgroup of is a continuous homomorphism , that is, .
Definition— Lie algebra
The Lie algebra of a matrix group is , equipped with the bracket . We write , , , for the Lie algebras of the classical groups.
Examples and non-examples
Example— The circle group, three times
is a circle. So is , and the map is an isomorphism of groups that is also a homeomorphism: multiplying by is rotating by . Both are commutative. is together with the reflections (determinant ): two disjoint circles.
Example— Exponentials you can compute by hand
- : since , the even terms give and the odd terms .
- , a shear: the series stops because the matrix squares to .
- , a "hyperbolic rotation" preserving — a Lorentz boost in one space dimension.
- , and , so diagonalisable matrices are exponentiated by exponentiating eigenvalues.
Example— A non-compact connected group, and an element that is not an exponential
contains for every , so it is unbounded and not compact. It is connected: every factors (Gram–Schmidt on the columns) as with and , , and both factors can be slid continuously to . Yet is not surjective: is not for any real . Indeed, forces (Theorem 7(e) below), so has eigenvalues with . If is real and non-zero, has positive eigenvalues ; if , is nilpotent and has eigenvalue ; if is imaginary, is diagonalisable over , so is too — but is a Jordan block, not diagonalisable. No case gives .
Example— Groups that are not matrix groups in the sense above
The subgroup of the torus , with , is a line winding densely around the torus: it is a subgroup but not closed, so we do not call it a matrix group. (Its closure is the whole torus.) Closedness is what makes the Lie algebra well behaved; von Neumann proved in 1929 that closed subgroups of are automatically smooth manifolds.
Orthogonal groups: compactness, components and Euler's theorem
Theorem— Proposition 1 (what orthogonal means)
For a real matrix , the following are equivalent: (a) ; (b) for all ; (c) the columns of are orthonormal. Every has , and is a group.
Proof
(a) ⇒ (b): . (b) ⇒ (c): the columns are , and . (c) ⇒ (a): the entry of is (column ) (column ). Taking determinants in (a), . If then , and is orthogonal.
∎
Theorem— Proposition 2 (compactness and components)
and are compact. is not connected: it is the disjoint union of the closed sets and . and are compact; and () are not.
Proof
is the preimage of under the continuous map , hence closed, and its entries satisfy because the columns are unit vectors, so it is bounded; by Heine–Borel it is compact. is a closed subset of it. The determinant is continuous on with values in , so the two level sets are disjoint, closed and non-empty: is disconnected, and no path of orthogonal matrices joins a reflection to . The same argument with shows and are compact. Finally is unbounded.
∎
Theorem— Proposition 3 (connectedness)
, and are path-connected.
Proof
. A unitary matrix is normal, so by the complex spectral theorem (see advanced linear algebra) with unitary. The path , , runs inside from to . If we may choose the with , and then the path stays in .
. An orthogonal is normal with eigenvalues on the unit circle, in conjugate pairs . If is an eigenvector for with , then is an -invariant plane on which acts as a rotation by ; the real form of the spectral theorem gives an orthonormal basis (columns of ) in which is block diagonal with blocks , and . Since the s come in pairs, and a pair is a rotation block too. Shrinking every angle to gives a path in from to .
∎
So orientation is topological: the two components of (and of , by Gram–Schmidt) are told apart by the sign of the determinant. Here is the summary, including results stated without proof.
| group | dimension | compact | connected |
|---|---|---|---|
| no | no (two components) | ||
| , | no | yes | |
| yes | no (two components) | ||
| yes | yes | ||
| yes | yes | ||
| yes | yes | ||
| no | no (two components) |
Theorem— Theorem 4 (Euler's rotation theorem)
Every is a rotation about some axis: there is a unit vector with , and rotates the plane by an angle with .
Proof
Since and ,
So and there is a unit vector with . As preserves dot products, it maps to itself; its restriction is an orthogonal map of a plane with determinant (the determinant of in a basis is ), hence a rotation . In that basis and .
∎
Notice where the dimension entered: . In the rotation fixes no non-zero vector, and in the matrix fixes none either. A surprising corollary: the composite of two rotations of space about different axes is again a rotation about a single axis. And the order matters: with and the quarter turns about the - and -axes, , so is not commutative, while is.
Quaternions, SU(2) and the double cover
Theorem— Proposition 5 (unit quaternions)
for all quaternions, so the unit quaternions form a group, which as a space is the sphere . The map
is an injective ring homomorphism with , and it identifies the unit quaternions with .
Proof
A direct computation shows , so (real numbers commute with everything). So products and inverses () of unit quaternions are unit quaternions. The images of are , and ; one checks that they satisfy Hamilton's rules, so the map is a ring homomorphism, and it is injective since the four matrices are independent. Writing and , the image is , with determinant ; such a matrix with is unitary (its columns are orthonormal). Conversely, if then reads , so and .
∎
Theorem— Theorem 6 (the double cover SU(2) → SO(3))
For a unit quaternion define by , on pure quaternions . Then is a surjective homomorphism from the unit quaternions () onto , with kernel . Explicitly, if is a unit pure quaternion, then is the rotation by about the axis .
Proof
. The real part of is times the real part of (a polynomial identity), so pure quaternions go to pure quaternions; is linear, and , so it preserves lengths, hence (by polarisation) dot products.
Homomorphism. , using .
The axis and angle. For pure quaternions one has . Let be a unit pure quaternion, , , and . Then commutes with , so . If is a unit pure quaternion, put , so that and . Then
which is the rotation by about . In particular , and since every unit quaternion has the form , lands in ; by Euler's theorem every element of is such a rotation, so is onto.
Kernel. means for all pure ; commuting with , and forces to be real, so .
∎
So : a rotation is a pair of antipodal unit quaternions. As runs from to , the rotations make a closed loop in , but the quaternions run from to : half a great circle of . Only at does return to . This is the versus of the motivation, and it shows that has a loop that cannot be shrunk while its double has none: (see the fundamental group).
The exponential map and one-parameter subgroups
Fix any submultiplicative matrix norm (), for instance the operator norm. Then , so the series for converges absolutely for every .
Theorem— Theorem 7 (properties of exp)
For square matrices , and invertible :
(a) if then ; (b) is invertible with inverse ; (c) and ; (d) is a one-parameter subgroup with , so its tangent vector at is ; (e) .
Proof
(a) For commuting the binomial theorem holds, and multiplying absolutely convergent series term by term,
(b) and commute, so . (c) and , term by term. (d) and commute, so (a) gives the homomorphism property; differentiating the power series term by term (allowed for power series) gives . (e) Over write with upper triangular (Schur, or Jordan form). Powers of are upper triangular with diagonal entries , so is upper triangular with diagonal , and .
∎
Theorem— Theorem 8 (every one-parameter subgroup is exponential)
If is a continuous homomorphism, then there is a unique matrix with for all .
Proof
First we show is differentiable. Since and is continuous, is close to , hence invertible, for small . Now , which is differentiable in by the fundamental theorem of calculus; multiplying by shows is differentiable. Differentiating in at gives with . Then has (as commutes with ), so . Uniqueness: .
∎
The flow of x′ = Jx is exp(tJ): rotations
Arrows show where the system moves next. Click to start a trajectory, or choose an example.
x′ = −y, y′ = x
Click the plane to start a trajectory, or type a start point below.
Trajectories: 3. They are numerical approximations (fourth-order Runge–Kutta), not exact formulas. The latest trajectory closes up: it is a periodic orbit.
Linear systemA = [0−110]
T = 0, D = 1, T² − 4D = −4; λ = 0 ± 1i
Equilibrium at (0, 0): centre: closed orbits around it
Lie algebras: the tangent space at the identity
Theorem— Theorem 9 (classical Lie algebras)
(a) , of dimension . (b) . (c) and . (d) In each case is exactly the set of velocity vectors of differentiable curves in with .
Proof
(a) If then by Theorem 7(b, c), and since a skew matrix has zero diagonal. Conversely, let be a differentiable curve in with and — for example when , by Theorem 7(d). Differentiating at by the product rule gives . A skew matrix is determined by its entries above the diagonal. (b) By Theorem 7(e), for all if and only if for all , i.e. . (c) is (a) with in place of , combined with (b). (d) is the curve argument above for and ; for , differentiate using when .
∎
Two facts complete the picture; we state them with references. For any matrix group, is a real vector space closed under the bracket. Closure under addition follows from the Lie product formula ; closure under the bracket follows by differentiating the curve in at , which gives (Hall, Lie Groups, Lie Algebras, and Representations, chapters 2–3). And the bracket measures non-commutativity to second order: , the start of the Baker–Campbell–Hausdorff formula, which the first experiment checks numerically.
Example— Infinitesimal rotations and the cross product
A skew matrix is for a unique , and . One checks : the Lie algebra is with the cross product. , for a unit vector , is the rotation by about (Rodrigues' formula , from ), so by Euler's theorem is surjective. A spinning top's angular velocity is a vector in . Similarly has basis (Pauli matrices) with the same brackets up to sign, and the derivative of is an isomorphism — the double cover is a local isomorphism.
Matrix groups in Lean and Mathlib
Mathlib defines Matrix.orthogonalGroup n R, Matrix.specialOrthogonalGroup, Matrix.unitaryGroup and Matrix.specialUnitaryGroup as submonoids of matrices carrying a group structure, the exponential NormedSpace.exp, and the quaternions ℍ[ℝ]. Proposition 1, the determinant, and the commutativity of :
/-- **Orthogonal matrices preserve the dot product**, hence lengths and angles: if `AᵀA = I`
then `(A v) · (A w) = v · (Aᵀ A w) = v · w`. -/
theorem orthogonal_preserves_dot {n : Type*} [Fintype n] [DecidableEq n] {A : Matrix n n ℝ}
(hA : Aᵀ * A = 1) (v w : n → ℝ) : (A *ᵥ v) ⬝ᵥ (A *ᵥ w) = v ⬝ᵥ w := by
rw [dotProduct_mulVec, ← mulVec_transpose, mulVec_mulVec, hA, one_mulVec]/-- Mathlib's `Matrix.orthogonalGroup n ℝ` is exactly the set of real matrices with `AᵀA = I`
(`Matrix.mem_orthogonalGroup_iff'`). It is a group under multiplication, with inverse `Aᵀ`. -/
theorem mem_orthogonal_group_iff {n : Type*} [Fintype n] [DecidableEq n] (A : Matrix n n ℝ) :
A ∈ Matrix.orthogonalGroup n ℝ ↔ Aᵀ * A = 1 :=
Matrix.mem_orthogonalGroup_iff' n ℝ/-- **An orthogonal matrix has determinant `1` or `−1`**: `det A ² = det Aᵀ · det A =
det (AᵀA) = det I = 1`. The two values label the two connected components of `O(n)`. -/
theorem det_orthogonal {n : Type*} [Fintype n] [DecidableEq n] {A : Matrix n n ℝ}
(hA : Aᵀ * A = 1) : A.det = 1 ∨ A.det = -1 := by
have h : (Aᵀ * A).det = 1 := by rw [hA, det_one]
rw [det_mul, det_transpose] at h
exact mul_self_eq_one_iff.mp h/-- The rotation matrix `R(θ)` lies in `SO(2)`, using Mathlib's description of `SO(2)` as the
matrices `!![a, b; c, d]` with `a = d`, `b = −c`, `a² + b² = 1` and the identity
`cos² θ + sin² θ = 1`. -/
theorem rotation_mem_so2 (θ : ℝ) :
!![Real.cos θ, -Real.sin θ; Real.sin θ, Real.cos θ] ∈
Matrix.specialOrthogonalGroup (Fin 2) ℝ := by
rw [Matrix.of_mem_specialOrthogonalGroup_fin_two_iff]
refine ⟨rfl, rfl, ?_⟩
rw [neg_sq]
exact Real.cos_sq_add_sin_sq θ/-- **`SO(2)` is commutative.** Every element has the form `!![a, −c; c, a]`, and two such
matrices commute — rotations of the plane can be done in either order. -/
theorem so2_comm (A B : Matrix (Fin 2) (Fin 2) ℝ) (hA : A ∈ Matrix.specialOrthogonalGroup (Fin 2) ℝ)
(hB : B ∈ Matrix.specialOrthogonalGroup (Fin 2) ℝ) : A * B = B * A := by
rw [Matrix.mem_specialOrthogonalGroup_fin_two_iff] at hA hB
obtain ⟨ha1, ha2, -⟩ := hA
obtain ⟨hb1, hb2, -⟩ := hB
ext i j
fin_cases i <;> fin_cases j <;> simp only [Matrix.mul_apply, Fin.sum_univ_two] <;>
simp only [Fin.zero_eta, Fin.mk_one, ha1, ha2, hb1, hb2] <;> ringThe book experiment, and Euler's theorem with the lesson's determinant argument:
/-- **`SO(3)` is not commutative.** The quarter turns about the `x`-axis and the `z`-axis
(both orthogonal with determinant `1`) give different results in the two orders: turn a book
a quarter turn forwards and then a quarter turn clockwise, then try the other order. -/
theorem so3_not_comm :
let Rx : Matrix (Fin 3) (Fin 3) ℝ := !![1, 0, 0; 0, 0, -1; 0, 1, 0]
let Rz : Matrix (Fin 3) (Fin 3) ℝ := !![0, -1, 0; 1, 0, 0; 0, 0, 1]
(Rxᵀ * Rx = 1 ∧ Rx.det = 1) ∧ (Rzᵀ * Rz = 1 ∧ Rz.det = 1) ∧ Rx * Rz ≠ Rz * Rx := by
intro Rx Rz
refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩, ?_⟩
· ext i j
fin_cases i <;> fin_cases j <;> simp [Rx, Matrix.mul_apply, Fin.sum_univ_three]
· simp [Rx, Matrix.det_fin_three]
· ext i j
fin_cases i <;> fin_cases j <;> simp [Rz, Matrix.mul_apply, Fin.sum_univ_three]
· simp [Rz, Matrix.det_fin_three]
· intro h
have h01 := congrFun (congrFun h 0) 1
simp [Rx, Rz, Matrix.mul_apply, Fin.sum_univ_three] at h01/-- **Euler's rotation theorem, algebraic core**: for `A ∈ SO(3)`, `det (A − I) = 0`. The proof
is the lesson's: `det (A − I) = det (A (I − Aᵀ)) = det (I − A)ᵀ = det (I − A) = (−1)³ det (A − I)`,
so `det (A − I)` equals its own negative. The odd dimension `3` is essential. -/
theorem euler_rotation_det {A : Matrix (Fin 3) (Fin 3) ℝ} (hA : Aᵀ * A = 1) (hdet : A.det = 1) :
(A - 1).det = 0 := by
have hA' : A * Aᵀ = 1 := mul_eq_one_comm.mp hA
have key : (A - 1).det = -(A - 1).det :=
calc (A - 1).det = (A * (1 - Aᵀ)).det := by rw [mul_sub, mul_one, hA']
_ = (1 - Aᵀ).det := by rw [det_mul, hdet, one_mul]
_ = ((1 - A)ᵀ).det := by rw [transpose_sub, transpose_one]
_ = (1 - A).det := det_transpose _
_ = (-(A - 1)).det := by rw [neg_sub]
_ = -(A - 1).det := by rw [det_neg]; norm_num
linarith/-- **Every rotation of ℝ³ has an axis**: a non-zero vector `v` with `A v = v`. From
`det (A − I) = 0` and Mathlib's `Matrix.exists_mulVec_eq_zero_iff` (a square matrix has a
non-zero kernel vector exactly when its determinant vanishes). -/
theorem euler_rotation_axis {A : Matrix (Fin 3) (Fin 3) ℝ} (hA : Aᵀ * A = 1) (hdet : A.det = 1) :
∃ v : Fin 3 → ℝ, v ≠ 0 ∧ A *ᵥ v = v := by
obtain ⟨v, hv0, hv⟩ := Matrix.exists_mulVec_eq_zero_iff.mpr (euler_rotation_det hA hdet)
refine ⟨v, hv0, ?_⟩
rw [sub_mulVec, one_mulVec, sub_eq_zero] at hv
exact hvThe exponential: skew-symmetric matrices exponentiate into , is a homomorphism with tangent vector , and conversely every tangent vector to at is skew. The last theorem is Theorem 9(a)'s curve argument, with Mathlib's product rule for derivatives; derivatives of matrix-valued functions need a norm, and the operator norm is used (all norms on a finite-dimensional space give the same derivatives).
/-- **`exp` maps skew-symmetric matrices into `O(n)`.** If `Xᵀ = −X` then
`(exp X)ᵀ (exp X) = exp (Xᵀ) exp X = exp (−X) exp X = (exp X)⁻¹ exp X = I`. Uses Mathlib's
`Matrix.exp_transpose`, `Matrix.exp_neg` and the invertibility of `exp X`. -/
theorem exp_skew_orthogonal {n : Type*} [Fintype n] [DecidableEq n] {X : Matrix n n ℝ}
(hX : Xᵀ = -X) : (NormedSpace.exp X)ᵀ * NormedSpace.exp X = 1 := by
rw [← Matrix.exp_transpose, hX, Matrix.exp_neg]
exact Matrix.nonsing_inv_mul _ ((Matrix.isUnit_iff_isUnit_det _).mp (Matrix.isUnit_exp X))/-- **`t ↦ exp (t X)` is a one-parameter subgroup**: `exp ((s + t) X) = exp (s X) exp (t X)`.
The matrices `s X` and `t X` commute, so Mathlib's `Matrix.exp_add_of_commute` applies. (For
non-commuting `X`, `Y` the identity `exp (X + Y) = exp X exp Y` fails.) -/
theorem one_parameter_subgroup {n : Type*} [Fintype n] [DecidableEq n] (X : Matrix n n ℝ)
(s t : ℝ) :
NormedSpace.exp ((s + t) • X) = NormedSpace.exp (s • X) * NormedSpace.exp (t • X) := by
rw [add_smul]
exact Matrix.exp_add_of_commute _ _ ((Commute.refl X).smul_left s |>.smul_right t)open scoped Matrix.Norms.Operator in
/-- **The tangent vector of `t ↦ exp (t X)` at `t = 0` is `X`.** This is Mathlib's
`hasDerivAt_exp_smul_const`. Derivatives need a norm on matrices; we use Mathlib's operator norm
(`Matrix.Norms.Operator`), but all norms on a finite-dimensional space give the same derivative. -/
theorem exp_tangent {n : Type*} [Fintype n] [DecidableEq n] (X : Matrix n n ℝ) :
HasDerivAt (fun t : ℝ => NormedSpace.exp (t • X)) X 0 := by
have h := hasDerivAt_exp_smul_const (𝕂 := ℝ) X 0
rw [zero_smul, NormedSpace.exp_zero, one_mul] at h
exact hopen scoped Matrix.Norms.Operator in
/-- **Tangent vectors to `O(n)` at the identity are skew-symmetric.** If `γ` is a curve of
orthogonal matrices with `γ 0 = I` and velocity `X` at `0`, differentiate `γ(t)ᵀ γ(t) = I` with
the product rule: `Xᵀ · I + I · X = 0`. Together with `exp_skew_orthogonal` this identifies the
Lie algebra of `O(n)` (and of `SO(n)`) with the skew-symmetric matrices. -/
theorem tangent_skew {n : Type*} [Fintype n] [DecidableEq n] (γ : ℝ → Matrix n n ℝ)
(X : Matrix n n ℝ) (hγ : HasDerivAt γ X 0) (h0 : γ 0 = 1) (horth : ∀ t, (γ t)ᵀ * γ t = 1) :
Xᵀ + X = 0 := by
have hT : HasDerivAt (fun t => (γ t)ᵀ) Xᵀ 0 := by
have hL := (Matrix.transposeLinearEquiv n n ℝ ℝ).toContinuousLinearEquiv.toContinuousLinearMap.hasFDerivAt (x := γ 0)
exact HasFDerivAt.comp_hasDerivAt (0 : ℝ) hL hγ
have hprod := hT.mul hγ
have hconst : HasDerivAt (fun t => (γ t)ᵀ * γ t) 0 0 := by
have : (fun t => (γ t)ᵀ * γ t) = fun _ => (1 : Matrix n n ℝ) := funext horth
rw [this]
exact hasDerivAt_const _ _
have := hprod.unique hconst
simpa [h0] using thisQuaternions and : points of give elements of , the norm is multiplicative, and conjugation by a unit quaternion is an isometry of the pure quaternions with :
/-- **Points of the 3-sphere give elements of `SU(2)`.** If `|a|² + |b|² = 1` then
`!![a, −b̄; b, ā]` is unitary with determinant `1`. (Conversely every element of `SU(2)` has this
form, which identifies `SU(2)` with the unit sphere `S³ ⊂ ℂ² = ℝ⁴` and with the unit
quaternions `a + b j`; that converse is not formalised here.) -/
theorem su2_mem (a b : ℂ) (h : Complex.normSq a + Complex.normSq b = 1) :
!![a, -(starRingEnd ℂ) b; b, (starRingEnd ℂ) a] ∈ Matrix.specialUnitaryGroup (Fin 2) ℂ := by
rw [Matrix.mem_specialUnitaryGroup_iff, Matrix.mem_unitaryGroup_iff]
have h' : a * (starRingEnd ℂ) a + b * (starRingEnd ℂ) b = 1 := by
rw [Complex.mul_conj, Complex.mul_conj, ← Complex.ofReal_add, h, Complex.ofReal_one]
refine ⟨?_, ?_⟩
· ext i j
fin_cases i <;> fin_cases j <;>
simp [Matrix.mul_apply, Fin.sum_univ_two, Matrix.star_apply] <;>
first | ring1 | linear_combination h'
· simp [Matrix.det_fin_two]
linear_combination h'/-- **The quaternion norm is multiplicative**: `|p q|² = |p|² |q|²` (Euler's four-square
identity in disguise). So the unit quaternions form a group — the 3-sphere `S³` with a
group law. Mathlib: `Quaternion.normSq` is a monoid-with-zero homomorphism, so `map_mul`. -/
theorem quat_norm_mul (p q : Quaternion ℝ) :
Quaternion.normSq (p * q) = Quaternion.normSq p * Quaternion.normSq q :=
map_mul Quaternion.normSq p q/-- **Conjugation preserves pure quaternions.** Identify `ℝ³` with the quaternions of real part
`0`. If `v` is pure, so is `q v q̄` (where `q̄ = star q`); in fact its real part is
`|q|² · Re v`, a polynomial identity checked by `simp` and `ring`. -/
theorem quat_conj_pure (q v : Quaternion ℝ) (hv : v.re = 0) : (q * v * star q).re = 0 := by
simp [hv]
ring/-- **Conjugation by a unit quaternion preserves length**: `|q v q̄|² = |q|² |v|² |q̄|² = |v|²`.
So `v ↦ q v q̄` is an orthogonal map of `ℝ³` — the rotation `ρ(q)` of the lesson. -/
theorem quat_conj_norm (q v : Quaternion ℝ) (hq : Quaternion.normSq q = 1) :
Quaternion.normSq (q * v * star q) = Quaternion.normSq v := by
rw [map_mul, map_mul, Quaternion.normSq_star, hq]
ring/-- **`q` and `−q` give the same rotation**: `(−q) v (−q)̄ = q v q̄`, since the two signs cancel.
This is the "two-to-one" in the double cover `SU(2) → SO(3)`: its kernel contains `±1`. -/
theorem quat_neg_same (q v : Quaternion ℝ) : (-q) * v * star (-q) = q * v * star q := by
rw [star_neg, neg_mul, mul_neg, neg_mul, neg_neg]What is and is not formalised. Independent: Proposition 1 and the determinant, commutative and not, Euler's theorem (the axis), , the one-parameter subgroup law, tangent vectors to are skew, , and the isometry and sign properties of . From Mathlib: the description of , the tangent vector of , and . Not formalised: compactness and connectedness (Propositions 2 and 3), the trace formula for the angle, surjectivity and the kernel of , Theorem 8, and — which Mathlib's matrix-exponential file lists as a result still to be added. The Lean exercises ask for and .
Exponentials numerically, quaternions exactly
The first program sums the exponential series (scaling down by a power of , summing, then squaring back up). It checks , that exponentials of skew matrices are rotations, and , and then measures the Baker–Campbell–Hausdorff correction: differs from by a term of order that the bracket removes.
"""The matrix exponential: rotations, det(exp X) = e^(tr X), and the bracket.
exp(X) = sum X^k / k! is computed here from its power series (with scaling and
squaring, exp(X) = exp(X / 2^s)^(2^s), to keep the series short and accurate).
The experiment checks numerically that
* exp(theta J) is the rotation matrix R(theta), for J = [[0, -1], [1, 0]];
* exp of a skew-symmetric 3 x 3 matrix is orthogonal with determinant 1;
* det(exp X) = e^(tr X) for random matrices (a theorem, not yet in Mathlib);
* exp(X + Y) differs from exp(X) exp(Y) when XY != YX, and for small t
exp(tX) exp(tY) = exp(t(X + Y) + t^2 [X, Y] / 2 + O(t^3)), the first
Baker-Campbell-Hausdorff correction. The error orders t^2 and t^3 are read
off from t = 0.1 and t = 0.01.
Floating-point evidence about specific matrices.
"""
import math
import numpy as np
def expm(x, terms=20):
"""exp(x) for a square matrix, by scaling and squaring a Taylor series."""
x = np.asarray(x, dtype=float)
norm = np.abs(x).sum(axis=1).max()
s = max(0, int(math.ceil(math.log2(norm))) + 1) if norm > 0 else 0
y = x / 2 ** s
result = np.eye(len(x))
term = np.eye(len(x))
for k in range(1, terms + 1):
term = term @ y / k
result = result + term
for _ in range(s):
result = result @ result
return result
def rotation(theta):
"""The rotation matrix R(theta) of the plane."""
c, s = math.cos(theta), math.sin(theta)
return np.array([[c, -s], [s, c]])
def skew(a, b, c):
"""The skew-symmetric matrix with (a, b, c) above the diagonal."""
return np.array([[0.0, a, b], [-a, 0.0, c], [-b, -c, 0.0]])
def bracket(x, y):
"""The commutator [X, Y] = XY - YX."""
return x @ y - y @ x
def bch_errors(x, y, t):
"""(|exp(tX)exp(tY) - exp(t(X+Y))|, same with the t^2 [X,Y]/2 term)."""
lhs = expm(t * x) @ expm(t * y)
first = np.abs(lhs - expm(t * (x + y))).max()
second = np.abs(lhs - expm(t * (x + y) + t * t * bracket(x, y) / 2)).max()
return float(first), float(second)
def main():
j = np.array([[0.0, -1.0], [1.0, 0.0]])
err = max(np.abs(expm(th * j) - rotation(th)).max()
for th in np.linspace(-7, 7, 29))
print("1. exp(theta J) = R(theta) for 29 angles in [-7, 7]:"
f" max error {err:.1e}")
rng = np.random.default_rng(2024)
worst_orth = worst_det = 0.0
for _ in range(50):
q = expm(skew(*rng.uniform(-3, 3, 3)))
worst_orth = max(worst_orth, np.abs(q.T @ q - np.eye(3)).max())
worst_det = max(worst_det, abs(np.linalg.det(q) - 1))
print("2. exp(skew) for 50 random skew-symmetric X:")
print(f" max |Q^T Q - I| = {worst_orth:.1e}, max |det Q - 1| ="
f" {worst_det:.1e}")
rel = 0.0
for _ in range(50):
x = rng.normal(size=(4, 4))
lhs, rhs = np.linalg.det(expm(x)), math.exp(np.trace(x))
rel = max(rel, abs(lhs - rhs) / rhs)
print("3. det(exp X) = e^(tr X) for 50 random 4 x 4 X:"
f" max relative error {rel:.1e}")
x = np.array([[0.0, 1.0], [0.0, 0.0]])
y = np.array([[0.0, 0.0], [1.0, 0.0]])
gap = np.abs(expm(x + y) - expm(x) @ expm(y)).max()
print("4. X = [[0, 1], [0, 0]], Y = [[0, 0], [1, 0]] do not commute:")
print(f" max |exp(X + Y) - exp(X) exp(Y)| = {gap:.3f}")
print(" t without [X,Y]/2 with [X,Y]/2")
for t in (0.1, 0.01):
e1, e2 = bch_errors(x, y, t)
print(f" {t:<6} {e1:.2e} {e2:.2e}")
print(" (errors shrink like t^2 without the bracket, like t^3 with it)")
print()
print("Epistemic status: floating-point computations with a truncated "
"series.\nThey are numerical evidence for these matrices only. "
"exp(skew) in SO(n)\nand the one-parameter subgroup law are proved "
"in the lesson (and in\nLean); det(exp X) = e^(tr X) and the BCH "
"expansion are theorems proved\nin the references.")
if __name__ == "__main__":
main()These are floating-point checks, accurate to about , on finitely many matrices. The second program avoids rounding altogether by using quaternions with rational coordinates, such as . It verifies exactly that is orthogonal with determinant , that and , and that rotations need not commute. It then checks exhaustively that the Hurwitz units form a group mapping two-to-one onto rotations: the rotation group of a regular tetrahedron, doubled into the "binary tetrahedral group".
"""Unit quaternions as rotations, checked in exact rational arithmetic.
A unit quaternion q acts on pure quaternions v = xi + yj + zk by v -> q v q*,
and the lesson shows this is a rotation rho(q) of R^3 with rho(q) = rho(-q).
For quaternions with rational coordinates everything is exact, so the program
can verify, with no rounding at all, that
* rho(q) is orthogonal with determinant 1 for several rational unit q;
* rho(-q) = rho(q) and rho(pq) = rho(p) rho(q) (a two-to-one homomorphism);
* rho(p) rho(q) != rho(q) rho(p): rotations of space do not commute;
* q = (1 + i + j + k)/2 is a 120-degree turn permuting the coordinate axes;
* the 24 Hurwitz units (+-1, +-i, +-j, +-k, (+-1 +-i +-j +-k)/2) are closed
under multiplication and map onto exactly 12 rotations - the rotation group
of a regular tetrahedron - each hit by exactly two quaternions.
These are exact, exhaustive checks of finitely many cases.
"""
import math
from fractions import Fraction
from itertools import product
def qmul(p, q):
"""Hamilton's product of quaternions given as (a, b, c, d) = a+bi+cj+dk."""
a1, b1, c1, d1 = p
a2, b2, c2, d2 = q
return (a1 * a2 - b1 * b2 - c1 * c2 - d1 * d2,
a1 * b2 + b1 * a2 + c1 * d2 - d1 * c2,
a1 * c2 - b1 * d2 + c1 * a2 + d1 * b2,
a1 * d2 + b1 * c2 - c1 * b2 + d1 * a2)
def conj(q):
"""The quaternion conjugate a - bi - cj - dk."""
return (q[0], -q[1], -q[2], -q[3])
def norm_sq(q):
"""|q|^2 = a^2 + b^2 + c^2 + d^2."""
return sum(x * x for x in q)
def rho(q):
"""The 3 x 3 matrix (rows) of v -> q v q* on pure quaternions."""
cols = []
for e in [(0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)]:
cols.append(qmul(qmul(q, e), conj(q))[1:])
return tuple(tuple(cols[j][i] for j in range(3)) for i in range(3))
def matmul(a, b):
"""Product of 3 x 3 matrices given as tuples of rows."""
return tuple(tuple(sum(a[i][k] * b[k][j] for k in range(3))
for j in range(3)) for i in range(3))
def transpose(a):
return tuple(tuple(a[j][i] for j in range(3)) for i in range(3))
def det3(a):
"""Determinant of a 3 x 3 matrix."""
return (a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1])
- a[0][1] * (a[1][0] * a[2][2] - a[1][2] * a[2][0])
+ a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]))
IDENTITY = ((1, 0, 0), (0, 1, 0), (0, 0, 1))
def frac_q(*xs, den=1):
return tuple(Fraction(x, den) for x in xs)
def show(q):
"""Compact text for a rational quaternion, e.g. '(1, 2, 2, 4)/5'."""
den = 1
for x in q:
den = den * x.denominator // math.gcd(den, x.denominator)
body = ", ".join(str(int(x * den)) for x in q)
return f"({body})" + (f"/{den}" if den > 1 else "")
def hurwitz_units():
"""The 24 unit quaternions with all coordinates in Z or all in Z + 1/2."""
units = []
for i in range(4):
for s in (1, -1):
q = [Fraction(0)] * 4
q[i] = Fraction(s)
units.append(tuple(q))
for signs in product((1, -1), repeat=4):
units.append(tuple(Fraction(s, 2) for s in signs))
return units
def main():
samples = [frac_q(1, 1, 1, 1, den=2), frac_q(3, 4, 0, 0, den=5),
frac_q(1, 2, 2, 4, den=5), frac_q(2, 1, 4, 2, den=5)]
print("Rational unit quaternions q = (a, b, c, d) = a + bi + cj + dk:")
print(" " + ", ".join(show(q) for q in samples))
ok = all(norm_sq(q) == 1 and
matmul(transpose(rho(q)), rho(q)) == IDENTITY and
det3(rho(q)) == 1 and
rho(tuple(-x for x in q)) == rho(q) for q in samples)
print("rho(q) orthogonal, det 1, and rho(-q) = rho(q) for all:", ok)
hom = all(rho(qmul(p, q)) == matmul(rho(p), rho(q))
for p in samples for q in samples)
print("rho(pq) = rho(p) rho(q) for all 16 pairs:", hom)
p, q = samples[1], samples[2]
print("rho(p) rho(q) = rho(q) rho(p) for p, q above:",
matmul(rho(p), rho(q)) == matmul(rho(q), rho(p)))
r = rho(samples[0])
print("rho((1 + i + j + k)/2) =", [[int(x) for x in row] for row in r])
print(" (x -> y -> z -> x: a 120-degree turn about (1, 1, 1))")
print()
units = hurwitz_units()
closed = all(qmul(a, b) in units for a in units for b in units)
rotations = {}
for u in units:
rotations.setdefault(rho(u), []).append(u)
print(f"Hurwitz units: {len(units)} quaternions,"
f" closed under multiplication: {closed}")
print(f"distinct rotations rho(u): {len(rotations)};"
" quaternions per rotation:",
sorted({len(v) for v in rotations.values()}))
print()
print("Epistemic status: exact rational arithmetic, so each 'True' is an\n"
"exact verification for the quaternions listed (and an exhaustive\n"
"check over the 24 Hurwitz units). That rho is a two-to-one\n"
"homomorphism from all unit quaternions onto SO(3) is the theorem\n"
"proved in the lesson.")
if __name__ == "__main__":
main()Explore: one-parameter subgroups and the two components of O(2)
Each phase portrait below is the flow of a one-parameter subgroup, for three different with trace , so every flow lies in . The rotation generator above gave circles (a compact subgroup, ). The symmetric generator gives the hyperbolic rotations, which preserve : orbits are hyperbolas, and the subgroup is a line, not a circle. Click to start new trajectories and compare.
Hyperbolic rotations: X = [[0, 1], [1, 0]]
Arrows show where the system moves next. Click to start a trajectory, or choose an example.
x′ = y, y′ = x
Click the plane to start a trajectory, or type a start point below.
Trajectories: 4. They are numerical approximations (fourth-order Runge–Kutta), not exact formulas.
Linear systemA = [0110]
T = 0, D = −1, T² − 4D = 4; λ = −1, 1
Equilibrium at (0, 0): saddle (unstable)
Multiplication by a unit complex number is a rotation, so . Drag around the unit circle and watch turn by the angle of without changing its length.
U(1): multiplying by a unit complex number rotates
Drag z and w. Adding puts arrows end to end; multiplying multiplies lengths and adds angles.
Drag the points, or focus one with Tab and use the arrow keys (hold Shift for small steps).
| Number | Modulus | Argument | |
|---|---|---|---|
| z | 1.5 + 0.5i | 1.581 | 18.4°0.322 rad |
| w | 0.5 + 0.866i | 1 | 60°π/3 |
| zw | 0.317 + 1.549i | 1.581 | 78.4°1.369 rad |
Lengths multiply: 1.581 × 1 = 1.581
Angles add: 18.4° + 60° = 78.4°
Multiplying by w stretches by |w| and turns by arg w: lengths multiply and angles add.
Finally, has two components. Pick the rotation preset and play the morph from : the flag turns but never flips. Pick the reflection preset and play again: on the way from to a reflection the determinant must pass through , leaving the group — there is no path inside .
Two components of O(2)
Rotations (det 1) and reflections (det −1): watch the determinant during the morph from I.
- image of the grid
- image of the unit square
- image of the flag
- before the transformation
The columns of A are the images of e₁ = (1, 0) and e₂ = (0, 1): Ae₁ = (0.866, 0.5), Ae₂ = (−0.5, 0.866)
det A = ad − bc = 1
The unit square (area 1) becomes a parallelogram of area |det A| = 1. Since det A > 0, orientation is preserved.
Invariant lines (real eigenvectors)
λ = 0.866 ± 0.5i
No real eigenvectors: A turns every direction, so no line through 0 stays put. The eigenvalues are complex. In fact A is a rotation by 30°.
Exercises
1. Matrix groups and continuous symmetry
Warm-upHumanWhich of these real matrices lie in ? (Choose all that apply.)
2. Matrix groups and continuous symmetry
Warm-upHumanA rotation has . Through what angle does it rotate, in degrees?
3. Matrix groups and continuous symmetry
CoreHumanWhat is the dimension of the rotation group (equivalently of its Lie algebra )?
4. Matrix groups and continuous symmetry
CoreHumanWhich of these matrix groups are compact? (Choose all that apply.)
5. Matrix groups and continuous symmetry
CoreHumanThe proof of Euler's theorem shows for . Which step uses that the dimension is odd?
6. Matrix groups and continuous symmetry
CoreHumanThe unit quaternion induces the rotation by about the -axis. As increases from to , the rotation returns to the identity. What is the real part of at ?
7. Matrix groups and continuous symmetry
CoreFormalThe Lean theorem exp_skew_orthogonal concludes (NormedSpace.exp X)ᵀ * NormedSpace.exp X = 1 for a real square matrix X. Which hypothesis makes it true?
8. Matrix groups and continuous symmetry
StretchHumanFor which pairs is ? Here , , , . (Choose all that apply.)
9. Matrix groups and continuous symmetry
StretchComputationalImplement Hamilton's product qmul(p, q) for quaternions given as tuples (a, b, c, d) meaning , and rotate(q, v) returning the vector part of for a unit quaternion q and a vector v = (x, y, z) (identified with the pure quaternion ).
Common misconceptions
Misconception
" for all matrices." This holds when (Theorem 7(a)), but not in general: for and the two sides differ by about in one entry (first experiment). The discrepancy is governed by the bracket — non-commutativity of the group shows up as non-additivity of .
Misconception
"Rotations of space commute, like rotations of the plane." is commutative because its elements are just angles, but is not: the book experiment, the Lean theorem so3_not_comm, and the bracket all show it. Two rotations about the same axis do commute.
Misconception
"Every orthogonal matrix is a rotation." Only those with determinant . The matrix (the point reflection ) is orthogonal with determinant ; it is not a rotation about any axis and lies in the other component of . In fact .
Misconception
"A rotation by is the identity, so nothing can tell it from doing nothing." In it is the identity. But the path of rotations from to is a loop that cannot be shrunk to a point in , and in it lifts to a path from to . Spin- particles are described by , which is why their states change sign; the belt trick is the everyday version.
Misconception
"For a connected matrix group, every element is an exponential." True for compact connected groups such as and (a theorem; for it is Euler's theorem with Rodrigues' formula), but false for , which is connected but contains , not an exponential (worked example). The images of always generate a connected group.
Misconception
"The Lie algebra is a group of matrices too." It is a vector space with the bracket, not a group under multiplication: the product of two skew-symmetric matrices is usually not skew, and does not contain . Its elements are velocities, not symmetries.
Many ways of seeing
Topology— SO(3) is real projective space; the Hopf fibration
Theorem 6 identifies with , the real projective space . Another picture: a rotation is an axis and an angle , i.e. the point of the closed ball of radius , with antipodal boundary points identified (a rotation by about equals one about ). Since is simply connected and the covering has two sheets, : the loop is non-trivial and its double is trivial. More generally for , and the universal cover is the spin group . The map , , sends a unit quaternion to the image of under its rotation; each fibre is a circle, giving the Hopf fibration , which showed (Hopf, 1931) that . See algebraic topology.
Geometry— Klein's programme: geometries are group actions
In Felix Klein's Erlangen programme (1872) a geometry is a space with a group acting on it, and its theorems are the properties invariant under the group. Euclidean geometry is with ; spherical geometry is with , and because acts transitively with the rotations about the north pole as stabiliser; the hyperbolic plane is (see non-Euclidean geometry), and projective geometry is governed by (see projective geometry). A compact matrix group carries a Riemannian metric invariant under left and right multiplication, and for it the one-parameter subgroups are precisely the geodesics through . See transformation geometry and Lie groups.
Algebra— Linearisation and representations
The passage replaces a non-linear object by a linear one with a bilinear bracket satisfying antisymmetry and the Jacobi identity . Lie's theorems say that for simply connected groups nothing is lost: homomorphisms of such groups correspond exactly to homomorphisms of Lie algebras. That is why and , with isomorphic Lie algebras, differ only through . The compact simple Lie algebras were classified by Killing and Cartan into four infinite families (, , , ) and five exceptions (). A representation is a homomorphism ; has exactly one irreducible representation in each dimension (on homogeneous polynomials of degree in two variables), while only the odd-dimensional ones factor through . See representation theory.
Analysis— Linear differential equations and averaging over a group
solves (Theorem 7(d)), and Theorem 8 is a uniqueness theorem for such flows. The flow preserves a quadratic form exactly when lies in the Lie algebra of the orthogonal group of : skew-symmetric give rotations, gives the hyperbolas of the visualisation (see ordinary differential equations). Compactness has a powerful analytic consequence: a compact group carries a unique invariant probability measure (Haar measure), so one can average over it. Averaging any inner product over gives a -invariant one, which proves that every representation of a compact group is unitary and splits into irreducibles; the Peter–Weyl theorem extends Fourier series from the circle to every compact group. See harmonic analysis.
Physics— Spin, angular velocity and the groups of physical law
For a rigid body rotating as , the matrix lies in : it is the angular velocity, and Euler's equations of rigid-body motion are an equation in this Lie algebra. Quantum states of a spin- particle form with acting; the rotation acts as , observed directly in neutron interferometry experiments in 1975. Special relativity replaces by the Lorentz group , whose identity component is doubly covered by (see relativity), and the Standard Model of particle physics is built on the gauge group (see gauge theory and quantum mechanics). Noether's theorem pairs one-parameter symmetry groups with conserved quantities — rotations with angular momentum. Physics motivated much of this mathematics, but the theorems stand on proofs, not on experiment.
Number theory— Hurwitz quaternions and sums of four squares
The quaternions with all coordinates integers, or all in , form a ring — the Hurwitz quaternions — whose units are the elements of the second experiment. Multiplicativity of the norm, , is Euler's four-square identity: a product of two sums of four squares is a sum of four squares. Combined with a Euclidean-style division algorithm in the Hurwitz ring, it gives a proof of Lagrange's four-square theorem (1770): every positive integer is a sum of four squares. Counting rational points on and on spheres leads into the arithmetic of quadratic forms; the groups and , matrix groups over the integers, are central in number theory and in the theory of modular forms.
Category theory— The Lie functor
A continuous homomorphism of matrix groups induces a linear map , , with and , and by the chain rule. So taking Lie algebras is a functor from matrix groups to Lie algebras (see functors). It does not distinguish all groups — and have isomorphic Lie algebras — but on simply connected Lie groups (a class slightly larger than matrix groups: the universal cover of is not a matrix group) it is an equivalence of categories onto finite-dimensional real Lie algebras. This combines Lie's theorems with Ado's theorem, which says every finite-dimensional Lie algebra is a Lie algebra of matrices.
History and global context
- Rotations. Leonhard Euler proved in 1775–1776 that every motion of a rigid body about a fixed point is a rotation about an axis. Olinde Rodrigues (1840) gave the formula for composing rotations, in terms of the parameters now called Euler–Rodrigues parameters — essentially unit quaternions, three years before quaternions were invented.
- Quaternions. William Rowan Hamilton discovered the quaternions on 16 October 1843, carving into Brougham Bridge in Dublin. Arthur Cayley published the description of rotations as in 1845 (Hamilton found it independently). Quaternions are now standard in aerospace attitude control, robotics and computer graphics.
- Lie. Sophus Lie, working in Norway and Leipzig from the 1870s, created the theory of continuous transformation groups to do for differential equations what Galois theory does for polynomial equations. Wilhelm Killing (1888–1890) and Élie Cartan (1894) classified the simple Lie algebras over . Cartan also discovered spinors (1913), before physicists needed them.
- Matrices and spin. John von Neumann proved in 1929 that closed subgroups of are Lie groups, founding the theory of matrix groups. Wolfgang Pauli (1927) and Paul Dirac (1928) introduced the matrices of electron spin, and Eugene Wigner and Hermann Weyl brought group theory to quantum mechanics; Weyl's book The Classical Groups (1939) named its subject.
- Representation theory worldwide. Harish-Chandra, born in Kanpur, built the representation theory of non-compact semisimple Lie groups such as in the 1950s and 1960s. Hua Luogeng in Beijing developed harmonic analysis on the classical domains (book, 1958), and Claude Chevalley's Theory of Lie Groups (1946) made the subject's modern foundations.
Further reading
- John Stillwell, Naive Lie Theory (2008) — matrix groups, quaternions and Lie algebras at exactly this level, with much history.
- Andrew Baker, Matrix Groups: An Introduction to Lie Group Theory (2002).
- Brian C. Hall, Lie Groups, Lie Algebras, and Representations: An Elementary Introduction (2003; 2nd ed. 2015) — the matrix-group approach, with full proofs of the Lie product formula and the bracket.
- Kristopher Tapp, Matrix Groups for Undergraduates (2005; 2nd ed. 2016).
- Roger Howe, "Very basic Lie theory", American Mathematical Monthly 90 (1983) — a celebrated short introduction.
- V. I. Arnold, Mathematical Methods of Classical Mechanics (1974; English 1978) — rigid bodies and Lie algebras in mechanics.