The postulate that would not be proved
Euclid's Elements (c. 300 BCE) builds plane geometry from five postulates. The first four are short and obvious: a line can be drawn between any two points, extended indefinitely, a circle drawn with any centre and radius, and all right angles are equal. The fifth is long and different. In the equivalent form popularised by John Playfair (1795):
Parallel postulate. Through a point not on a given line there is exactly one line that does not meet it.
For two thousand years mathematicians tried to prove the fifth postulate from the other four — Ptolemy and Proclus in Alexandria, Ibn al-Haytham in Cairo, Omar Khayyam in Isfahan, Naṣīr al-Dīn al-Ṭūsī at Maragha, Giovanni Saccheri in Pavia, Johann Heinrich Lambert in Berlin. All of them failed, and many of their "proofs" quietly assumed something equivalent to what they were proving.
Meanwhile, navigators had been living in a non-Euclidean world all along. Fly from the North Pole straight down to the equator, turn left through , fly a quarter of the way around the Earth, turn left through again, and fly straight home: you have traced a triangle with three right angles. On a sphere the angles of a triangle add up to more than — and the excess measures its area.
In the 1820s, Carl Friedrich Gauss, János Bolyai and Nikolai Lobachevsky independently took the bold step: suppose the postulate is false, with many parallels through a point, and see what follows. The result was not a contradiction but a new geometry, the hyperbolic plane, in which triangles have angle sums less than . By the 1860s–1880s, Eugenio Beltrami, Felix Klein and Henri Poincaré had built concrete models of it — and with them proved that the parallel postulate can never be derived from the others. This lesson uses Euclidean geometry and its axioms, trigonometry, and vectors with the dot product; the cross product is recalled below.
Three geometries, one picture
Drag the vertices of a triangle in each of the three geometries and watch its angle sum. In the plane it is always . On the sphere it is larger, by an amount proportional to the area. In the hyperbolic plane (drawn in the Poincaré disc, where straight lines appear as circular arcs meeting the boundary at right angles) it is smaller, again by an amount proportional to the area.
Triangles on curved surfaces
Start with the triangle with three right angles: it covers exactly one eighth of the sphere.
Drag a corner to move it; drag anywhere else to turn the sphere. The sides are arcs of great circles — the shortest paths on a sphere.
- ∠A90.0°
- ∠B90.0°
- ∠C90.0°
∠A + ∠B + ∠C = 270.0°
- Angle excess (sum − 180°)
- 90.0° = 1.571 rad
- Area, measured numerically
- 1.571 R²
- Share of the whole sphere (area ÷ 4πR²)
- 12.50 %
∠A + ∠B + ∠C − π = Area / R²On a sphere of radius R, the excess in radians equals the area divided by R². The area is computed separately, by numerical integration, so the match is a check rather than an assumption.
∠A + ∠B + ∠C − π = K · Area
| Flat plane | K = 0 | ∠A+∠B+∠C = 180° |
|---|---|---|
| Sphere | K = 1/R² | ∠A+∠B+∠C > 180° |
| Hyperbolic plane | K = −1 | ∠A+∠B+∠C < 180° |
This is a first glimpse of the Gauss–Bonnet theorem: for a triangle whose sides are geodesics (shortest paths), the angle sum minus π equals the total curvature inside it. Here the curvature K is the same everywhere; on other surfaces you add up (integrate) K over the area.
The table under the widget records a single law for all three: angle sum , where is the curvature: on a sphere of radius , in the plane and in the standard hyperbolic plane. Small triangles have small area, so in all three geometries tiny triangles look Euclidean — which is why the Earth looks flat to someone standing on it.
Definitions
Definition— great circle, spherical distance
On the sphere , a great circle is the intersection of with a plane through the centre . The distance between two points is the length of the shorter great-circle arc joining them: times the angle , so for unit vectors . Great circles are the "straight lines" (geodesics) of the sphere: the shortest paths between points. Two points are antipodal if they are opposite ends of a diameter.
Definition— cross product
For , the cross product is . It is perpendicular to both and , and its length is , where is the angle between them. So for a great circle through and , the vector is a normal to its plane.
Definition— spherical triangle, angle, lune
A spherical triangle has as sides the great-circle arcs , , (each shorter than a semicircle). Its angle at is the angle between the tangent lines of the two sides at — equivalently, the angle between the planes and , or between their normals and . A lune of angle is the region between two half great circles from a point to its antipode, meeting at angle .
Definition— upper half-plane model
The hyperbolic plane in the upper half-plane model is with lengths measured by : a curve , , has hyperbolic length , and the distance is the infimum of the lengths of curves from to . Areas are measured by . Angles are the usual Euclidean angles (the model is conformal).
Definition— hyperbolic lines, parallels
The lines (geodesics) of are the vertical half-lines and the semicircles centred on the real axis. The real axis together with is the boundary at infinity: it is not part of . Two lines that do not meet are parallel; they are limiting parallels if they meet at a point of the boundary and ultraparallel otherwise.
Definition— Poincaré disc model
The Poincaré disc is the open unit disc , with lines the diameters and the circular arcs meeting the unit circle at right angles. It is the image of under the Cayley transform , which carries the half-plane model onto the disc model, lines to lines, preserving angles; the boundary circle is the boundary at infinity.
Definition— Möbius transformation, excess, defect
A Möbius transformation of is a map with and . The angle excess of a spherical triangle with angles is ; the defect of a hyperbolic triangle is .
Examples
Example— Three right angles
The North Pole and the points and on the equator form a spherical triangle with three right angles: angle sum , excess . It is one of the eight congruent triangles into which the three coordinate planes cut the sphere, so its area is — Girard's theorem in its simplest case.
Example— Great circles versus parallels of latitude
Madrid and New York both lie at about N. The circle of latitude through them is not a great circle (its plane does not pass through the Earth's centre), so it is not the shortest route: the great-circle route bends north over the Atlantic, and long-distance flights follow such curving routes. The equator is the only circle of latitude that is a line of spherical geometry. Meridians are great circles, and any two of them meet at the poles: on the sphere there are no parallel lines at all.
Example— Distances in the half-plane
Along the imaginary axis, the curve from to () has length . As or , the distance from grows without bound: the boundary is infinitely far away, even though it looks close in the picture. Horizontal distances shrink with height: the points and are at hyperbolic distance , but and are only about apart.
Spherical geometry
Take (for radius , lengths scale by and areas by ). Let be unit vectors, with sides , , and angles at .
Theorem— Theorem (spherical law of cosines)
.
Proof
The normals to the planes and are and , with lengths and , and is the angle between them, so . On the other hand, Lagrange's identity with gives
Equating the two expressions gives the law.
∎
For small triangles, and ; substituting and keeping terms of second order turns the spherical law into the Euclidean law of cosines .
Theorem— Lemma (area of a lune)
A lune of angle on the unit sphere has area .
Proof
Rotations about the axis through the lune's two vertices preserve area and carry lunes to lunes of the same angle, so the area of a lune depends only on its angle, say ; it is additive (, placing lunes side by side) and increasing. Since lunes of angle tile the sphere, , and by additivity . An increasing function that agrees with on all rational multiples of equals it everywhere.
∎
Theorem— Theorem (Girard, 1629)
A spherical triangle on a sphere of radius has area .
Proof
Take and write for the antipodes of . The three great circles , , cut the sphere into eight triangles: , its antipodal image (of the same area, since is an isometry), and six others. The two great circles through bound a lune of angle containing ; the great circle cuts it into and the triangle . So
and their antipodal lunes are , , . Each of the six other triangles appears in exactly one of these six lunes, while appears in three and in three. Adding areas (boundaries have zero area), using the lemma:
so .
∎
Consequences. Every spherical triangle has angle sum greater than . Two triangles with the same angles have the same area — and in fact are congruent: on the sphere there are no similar triangles of different sizes, and so no scale models. There are no rectangles (a quadrilateral with four right angles would have angle sum , so zero area). And any two great circles meet — their planes through share a line, which meets the sphere in two antipodal points — so there are no parallels.
Spherical geometry is not, however, Euclidean geometry with the fifth postulate replaced: two antipodal points lie on infinitely many great circles (every meridian joins the poles), so the first postulate's uniqueness fails too, and lines are closed curves of finite length. Identifying each point with its antipode gives elliptic geometry on the projective plane, in which two points determine exactly one line and any two lines meet in exactly one point.
Hyperbolic geometry
Theorem— Proposition (vertical segments are shortest)
For , the hyperbolic distance from to is , and the vertical segment is the only shortest curve.
Proof
For any curve from to ,
with equality only if and : the curve runs straight up the imaginary axis. The vertical segment has length exactly .
∎
Theorem— Theorem (Möbius transformations are isometries)
If with real and , then maps onto itself and preserves hyperbolic lengths, distances, angles and areas.
Proof
Multiplying numerator and denominator by ,
so maps to ; its inverse is of the same form, so it is a bijection. Its derivative is , so
the length element is preserved, hence the length of every curve, hence distances. A holomorphic map with non-zero derivative preserves angles, and the area element transforms by .
∎
Möbius transformations map circles and lines of to circles and lines and preserve angles, so they map hyperbolic lines to hyperbolic lines. They are plentiful: (), () and generate them all, and they can move any point to any point and any line to any line — in particular, any line to the imaginary axis. Together with the reflection , they form the whole isometry group of . Combining this with the proposition: every hyperbolic line is the image of the imaginary axis, so the lines of are exactly the vertical half-lines and semicircles centred on , and any two points are joined by exactly one line.
Theorem— Theorem (distance formula)
For : .
Proof
Both sides are unchanged by Möbius transformations: the left because they are isometries, the right because, by the formulas above, and . So we may move and onto the imaginary axis: , with . Then the right side is , which is by the proposition.
∎
Theorem— Theorem (infinitely many parallels)
Through a point not on a hyperbolic line there pass infinitely many lines that do not meet .
Proof
Move to the imaginary axis by an isometry; reflecting in it by if necessary and then scaling by , we may assume with . For , the semicircle centred at through has radius with . It meets at a point () exactly when , i.e. . So for every there is no such : each of these infinitely many semicircles is a line through that misses . (The vertical line is another.)
∎
Exactly two of the lines through are limiting parallels (here , meeting at the boundary point , and the vertical line, meeting it at ); all lines between them are ultraparallel.
Theorem— Theorem (area of a hyperbolic triangle)
A hyperbolic triangle with angles has area . In particular every triangle has angle sum less than and area less than .
Proof
Step 1: one vertex at infinity. Consider a "triangle" with one vertex at (where its two vertical sides meet, at angle ) and two vertices on the unit circle at and , where its angles are and (the angle between a vertical line and the unit circle at is or ). Its area is
Any triangle with one vertex on the boundary can be moved to this position: send that vertex to , then use to make the opposite side the unit circle.
Step 2: the general triangle. Extend the side beyond until it reaches the boundary at an ideal point . Let be the angle . The triangle has angles , , , and the triangle has angles , , ; and . By step 1,
∎
Letting all three vertices run off to the boundary gives an ideal triangle, with all angles and area exactly — the largest possible. As on the sphere, two triangles with the same angles have the same area, and in fact are congruent: hyperbolic geometry has no similar triangles of different sizes. One also has the hyperbolic law of cosines (proved, for example, in Anderson, ch. 5), which for small triangles again reduces to the Euclidean one.
Why the parallel postulate is independent
To show that a statement cannot be proved from axioms , it is enough to find a model: a structure in which all of holds but fails. Any proof of from would be valid in every model, so it would prove something false in this one.
Make "Euclid's other axioms" precise as Hilbert's axioms (1899) for incidence, betweenness, congruence and continuity, without the parallel axiom — so-called neutral geometry. Interpret "point" as a point of , "line" as a hyperbolic line, "between" and "congruent" via hyperbolic distance. One checks that every axiom of neutral geometry holds: two points lie on exactly one line (shown above); lines are infinitely long and separate the plane; there are enough isometries (the Möbius transformations and reflections) to move any segment or angle to any position, which gives the congruence axioms; and the continuity axioms hold because is built from real numbers. (Full verifications are in Greenberg, ch. 7, and Hartshorne, ch. 7.) But the parallel postulate fails, by the theorem on infinitely many parallels.
Hence the parallel postulate is independent of the other axioms. More precisely, the argument is one of relative consistency: the model is constructed inside the real numbers — inside Euclidean geometry — so if Euclidean geometry is consistent, so is hyperbolic geometry. Neither geometry is "the true one" as a matter of logic; which one describes a given situation is a question about that situation. (See model theory for the general method, and first-order logic for what "proof" means here.)
Spherical geometry is not a model of neutral geometry: some of the other axioms fail there too (lines are finite and two antipodal points lie on many lines). Indeed, neutral geometry proves that the angle sum of a triangle is at most (the Saccheri–Legendre theorem), so only the hyperbolic alternative is compatible with Euclid's first four postulates and the continuity axioms.
Spheres and half-planes in Lean
For spherical geometry we use vectors in (in Mathlib, Fin 3 → ℝ with the dot product ⬝ᵥ and the cross product ⨯₃). Lagrange's identity is checked coordinate by coordinate; the spherical law of cosines then follows exactly as in the human proof, with the angle at specified through the normals and :
/-- **Lagrange's identity** for the cross product in `ℝ³`:
`(u × v) · (w × x) = (u · w)(v · x) - (u · x)(v · w)`, checked coordinate by coordinate.
(Mathlib has it, for any commutative ring, as `cross_dot_cross`.) -/
theorem lagrange_identity (u v w x : Fin 3 → ℝ) :
(u ⨯₃ v) ⬝ᵥ (w ⨯₃ x) = (u ⬝ᵥ w) * (v ⬝ᵥ x) - (u ⬝ᵥ x) * (v ⬝ᵥ w) := by
simp only [cross_apply, dotProduct, Fin.sum_univ_three]
simp
ring/-- For points `A, B, C` on the unit sphere, the normals `C × A` and `C × B` to the great
circles `CA` and `CB` satisfy `(C × A) · (C × B) = A · B - (A · C)(B · C)`, i.e.
`cos c - cos a cos b` in terms of the sides of the spherical triangle. -/
theorem normals_dot (A B C : Fin 3 → ℝ) (hC : C ⬝ᵥ C = 1) :
(C ⨯₃ A) ⬝ᵥ (C ⨯₃ B) = A ⬝ᵥ B - (A ⬝ᵥ C) * (B ⬝ᵥ C) := by
rw [lagrange_identity, hC, one_mul, dotProduct_comm C B]
ring/-- The normal `C × A` has squared length `1 - (A · C)²`, which is `sin² b` when the side `CA`
has length `b` (so `A · C = cos b`). -/
theorem normal_sq (A C : Fin 3 → ℝ) (hA : A ⬝ᵥ A = 1) (hC : C ⬝ᵥ C = 1) :
(C ⨯₃ A) ⬝ᵥ (C ⨯₃ A) = 1 - (A ⬝ᵥ C) ^ 2 := by
rw [normals_dot A A C hC, hA]
ring/-- **The spherical law of cosines.** Let `A, B, C` be on the unit sphere, with sides
`a = ∠BOC`, `b = ∠COA`, `c = ∠AOB` (so `cos a = B · C`, …), and let `γ` be the angle at `C`,
i.e. the angle between the normals `C × A` and `C × B`, whose lengths are `sin b` and `sin a`:
`(C × A) · (C × B) = sin b · sin a · cos γ`. Then `cos c = cos a cos b + sin a sin b cos γ`. -/
theorem spherical_law_of_cosines (A B C : Fin 3 → ℝ) (hC : C ⬝ᵥ C = 1) {a b c γ : ℝ}
(ha : Real.cos a = B ⬝ᵥ C) (hb : Real.cos b = A ⬝ᵥ C) (hc : Real.cos c = A ⬝ᵥ B)
(hγ : (C ⨯₃ A) ⬝ᵥ (C ⨯₃ B) = Real.sin b * Real.sin a * Real.cos γ) :
Real.cos c = Real.cos a * Real.cos b + Real.sin a * Real.sin b * Real.cos γ := by
have h := normals_dot A B C hC
rw [hγ, ← ha, ← hb, ← hc] at h
linarithThat any two great circles meet is proved by linear algebra — rank–nullity gives a non-zero vector orthogonal to both normals — and then rescaling it onto the sphere:
/-- **There are no parallels on the sphere.** The great circle with normal `n` is the set of
unit vectors `v` with `v · n = 0`. Any two great circles meet: the linear map
`v ↦ (v · n, v · m)` from `ℝ³` to `ℝ²` has a non-zero kernel by rank–nullity, and a non-zero
kernel vector, rescaled to length `1`, lies on both circles (and so does its antipode). -/
theorem great_circles_meet (n m : Fin 3 → ℝ) :
∃ v : Fin 3 → ℝ, v ⬝ᵥ v = 1 ∧ v ⬝ᵥ n = 0 ∧ v ⬝ᵥ m = 0 := by
-- The 2 × 3 matrix with rows `n` and `m`.
set M : Matrix (Fin 2) (Fin 3) ℝ := Matrix.of ![n, m] with hM
have hker : LinearMap.ker M.mulVecLin ≠ ⊥ :=
LinearMap.ker_ne_bot_of_finrank_lt (by simp)
obtain ⟨w, hw, hw0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot hker
have hMw : M *ᵥ w = 0 := by simpa using hw
have hn : w ⬝ᵥ n = 0 := by
have := congrFun hMw 0
simpa [hM, Matrix.mulVec, dotProduct_comm] using this
have hm : w ⬝ᵥ m = 0 := by
have := congrFun hMw 1
simpa [hM, Matrix.mulVec, dotProduct_comm] using this
-- Rescale `w` to unit length.
have hpos : 0 < w ⬝ᵥ w := by
have hnn : 0 ≤ w ⬝ᵥ w := Finset.sum_nonneg fun i _ => mul_self_nonneg (w i)
rcases hnn.lt_or_eq with h | h
· exact h
· exact absurd (dotProduct_self_eq_zero.mp h.symm) hw0
set s := (Real.sqrt (w ⬝ᵥ w))⁻¹ with hs
refine ⟨s • w, ?_, ?_, ?_⟩
· rw [smul_dotProduct, dotProduct_smul, smul_eq_mul, smul_eq_mul, ← mul_assoc, hs,
← mul_inv, Real.mul_self_sqrt hpos.le, inv_mul_cancel₀ hpos.ne']
· rw [smul_dotProduct, hn, smul_zero]
· rw [smul_dotProduct, hm, smul_zero]For Girard's theorem we formalise only the final arithmetic of the covering argument; the lune formula and the covering by six lunes are not formalised (they need area on the sphere, i.e. surface measure):
/-- **The bookkeeping step of Girard's theorem.** The three great circles through the sides
of a spherical triangle of area `Δ` (radius `R`) cut out three pairs of antipodal lunes, of
areas `2αR²`, `2βR²`, `2γR²` each. Together the six lunes cover the sphere once, except that
the triangle and its antipodal copy are covered three times each:
`2(2αR² + 2βR² + 2γR²) = 4πR² + 4Δ`. Hence `Δ = R²(α + β + γ - π)`. (The lune areas and the
covering argument are proved in the lesson; this lemma checks the arithmetic.) -/
theorem girard_bookkeeping {R α β γ Δ : ℝ}
(hcover : 2 * (2 * α * R ^ 2 + 2 * β * R ^ 2 + 2 * γ * R ^ 2) =
4 * Real.pi * R ^ 2 + 4 * Δ) :
Δ = R ^ 2 * (α + β + γ - Real.pi) := by
linarithFor the hyperbolic plane, the two computations at the heart of the isometry theorem and the distance formula are proved here from scratch: the imaginary part of , the difference , and hence the invariance of :
/-- **Möbius maps preserve the upper half-plane.** For real `a, b, c, d` with `a d - b c = 1`,
`Im ((a z + b) / (c z + d)) = Im z / |c z + d|²`. In particular `Im z > 0` implies that the
image has positive imaginary part. (Mathlib: `UpperHalfPlane.im_smul_eq_div_normSq`.) -/
theorem im_mobius {a b c d : ℝ} (hdet : a * d - b * c = 1) (z : ℂ) :
((a * z + b) / (c * z + d)).im = z.im / normSq (c * z + d) := by
rw [Complex.div_im]
simp only [add_im, add_re, mul_im, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero,
add_zero]
rw [div_sub_div_same]
congr 1
linear_combination z.im * hdet/-- The difference of two image points: if `a d - b c = 1`, then
`g z - g w = (z - w) / ((c z + d)(c w + d))` for `g z = (a z + b) / (c z + d)`. -/
theorem mobius_sub {a b c d : ℝ} (hdet : a * d - b * c = 1) {z w : ℂ}
(hz : (c : ℂ) * z + d ≠ 0) (hw : (c : ℂ) * w + d ≠ 0) :
(a * z + b) / (c * z + d) - (a * w + b) / (c * w + d) =
(z - w) / ((c * z + d) * (c * w + d)) := by
rw [div_sub_div _ _ hz hw]
congr 1
have h : ((a : ℂ) * d - b * c) = 1 := by exact_mod_cast hdet
linear_combination (z - w) * h/-- **Möbius maps are hyperbolic isometries.** The hyperbolic distance in the upper half-plane
satisfies `cosh d(z, w) = 1 + |z - w|² / (2 Im z Im w)`. The quantity
`|z - w|² / (Im z · Im w)` is unchanged by `z ↦ (a z + b) / (c z + d)` (`a d - b c = 1`):
by `mobius_sub` and `im_mobius`, numerator and denominator are both divided by
`|c z + d|² |c w + d|²`. -/
theorem cross_term_invariant {a b c d : ℝ} (hdet : a * d - b * c = 1) {z w : ℂ}
(hz : (c : ℂ) * z + d ≠ 0) (hw : (c : ℂ) * w + d ≠ 0) :
normSq ((a * z + b) / (c * z + d) - (a * w + b) / (c * w + d)) /
(((a * z + b) / (c * z + d)).im * ((a * w + b) / (c * w + d)).im) =
normSq (z - w) / (z.im * w.im) := by
rw [mobius_sub hdet hz hw, im_mobius hdet, im_mobius hdet, normSq_div, normSq_mul]
have hz' : normSq ((c : ℂ) * z + d) ≠ 0 := (normSq_pos.mpr hz).ne'
have hw' : normSq ((c : ℂ) * w + d) ≠ 0 := (normSq_pos.mpr hw).ne'
rw [div_mul_div_comm, div_div_div_eq, mul_comm (normSq _ * normSq _) (z.im * w.im)]
rw [mul_div_mul_right _ _ (mul_ne_zero hz' hw')]Mathlib's UpperHalfPlane (written ℍ) is a genuine metric space with the hyperbolic distance. We cite its distance formula, its isometric action of , and the logarithmic distance along vertical lines:
/-- **The hyperbolic distance formula** in Mathlib's upper half-plane `ℍ`:
`cosh (d z w) = 1 + |z - w|² / (2 Im z Im w)`. This is `UpperHalfPlane.cosh_dist`. -/
theorem cosh_dist (z w : UpperHalfPlane) :
Real.cosh (dist z w) = 1 + dist (z : ℂ) w ^ 2 / (2 * z.im * w.im) :=
UpperHalfPlane.cosh_dist z w/-- **`SL(2, ℝ)` acts on `ℍ` by isometries.** Mathlib proves the instance
`IsIsometricSMul SL(2, ℝ) ℍ` by writing each element as a composite of translations, dilations
and `z ↦ -1/z`; we use it through `isometry_smul`. -/
theorem sl2_isometry (g : Matrix.SpecialLinearGroup (Fin 2) ℝ) :
Isometry (fun z : UpperHalfPlane => g • z) :=
isometry_smul UpperHalfPlane g/-- **The hyperbolic plane is infinitely large.** On a vertical line the distance is
`|log (Im z) - log (Im w)|`: from `i` to `i y` it is `|log y|`, which grows without bound as `y`
tends to `0` or `∞`. This is Mathlib's `UpperHalfPlane.dist_of_re_eq`. -/
theorem dist_vertical {z w : UpperHalfPlane} (h : z.re = w.re) :
dist z w = dist (Real.log z.im) (Real.log w.im) :=
UpperHalfPlane.dist_of_re_eq hFinally, the failure of the parallel postulate, in the case of the human proof:
/-- **Infinitely many parallels.** Let `L` be the hyperbolic line `Re z = 0` (the positive
imaginary axis) and `p = 1 + i`. For every real `c ≥ 1`, the semicircle centred at the real
point `c` through `p` is a hyperbolic line through `p`, and it does not meet `L`: a point `i y`
(`y > 0`) on it would satisfy `c² + y² = (1 - c)² + 1`, i.e. `y² = 2 - 2c ≤ 0`. Different `c`
give different lines, so there are infinitely many lines through `p` missing `L`. -/
theorem many_parallels {c : ℝ} (hc : 1 ≤ c) {y : ℝ} (hy : 0 < y) :
normSq (I * y - c) ≠ normSq (1 + I - c) := by
simp only [normSq_apply, sub_re, sub_im, mul_re, mul_im, add_re, add_im, I_re, I_im,
ofReal_re, ofReal_im, one_re, one_im]
intro h
nlinarithNot formalised here: surface area on the sphere and in (so neither area theorem is formalised beyond its bookkeeping), the classification of hyperbolic lines, and the independence of the parallel postulate — which would require formalising Hilbert's axioms and verifying them in the model.
Measuring curved triangles
The first experiment takes triangles on the unit sphere — the octant triangle and triangles joining cities on several continents — and computes their angle excess, their area by an exact closed formula, and their area by Monte Carlo: throw 200,000 random points onto the sphere and count the fraction that land inside. It also checks the spherical law of cosines.
"""Spherical triangles: angle excess versus area, three independent ways.
For triangles on the unit sphere the experiment computes (1) the angle excess
alpha + beta + gamma - pi from the angles between the planes of the sides,
(2) the area by Monte Carlo: the fraction of 200,000 random points of the
sphere that fall inside the triangle, times 4 pi, with a standard error, and
(3) the area from the exact Van Oosterom-Strackee formula
tan(E/2) = |A.(B x C)| / (1 + A.B + B.C + C.A). Girard's theorem says all three
agree. It also checks the spherical law of cosines on each triangle. The angle
and formula columns are numerical (floating point); the Monte Carlo column is
statistical evidence, with its uncertainty shown.
"""
import numpy as np
def unit(v):
"""The vector v scaled to length 1."""
v = np.asarray(v, dtype=float)
return v / np.linalg.norm(v)
def from_lat_lon(lat, lon):
"""Unit vector at latitude, longitude given in degrees."""
la, lo = np.radians(lat), np.radians(lon)
return np.array([np.cos(la) * np.cos(lo), np.cos(la) * np.sin(lo), np.sin(la)])
def vertex_angle(a, b, c):
"""The angle at a between the great circles ab and ac."""
n1, n2 = np.cross(a, b), np.cross(a, c)
cos_t = np.dot(n1, n2) / (np.linalg.norm(n1) * np.linalg.norm(n2))
return float(np.arccos(np.clip(cos_t, -1.0, 1.0)))
def angle_excess(a, b, c):
"""alpha + beta + gamma - pi."""
return vertex_angle(a, b, c) + vertex_angle(b, c, a) + \
vertex_angle(c, a, b) - np.pi
def exact_area(a, b, c):
"""Van Oosterom-Strackee: the solid angle of the triangle abc."""
num = abs(np.dot(a, np.cross(b, c)))
den = 1 + np.dot(a, b) + np.dot(b, c) + np.dot(c, a)
return float(2 * np.arctan2(num, den))
def monte_carlo_area(a, b, c, n, rng):
"""(estimate, standard error) of the area from n random sphere points."""
p = rng.normal(size=(n, 3))
p /= np.linalg.norm(p, axis=1)[:, None]
inside = np.ones(n, dtype=bool)
for u, v, w in ((a, b, c), (b, c, a), (c, a, b)):
normal = np.cross(u, v)
inside &= np.sign(p @ normal) == np.sign(np.dot(w, normal))
frac = inside.mean()
return 4 * np.pi * frac, 4 * np.pi * np.sqrt(frac * (1 - frac) / n)
def law_of_cosines_gap(a, b, c):
"""|cos(side ab) - (cos ac cos bc + sin ac sin bc cos gamma)|."""
side = {k: np.arccos(np.clip(np.dot(*v), -1, 1)) for k, v in
{"ab": (a, b), "ac": (a, c), "bc": (b, c)}.items()}
gamma = vertex_angle(c, a, b)
rhs = np.cos(side["ac"]) * np.cos(side["bc"]) + \
np.sin(side["ac"]) * np.sin(side["bc"]) * np.cos(gamma)
return float(abs(np.cos(side["ab"]) - rhs))
TRIANGLES = {
"octant (3 right angles)": ((90, 0), (0, 0), (0, 90)),
"Mexico City-B. Aires-Lagos": ((19.4, -99.1), (-34.6, -58.4), (6.5, 3.4)),
"Mumbai-Beijing-Jakarta": ((19.1, 72.9), (39.9, 116.4), (-6.2, 106.8)),
"thin: Cairo-Lagos-Dakar": ((30.0, 31.2), (6.5, 3.4), (14.7, -17.5)),
"Sydney-Lima-Tokyo": ((-33.9, 151.2), (-12.0, -77.0), (35.7, 139.7)),
"small: 1 degree sides": ((0, 0), (0, 1), (1, 0)),
}
def main():
rng = np.random.default_rng(1829)
print(f"{'triangle':<27}{'excess':>9}{'exact':>9}{'Monte Carlo':>18}"
f"{'cos law':>9}")
for label, pts in TRIANGLES.items():
a, b, c = (from_lat_lon(*p) for p in pts)
ex = angle_excess(a, b, c)
area = exact_area(a, b, c)
mc, se = monte_carlo_area(a, b, c, 200_000, rng)
gap = law_of_cosines_gap(a, b, c)
print(f"{label:<27}{ex:9.5f}{area:9.5f}{mc:10.4f} +- {se:.4f}"
f"{gap:9.1e}")
print()
print("Areas on the unit sphere (4 pi = 12.566 is the whole sphere). The")
print("octant has excess pi/2 and area 1/8 of the sphere. Small triangles")
print("are almost flat: their angle sum is barely above pi.")
print("A Monte Carlo value within about 2 standard errors of the exact")
print("area is what sampling theory predicts.")
print()
print("Epistemic status: the excess and the exact formula are floating-")
print("point computations; the Monte Carlo column is statistical evidence")
print("with its error bar. Six triangles do not prove Girard's theorem;")
print("the lesson does. 'cos law' is the residual of the law of cosines.")
if __name__ == "__main__":
main()The second experiment does the same in the upper half-plane, where the angles are computed in two independent ways (from the side lengths by the hyperbolic law of cosines, and from the tangent directions of the arcs), and the area by Monte Carlo. It also applies random Möbius transformations and pushes a triangle towards an ideal one.
"""Hyperbolic triangles in the upper half-plane: angle defect versus area.
Distances come from cosh d(z, w) = 1 + |z - w|^2 / (2 Im z Im w). The angles of
a triangle are computed in two independent ways: from the side lengths by the
hyperbolic law of cosines, and from the Euclidean tangent directions of the
circular arcs (the model is conformal, so Euclidean angles are hyperbolic
angles). The area, the integral of dx dy / y^2 over the triangle, is estimated
by Monte Carlo and compared with the defect pi - (alpha + beta + gamma). The
experiment also applies random Moebius maps z -> (az + b)/(cz + d) with
ad - bc = 1 and checks that side lengths and angles do not change, and it
pushes the vertices towards the boundary to watch the defect approach pi.
Numerical and statistical evidence, not proof.
"""
import cmath
import math
import numpy as np
def hyp_dist(z, w):
"""Hyperbolic distance in the upper half-plane."""
return math.acosh(1 + abs(z - w) ** 2 / (2 * z.imag * w.imag))
def angles_by_cosine_law(z1, z2, z3):
"""The three angles from the side lengths (hyperbolic law of cosines)."""
a, b, c = hyp_dist(z2, z3), hyp_dist(z1, z3), hyp_dist(z1, z2)
def ang(opp, s1, s2):
num = math.cosh(s1) * math.cosh(s2) - math.cosh(opp)
return math.acos(max(-1.0, min(1.0, num / (math.sinh(s1) * math.sinh(s2)))))
return ang(a, b, c), ang(b, a, c), ang(c, a, b)
def geodesic(z, w):
"""('vertical', x) or ('circle', centre, radius) for the line through z, w."""
if abs(z.real - w.real) < 1e-12:
return ("vertical", z.real)
c = (abs(w) ** 2 - abs(z) ** 2) / (2 * (w.real - z.real))
return ("circle", c, abs(z - c))
def tangent(z, w):
"""Unit Euclidean tangent at z of the geodesic arc from z towards w."""
g = geodesic(z, w)
if g[0] == "vertical":
t = 1j if w.imag > z.imag else -1j
else:
t = 1j * (z - g[1]) # perpendicular to the radius
if ((w - z) * t.conjugate()).real < 0:
t = -t
return t / abs(t)
def angles_by_tangents(z1, z2, z3):
"""The three angles as Euclidean angles between tangent vectors."""
out = []
for p, q, r in ((z1, z2, z3), (z2, z3, z1), (z3, z1, z2)):
out.append(abs(cmath.phase(tangent(p, r) / tangent(p, q))))
return tuple(out)
def same_side(points, g, ref):
"""Boolean array: which points lie on the same side of geodesic g as ref."""
if g[0] == "vertical":
return np.sign(points.real - g[1]) == np.sign(ref.real - g[1])
s = np.abs(points - g[1]) ** 2 - g[2] ** 2
return np.sign(s) == np.sign(abs(ref - g[1]) ** 2 - g[2] ** 2)
def area_monte_carlo(z1, z2, z3, n, rng):
"""(estimate, standard error) of the hyperbolic area of the triangle."""
verts = (z1, z2, z3)
sides = [(verts[i], verts[(i + 1) % 3], verts[(i + 2) % 3]) for i in range(3)]
xs = [v.real for v in verts]
top = max(v.imag for v in verts)
for p, q, _ in sides:
g = geodesic(p, q)
if g[0] == "circle" and min(p.real, q.real) < g[1] < max(p.real, q.real):
top = max(top, g[2])
x0, x1, y0 = min(xs), max(xs), min(v.imag for v in verts)
pts = rng.uniform(x0, x1, n) + 1j * rng.uniform(y0, top, n)
inside = np.ones(n, dtype=bool)
for p, q, r in sides:
inside &= same_side(pts, geodesic(p, q), r)
f = np.where(inside, 1 / pts.imag ** 2, 0.0) * (x1 - x0) * (top - y0)
return float(f.mean()), float(f.std() / math.sqrt(n))
def mobius(m, z):
"""Apply z -> (az + b) / (cz + d)."""
a, b, c, d = m
return (a * z + b) / (c * z + d)
def random_sl2(rng):
"""A random real 2 x 2 matrix with determinant 1."""
while True:
a, b, c = rng.uniform(-2, 2, 3)
if abs(a) > 0.2:
return a, b, c, (1 + b * c) / a
TRIANGLES = {
"i, 1+2i, -1+1.5i": (1j, 1 + 2j, -1 + 1.5j),
"2i, 3i, 1+2i": (2j, 3j, 1 + 2j),
"0.2i, 2+0.3i, 1+3i": (0.2j, 2 + 0.3j, 1 + 3j),
}
def main():
rng = np.random.default_rng(1868)
print("Hyperbolic triangles (curvature -1), angles in radians")
print(f"{'vertices':<20}{'angle sum':>10}{'defect':>9}{'MC area':>18}"
f"{'tangent':>10}")
for label, (z1, z2, z3) in TRIANGLES.items():
law = angles_by_cosine_law(z1, z2, z3)
tan = angles_by_tangents(z1, z2, z3)
gap = max(abs(x - y) for x, y in zip(law, tan))
area, se = area_monte_carlo(z1, z2, z3, 400_000, rng)
print(f"{label:<20}{sum(law):10.5f}{math.pi - sum(law):9.5f}"
f"{area:10.4f} +- {se:.4f}{gap:10.1e}")
print("'tangent' = largest gap between the two angle computations.")
print()
worst_len = worst_ang = 0.0
z = TRIANGLES["i, 1+2i, -1+1.5i"]
for _ in range(200):
m = random_sl2(rng)
w = [mobius(m, v) for v in z]
for i in range(3):
j = (i + 1) % 3
worst_len = max(worst_len, abs(hyp_dist(z[i], z[j]) -
hyp_dist(w[i], w[j])))
worst_ang = max(worst_ang, max(abs(p - q) for p, q in zip(
angles_by_cosine_law(*z), angles_by_tangents(*w))))
print("200 random Moebius maps with ad - bc = 1:")
print(f" largest change in a side length: {worst_len:.1e}")
print(f" largest change in an angle: {worst_ang:.1e}")
print()
print("Towards an ideal triangle: vertices -1 + ei, 1 + ei, i/e")
for e in (0.5, 0.1, 0.01, 0.001):
s = sum(angles_by_cosine_law(-1 + e * 1j, 1 + e * 1j, 1j / e))
print(f" e = {e:<6} angle sum {s:.6f}, defect {math.pi - s:.6f}")
print("The defect creeps up to pi but never reaches it: area < pi.")
print()
print("Epistemic status: floating-point computation and a Monte Carlo")
print("estimate with its standard error; agreement on a few triangles is")
print("evidence. The lesson proves area = defect and Moebius invariance.")
if __name__ == "__main__":
main()Both are evidence of different kinds: floating-point computation, accurate to about , and statistical sampling, accurate only to its standard error. Neither proves anything about all triangles; the theorems above do.
Explore: the hyperbolic plane
In the Poincaré disc, drag the vertices towards the boundary circle and watch the angle sum fall towards while the area climbs towards . Then switch to the plane and the sphere and compare: the readout "angle sum area" holds in all three, with , and .
A hyperbolic triangle in the Poincaré disc
The sides are arcs meeting the boundary at right angles; the boundary is infinitely far away.
Poincaré disk model: the sides are arcs of circles that meet the boundary at right angles (dashed: each side extended). The boundary circle is infinitely far away.
- ∠A13.3°
- ∠B12.3°
- ∠C15.3°
∠A + ∠B + ∠C = 40.8°
- Angle defect (180° − sum)
- 139.2° = 2.429 rad
- Area (curvature −1), measured numerically
- 2.429
π − (∠A + ∠B + ∠C) = AreaIn the hyperbolic plane with curvature −1, the defect in radians equals the area. The area is computed separately, by numerical integration.
∠A + ∠B + ∠C − π = K · Area
| Flat plane | K = 0 | ∠A+∠B+∠C = 180° |
|---|---|---|
| Sphere | K = 1/R² | ∠A+∠B+∠C > 180° |
| Hyperbolic plane | K = −1 | ∠A+∠B+∠C < 180° |
This is a first glimpse of the Gauss–Bonnet theorem: for a triangle whose sides are geodesics (shortest paths), the angle sum minus π equals the total curvature inside it. Here the curvature K is the same everywhere; on other surfaces you add up (integrate) K over the area.
Exercises
1. Non-Euclidean geometry: spherical and hyperbolic
Warm-upHumanA pilot flies from the North Pole due south to the equator, turns to fly a quarter of the way around the equator, and then flies due north back to the pole. What is the angle sum of this triangle, in degrees?
2. Non-Euclidean geometry: spherical and hyperbolic
Warm-upHumanA triangle on a sphere of radius has angles , and . Its area is . What is ?
3. Non-Euclidean geometry: spherical and hyperbolic
CoreHumanA triangle in the hyperbolic plane (curvature ) has three angles of each. What is its area?
4. Non-Euclidean geometry: spherical and hyperbolic
CoreHumanWhich of these curves are lines (geodesics) of the upper half-plane model ? (Choose all that apply.)
5. Non-Euclidean geometry: spherical and hyperbolic
CoreHumanWhat is the hyperbolic distance in between and ?
6. Non-Euclidean geometry: spherical and hyperbolic
CoreHumanIn the theorem that is an isometry of we required real with . What goes wrong for , which has , , and ?
7. Non-Euclidean geometry: spherical and hyperbolic
CoreFormalThe Lean theorem many_parallels states: for c : ℝ with 1 ≤ c and y : ℝ with 0 < y, normSq (I * y - c) ≠ normSq (1 + I - c). What does it say geometrically?
8. Non-Euclidean geometry: spherical and hyperbolic
StretchHumanWhy does the upper half-plane model show that the parallel postulate cannot be proved from the other axioms of plane geometry?
9. Non-Euclidean geometry: spherical and hyperbolic
StretchComputationalWrite hyp_dist(z, w) for points of the upper half-plane (Python complex numbers with positive imaginary part), using , and defect(z1, z2, z3), the defect of the triangle, computing each angle from the side lengths by the hyperbolic law of cosines (where is the side opposite ).
Common misconceptions
Misconception
"Non-Euclidean geometry contradicts Euclid." It contradicts only the fifth postulate, which it replaces. Hyperbolic geometry is exactly as consistent as Euclidean geometry (each can be modelled inside the other), and every theorem Euclid proved without the fifth postulate — the first 28 propositions of Book I — remains true in it.
Misconception
"The lines of the Poincaré disc are curved." They look curved only in the Euclidean picture of the model. Measured with the hyperbolic metric they are perfectly straight: each is the unique shortest path between any two of its points. The model is a map, and like a flat map of the Earth it distorts — here, it shrinks distances near the boundary, so shortest paths bow towards the centre.
Misconception
"Spherical geometry satisfies all of Euclid's axioms except the parallel postulate." Other axioms fail too: two antipodal points lie on infinitely many great circles, so a line through two points need not be unique, and lines cannot be extended indefinitely — they close up. This is why spherical geometry is not a model of neutral geometry, and why neutral geometry can prove that angle sums never exceed .
Misconception
"Every hyperbolic triangle has the same angle sum." The angle sum depends on the size of the triangle: it is minus the area. Tiny triangles have angle sums close to ; ideal triangles have angle sum . The same holds on the sphere with excess in place of defect.
Misconception
"The hyperbolic plane is just a saddle or a trumpet-shaped surface." Saddle shapes and Beltrami's pseudosphere have curvature only on part of themselves, or represent only a piece of the hyperbolic plane. By a theorem of Hilbert (1901), no complete smooth surface in has constant negative curvature, so the whole hyperbolic plane cannot be built as a smooth surface in ordinary space; that is why we use models such as the disc and the half-plane. (Crocheted "hyperbolic" surfaces, popularised by Daina Taimiņa, approximate it locally.)
Many ways of seeing
Geometry— Curvature and the three model geometries
Gauss's Theorema Egregium (1827) showed that the curvature of a surface can be measured from inside it, by measuring distances and angles alone. The sphere, the plane and the hyperbolic plane are the complete simply connected surfaces of constant curvature , and , and for a geodesic triangle on any surface the local Gauss–Bonnet formula says , which contains both Girard's theorem and the hyperbolic area formula. One practical consequence: since the sphere has and the plane , no map of any region of the Earth preserves all distances — every atlas distorts something. See curves and surfaces and Riemannian geometry.
Topology— Most surfaces are hyperbolic
Glue the opposite sides of a square and you get a flat torus; can other closed surfaces be given a geometry in which every point looks the same? A regular octagon in the hyperbolic plane can be made with all angles equal to : a tiny regular octagon has angles close to the Euclidean , and as it is enlarged its angles decrease continuously towards , so at some size they equal . Gluing its sides in the pattern brings all eight corners together with total angle , so the result is a smooth hyperbolic surface: the genus-2 surface. By the uniformisation theorem every closed surface carries a metric of constant curvature, whose sign is that of the Euler characteristic: the sphere and projective plane are spherical, the torus and Klein bottle flat, and all the others hyperbolic. Gauss–Bonnet then gives the area: , so the genus-2 surface has area , exactly the area of the octagon (, using the area formula for hyperbolic polygons). See surfaces and the Euler characteristic.
Algebra— Geometry as a group: SO(3), PSL(2, R) and the modular group
In Klein's spirit (transformation geometry), spherical geometry is the geometry of the rotation group acting on the sphere, and hyperbolic geometry the geometry of acting on by Möbius transformations (plus reflections). These groups are as algebraically different as the geometries: is compact, is not. Discrete subgroups of , the Fuchsian groups, tile the hyperbolic plane. The most famous is the modular group of integer matrices, generated by and ; its tiling of by copies of the region , underlies the theory of modular forms, a central object of modern number theory. See groups.
Logic— Independence, models and relative consistency
The parallel postulate was the first famous independence result, and its proof set the pattern for all later ones: to show that does not prove , build a model of . The same method, in far more sophisticated forms, shows that the continuum hypothesis is independent of the axioms of set theory (Gödel 1938, Cohen 1963). Note what the models prove: not that hyperbolic geometry is consistent outright, but that it is consistent if Euclidean geometry (equivalently, the theory of the real numbers) is. Tarski showed (1940s) that elementary Euclidean geometry — first-order, with continuity as an axiom scheme — is complete and decidable. See model theory and forcing and independence.
Physics— Velocities in relativity add hyperbolically
The hyperbolic plane appears inside physics, not just as a mathematical possibility. In special relativity, the set of possible velocities of a particle is a hyperbolic space: writing , the rapidity is a hyperbolic distance from rest, and collinear velocities combine by adding rapidities, — Einstein's velocity addition formula. The hyperboloid , , in Minkowski spacetime, with the metric induced from it, is a model of the hyperbolic plane, and the Lorentz group acts on it by isometries. On cosmic scales, general relativity allows space to be curved; current measurements of the cosmic microwave background find the spatial curvature of the observable universe to be close to zero, within small error bars — a question that, thanks to Gauss, Bolyai and Lobachevsky, is a question of measurement and not of logic. See relativity.
History and global context
- Spherical trigonometry grew out of astronomy. Menelaus of Alexandria's Sphaerica (c. 100 CE) studied spherical triangles. Astronomers in India and in the Islamic world developed spherical trigonometry extensively: Abū al-Wafāʾ al-Būzjānī and his contemporaries stated the spherical law of sines in the 10th century, and al-Bīrūnī (11th century) used spherical trigonometry for geography and to compute the qibla, the direction of Mecca, from any city. Thomas Harriot found the area of a spherical triangle in 1603, but did not publish; Albert Girard published it in 1629.
- The parallel postulate. Commentators from Ptolemy and Proclus onward tried to prove it. Ibn al-Haytham (11th century) studied quadrilaterals with three right angles; Omar Khayyam (Explanations of the Difficulties in the Postulates of Euclid, 1077) and Naṣīr al-Dīn al-Ṭūsī (13th century) studied quadrilaterals with two right angles at the base and equal sides — the configuration later used by Giovanni Saccheri (Euclides ab omni naevo vindicatus, 1733), who derived many hyperbolic theorems while believing he was refuting them. Johann Heinrich Lambert (1766) noticed that the defect would be proportional to area and compared the hypothesis to a sphere of imaginary radius. Adrien-Marie Legendre published repeated attempts.
- Discovery. Carl Friedrich Gauss developed the new geometry privately from the 1810s–1820s but did not publish. Nikolai Lobachevsky in Kazan presented it in 1826 and published from 1829; János Bolyai published it as an appendix to his father Farkas Bolyai's textbook in 1832. Bernhard Riemann's lecture On the hypotheses which lie at the foundations of geometry (1854) placed all of this inside a general theory of curved spaces.
- Models. Eugenio Beltrami (1868) gave the first models, proving relative consistency; Felix Klein (1871) gave a projective model and the names elliptic, parabolic and hyperbolic; Henri Poincaré (1882) found the disc and half-plane models in his work on differential equations and automorphic functions. David Hilbert's Grundlagen der Geometrie (1899) made the axioms, and thus the independence statement, fully precise.
Further reading
- Marvin Jay Greenberg, Euclidean and Non-Euclidean Geometries: Development and History (4th ed. 2008) — axioms, neutral geometry, models and independence, with much history.
- Robin Hartshorne, Geometry: Euclid and Beyond (2000) — Hilbert's axioms and a careful construction of the hyperbolic plane.
- James W. Anderson, Hyperbolic Geometry (2nd ed. 2005) — the upper half-plane and disc models, Möbius transformations, area and trigonometry.
- John Stillwell, Geometry of Surfaces (1992) — spherical, Euclidean and hyperbolic geometry and the surfaces built from them.
- William P. Thurston, Three-Dimensional Geometry and Topology, Vol. 1 (1997) — the modern view, beautifully illustrated.
- H. S. M. Coxeter, Non-Euclidean Geometry (1942; 6th ed. 1998) — a classic, synthetic treatment.
- B. A. Rosenfeld, A History of Non-Euclidean Geometry (1988) — including the work of mathematicians in the medieval Islamic world.