Why must the wind stop somewhere?
At every moment, somewhere on the Earth the horizontal wind is calm. Stir a cup of coffee and let it settle: in an idealised model, some point of the surface ends up exactly where it started. Crumple a map of Nairobi and drop it on the floor of a room in Nairobi: some point of the map lies exactly over the place it represents. These are three faces of two theorems — the hairy ball theorem and the Brouwer fixed-point theorem — and neither can be proved by calculus alone, because neither is about a formula. They are about the shape of the sphere and the disc.
Differential topology studies smooth manifolds up to diffeomorphism, using smooth maps as probes. Its central trick is to count: given a smooth map between manifolds of the same dimension, count the solutions of , with a sign telling whether preserves or reverses orientation near . For a generic the count is finite, and — this is the miracle — it does not depend on , nor on deforming . That number, the degree, is a topological invariant built from derivatives, and with it the theorems above take a page each.
This lesson builds on smooth manifolds (regular values, orientation, vector fields), and it meets the fundamental group (the degree of a map of circles is a winding number) and the Euler characteristic, which reappears as the sum of the indices of a vector field.
Counting preimages, with signs
Wrap a rubber band round a pencil three times and look at it as a map from the circle to the circle. A typical point of the target is covered three times. Now push a fold into the band: near the fold, some points are covered five times — the band goes forward, back, forward. The unsigned count jumped by . But the extra two passes go in opposite directions, so if we count forward passes as and backward ones as , the signed count is still .
Three ideas make this precise. Regular values are the levels that avoid the tips of folds; Sard's theorem says almost every level is regular. The degree is the signed count at a regular value; it does not depend on the level because, as the level moves, preimages are born and die in pairs of opposite sign (exactly at the critical values). And it does not change under deformation, because a deformation sweeps out a surface whose preimage of a level is a union of arcs and circles — and arcs have two ends.
Regular values, degree, index and transversality
Throughout, manifolds are smooth, Hausdorff and second countable; a closed manifold is compact without boundary.
Definition— critical point, regular value, measure zero
Let be smooth. A point is critical if is not surjective; its image is a critical value. Every other point of — including every point not in the image — is a regular value. A subset has measure zero if has Lebesgue measure zero for every chart ; this is well defined because diffeomorphisms of open subsets of preserve null sets.
Definition— degree
Let be smooth, with closed, connected and . For a regular value , the preimage is finite (it is compact, and discrete by the inverse function theorem). The mod 2 degree is . If and are oriented, each has a sign according as the isomorphism preserves or reverses orientation, and the degree is
That these numbers do not depend on is Theorem 3 below.
Definition— index of a zero of a vector field
Let be a vector field with an isolated zero at . In a chart centred at , becomes a map with and no other zeros in a small ball . The index is the degree of from the sphere to . It does not depend on or on the chart. In the plane it is the number of times turns round as one walks once anticlockwise round .
Definition— transversality
A smooth map is transverse to a submanifold if whenever . Two submanifolds are transverse if the inclusion of one is transverse to the other. A regular value is the special case .
Definition— Morse function
A critical point of is non-degenerate if the Hessian of at (in any chart) is invertible; its Morse index is the number of negative eigenvalues. is a Morse function if all its critical points are non-degenerate.
Examples
Example— Degrees of maps of circles and spheres
- on has degree : for each has preimages, all orientation-preserving; for all preimages reverse orientation. The degree of a map is its winding number.
- Complex conjugation has degree .
- The antipodal map of is the restriction of on ; it sends the outward normal at to the outward normal at , so it preserves the orientation of exactly when . Hence .
- A constant map, or any map that is not onto, has degree (a point outside the image is a regular value with no preimages). So a map of non-zero degree is surjective.
- A non-constant polynomial of degree extends to the Riemann sphere with . Being holomorphic, it preserves orientation at every regular point (its Jacobian determinant is ), so its degree is , the number of solutions of for a regular value . In particular every has a preimage: this is a proof of the fundamental theorem of algebra.
Example— Indices of zeros in the plane
Think of a planar field as a complex function .
| field | picture | index |
|---|---|---|
| source | ||
| sink | ||
| centre (rotation) | ||
| saddle | ||
| "petals" | ||
A source and a sink both have index : the index sees how the arrow turns, not whether the flow goes in or out. For a linear field with , the index is . In particular the gradient of has index at .
Example— Vector fields on the sphere and the torus
On , the rotation field vanishes at the two poles, each of index ; the gradient of the height function (projected onto the sphere) has a source at the south pole and a sink at the north pole, again . On the torus, the field along the parallels vanishes nowhere: total index . The gradient of the height of an upright torus has a maximum, a minimum and two saddles: . In every case the total is the Euler characteristic.
Example— Critical values that cannot be avoided
on has the single critical point and the critical value . The height function on the upright torus has exactly four critical values. Sard's theorem does not say there are no critical values; it says they form a set of measure zero. (A cautionary example: a smooth function can have uncountably many critical values — integrate a smooth function that vanishes exactly on a Cantor set of positive measure — yet they still have measure zero.)
Sard's theorem
Theorem— Theorem 1 (Sard, 1942)
For every smooth map , the set of critical values has measure zero in . Consequently the regular values are dense.
The general proof is an induction on dimension that stratifies the critical set by the order to which derivatives vanish (Milnor, Topology from the Differentiable Viewpoint, §3); it needs of class with . Degree theory only needs the case of equal dimensions, which has a short complete proof.
Theorem— Theorem 2 (Sard in equal dimensions)
Let be open, of class , and . Then has Lebesgue measure zero.
Proof
is a countable union of closed cubes, and a countable union of null sets is null, so it suffices to show that is null for a closed cube of side . Let . Since is uniformly continuous on , there is a function as with whenever , . By the mean value inequality applied to on the segment ,
Divide into subcubes of side and diameter . Suppose a subcube contains a critical point . For , the point lies in the affine subspace , of dimension at most , within distance of ; and lies within of it. Choosing orthonormal coordinates in which a hyperplane containing is , we see that lies in a box with sides of length and one side of length . So
There are at most such subcubes and , so the outer measure of is at most , which tends to as . ∎
∎
For manifolds of the same dimension, apply Theorem 2 in countably many charts. Mathlib proves an even stronger version — differentiability suffices, no continuity of is needed — and we cite it in the formal section.
The degree is well defined
We use one classification theorem without proof (see Milnor, Appendix, or Guillemin–Pollack, Appendix 2).
Theorem— Fact (compact 1-manifolds)
Every compact connected -manifold with boundary is diffeomorphic to a circle or to a closed interval. Hence a compact -manifold with boundary has an even number of boundary points; if it is oriented, its boundary points (with their Stokes signs) sum to .
We also use the regular value theorem for manifolds with boundary: if is a regular value of and of , then is a manifold with boundary , of dimension .
Theorem— Theorem 3 (invariance of the degree)
Let be closed, connected, . Then (a) is the same for all regular values of ; (b) homotopic maps have the same mod 2 degree. If and are oriented, the same holds for the signed count .
Proof
Local constancy. If is regular with , the inverse function theorem gives disjoint neighbourhoods mapped diffeomorphically onto a common neighbourhood of ; shrinking to avoid the compact set , every is regular with exactly preimages, of the same signs.
Homotopy invariance (b). Let be a smooth homotopy from to , and let be a regular value of and . By local constancy and Sard's theorem we may replace by a nearby value that is regular for too, without changing the counts for and . Then is a compact -manifold with boundary
By the Fact the number of boundary points is even, so . With orientations, an arc of joining two points of joins points of opposite sign, an arc joining to joins points of the same sign, and so the signed counts agree (Milnor, §5, checks the sign conventions).
Independence of (a). For regular values of there is a diffeomorphism , smoothly isotopic to the identity, with (the homogeneity lemma: move points along flows of compactly supported vector fields, and use connectedness of ). Then , and , with the same signs since preserves orientation. By (b), , and likewise for signed counts. ∎
∎
Theorem— Corollary 4 (properties of the degree)
; a diffeomorphism has degree ; a map of non-zero degree is surjective; and if for a compact oriented and extends to a smooth , then .
The last statement is proved like (b): for regular for and , the preimage is a compact oriented -manifold with boundary , so the signs sum to .
Brouwer's fixed-point theorem and the hairy ball theorem
Theorem— Theorem 5 (no retraction)
There is no smooth map with for all .
Proof
(M. Hirsch.) Suppose exists. By Sard's theorem it has a regular value ; is also regular for . So is a compact -manifold with boundary — a single point. This contradicts the Fact. ∎
∎
Theorem— Theorem 6 (Brouwer's fixed-point theorem)
Every continuous map has a fixed point.
Proof
Smooth case. Suppose is smooth with for all . Let and send along the ray from through until it meets the sphere: , where solves , that is
The discriminant is positive on the disc: for because , and for because , by Cauchy–Schwarz and . So is smooth, and for it gives , . Thus is a smooth retraction, contradicting Theorem 5.
Continuous case. If a continuous has no fixed point, then on the compact disc. By the Weierstrass approximation theorem there is a polynomial map with on the disc. Then maps the disc into itself, , and so is a smooth map with no fixed point — impossible by the smooth case. ∎
∎
Brouwer's theorem holds for any space homeomorphic to a disc (any compact convex set with non-empty interior), but not for an annulus (rotate it) or for (translate it). It says nothing about how many fixed points there are, or how to find one.
Theorem— Theorem 7 (hairy ball theorem)
has a continuous tangent vector field without zeros if and only if is odd.
Proof
If is odd, regard and let , i.e. . Then and .
Conversely, suppose is a nowhere-zero tangent field on . We may assume it is smooth (approximate it by a polynomial field and project onto the tangent spaces; a small perturbation stays non-zero) and of length (divide by ). Then
is a unit vector, since , so is a homotopy on from to , the antipodal map. By Theorem 3, , so is odd. ∎
∎
On the round Earth () every continuous horizontal wind field has a calm point — a statement about an idealised continuous model, but a theorem about that model.
The Poincaré–Hopf theorem and Morse theory
Theorem— Theorem 8 (Poincaré–Hopf)
Let be a closed manifold and a smooth vector field on with only isolated zeros . Then
the Euler characteristic of (the alternating sum of the numbers of cells in any cell decomposition, or of the Betti numbers).
Proof sketch (Milnor, Topology from the Differentiable Viewpoint, §6). Step 1: the sum does not depend on . Embed in and take a closed tubular neighbourhood of . Extend to a vector field on that points outward along and has the same zeros, with the same indices. On the compact manifold with boundary minus small balls round the zeros, is defined; by Corollary 4, the degree of on equals the sum of the degrees on the small spheres, which is . But on , is homotopic to the outward unit normal (the Gauss map of ), which does not involve . Step 2: compute it for one field. Take a triangulation of and a field with one zero at the barycentre of each simplex, flowing from the barycentre of each simplex towards the barycentres of the higher-dimensional simplices containing it (so vertices are sources). At the barycentre of a -simplex the flow is attracting in the directions of the simplex and repelling in the others, so the index is , so the sum is . Alternatively, use the gradient of a Morse function, as below.
Consequences:
- The hairy ball theorem again: , so every vector field on vanishes somewhere. The torus and the Klein bottle () carry nowhere-zero fields; a surface of genus does not.
- Hopf's converse (stated): a closed connected manifold has a nowhere-zero vector field if and only if . Every closed odd-dimensional manifold has (by Poincaré duality), so it has one.
- Morse theory. If is a Morse function, its gradient (for any metric) has a zero of index at each critical point of Morse index (from the normal form , the Morse lemma). So , where is the number of critical points of index . For the upright torus, . Morse proved more: has a cell decomposition with one -cell for each critical point of index , which gives the Morse inequalities (the Betti numbers).
Transversality. Regular values generalise to transversality, and Sard's theorem to Thom's transversality theorem: if is smooth and transverse to , then is transverse to for almost every . Hence any map can be perturbed to be transverse to a given submanifold. For compact with , the number of points of mod 2 is then a homotopy invariant, the mod 2 intersection number. A meridian and a longitude on the torus meet once, transversally, so no homotopy can pull them apart; any two closed curves on the sphere have intersection number .
Differential topology in Lean and Mathlib
Mathlib has a strong form of Sard's theorem in equal dimensions: the image of the set where the derivative is singular is null for any Haar measure, assuming only differentiability. We cite it and deduce that critical values are negligible:
/-- **Sard's theorem (equal dimensions).** If `f : E → E` has derivative `f' x` at each point of
`s` and `f' x` is singular (`det = 0`) on `s`, then `f(s)` has measure zero for any Haar measure
(for instance Lebesgue measure on `ℝⁿ`). This is Mathlib's
`MeasureTheory.addHaar_image_eq_zero_of_det_fderivWithin_eq_zero`; note that it needs only
differentiability, not `C¹`. -/
theorem sard_equidimensional {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]
(μ : MeasureTheory.Measure E) [μ.IsAddHaarMeasure] {f : E → E} {s : Set E}
{f' : E → E →L[ℝ] E} (hf' : ∀ x ∈ s, HasFDerivWithinAt f (f' x) s x)
(hsing : ∀ x ∈ s, (f' x).det = 0) : μ (f '' s) = 0 :=
MeasureTheory.addHaar_image_eq_zero_of_det_fderivWithin_eq_zero μ hf' hsing/-- **The critical values of a differentiable map `E → E` form a null set**, so almost every
value is regular. Apply `sard_equidimensional` to the set of critical points
`{x | det Df(x) = 0}`. (It does *not* say there are no critical values: a fold `x ↦ x²` has the
critical value `0`.) -/
theorem critical_values_null {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E]
(μ : MeasureTheory.Measure E) [μ.IsAddHaarMeasure] {f : E → E}
(hf : Differentiable ℝ f) :
μ (f '' {x | (fderiv ℝ f x).det = 0}) = 0 :=
sard_equidimensional μ (fun x _ => (hf x).hasFDerivAt.hasFDerivWithinAt) fun _ hx => hxDegree theory, the Brouwer theorem in dimension , the hairy ball theorem and Poincaré–Hopf are not yet in Mathlib (they need either homology or the classification of -manifolds, which are not formalised in this form). What we can formalise are the explicit constructions in their proofs. First, the odd-dimensional half of Theorem 7: the Hopf field on is tangent to every sphere and has length :
/-- The Euclidean inner product on `ℂⁿ = ℝ²ⁿ`: `⟨z, w⟩ = Σₖ (Re zₖ Re wₖ + Im zₖ Im wₖ)`. -/
def dot {n : ℕ} (z w : Fin n → ℂ) : ℝ :=
∑ k, ((z k).re * (w k).re + (z k).im * (w k).im)/-- The **Hopf vector field** `v(z) = i z` on `ℂⁿ`. In real coordinates it is
`(x₁, y₁, …, xₙ, yₙ) ↦ (-y₁, x₁, …, -yₙ, xₙ)`. -/
def hopfField {n : ℕ} (z : Fin n → ℂ) : Fin n → ℂ :=
fun k => Complex.I * z k/-- The Hopf field is **tangent** to every sphere centred at `0`: `⟨z, iz⟩ = 0`. Termwise,
`x·(-y) + y·x = 0`. -/
theorem hopfField_tangent {n : ℕ} (z : Fin n → ℂ) : dot z (hopfField z) = 0 := by
simp only [dot, hopfField, Complex.mul_re, Complex.mul_im, Complex.I_re, Complex.I_im]
apply Finset.sum_eq_zero
intro k _
ring/-- The Hopf field has the same length as `z`: `⟨iz, iz⟩ = ⟨z, z⟩`. So on the unit sphere
`S^{2n-1}` it has length `1` and **vanishes nowhere**: odd-dimensional spheres are not hairy. -/
theorem hopfField_length {n : ℕ} (z : Fin n → ℂ) :
dot (hopfField z) (hopfField z) = dot z z := by
simp only [dot, hopfField, Complex.mul_re, Complex.mul_im, Complex.I_re, Complex.I_im]
apply Finset.sum_congr rfl
intro k _
ringNext, the two ingredients of the even-dimensional half: the rotation homotopy stays on the sphere and joins the identity to the antipodal map, and the antipodal map has determinant , which is on even-dimensional spheres:
/-- **The key homotopy in the hairy ball theorem.** If `x` and `v` are orthogonal unit vectors,
then `cos t • x + sin t • v` is a unit vector for every `t`; it equals `x` at `t = 0` and `-x`
at `t = π`. Applied pointwise to a unit tangent field `v(x)` on `Sⁿ`, this is a homotopy on the
sphere from the identity to the antipodal map. -/
theorem rotation_homotopy {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
{x v : E} (hx : ‖x‖ = 1) (hv : ‖v‖ = 1) (hxv : inner ℝ x v = 0) (t : ℝ) :
‖Real.cos t • x + Real.sin t • v‖ = 1 ∧
Real.cos 0 • x + Real.sin 0 • v = x ∧
Real.cos Real.pi • x + Real.sin Real.pi • v = -x := by
refine ⟨?_, by simp, by simp⟩
have hsq : ‖Real.cos t • x + Real.sin t • v‖ ^ 2 = 1 := by
rw [norm_add_sq_real, norm_smul, norm_smul, real_inner_smul_left, real_inner_smul_right,
hxv, hx, hv, Real.norm_eq_abs, Real.norm_eq_abs]
have := Real.cos_sq_add_sin_sq t
nlinarith [sq_abs (Real.cos t), sq_abs (Real.sin t)]
have hnn : 0 ≤ ‖Real.cos t • x + Real.sin t • v‖ := norm_nonneg _
nlinarith [hsq, hnn]/-- The antipodal map of `Sⁿ` is the restriction of `-I` on `ℝⁿ⁺¹`, whose determinant is
`(-1)^{n+1}`. So it preserves orientation exactly when `n` is odd, and its degree is
`(-1)^{n+1}`. -/
theorem antipodal_det (n : ℕ) :
(-1 : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ).det = (-1) ^ (n + 1) := by
rw [Matrix.det_neg, Matrix.det_one, Fintype.card_fin, mul_one]/-- On an **even**-dimensional sphere the antipodal map reverses orientation: `det(-I) = -1`
on `ℝⁿ⁺¹` when `n` is even. Since a homotopy cannot change the degree, the identity (degree `1`)
is not homotopic to the antipodal map (degree `-1`), and by `rotation_homotopy` there is no
unit tangent field on `Sⁿ`. -/
theorem antipodal_det_even {n : ℕ} (hn : Even n) :
(-1 : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ).det = -1 := by
rw [antipodal_det, pow_succ, hn.neg_one_pow, one_mul]In dimension one, the whole argument of Theorems 5 and 6 can be formalised: the "1-manifold" is replaced by the intermediate value theorem, and the retraction is :
/-- **No retraction of `[-1, 1]` onto its boundary `{-1, 1}`.** A continuous map on `[-1, 1]`
taking only the values `±1` and fixing both endpoints would, by the intermediate value theorem,
take the value `0`. This is the one-dimensional case of the no-retraction theorem
`Dⁿ → Sⁿ⁻¹`. -/
theorem no_retraction_interval :
¬ ∃ r : ℝ → ℝ, ContinuousOn r (Icc (-1) 1) ∧ (∀ x ∈ Icc (-1 : ℝ) 1, r x = 1 ∨ r x = -1) ∧
r (-1) = -1 ∧ r 1 = 1 := by
rintro ⟨r, hcont, hval, hm, hp⟩
have hivt := intermediate_value_Icc (by norm_num : (-1 : ℝ) ≤ 1) hcont
rw [hm, hp] at hivt
obtain ⟨x, hx, hrx⟩ := hivt (by norm_num : (0 : ℝ) ∈ Icc (-1) 1)
rcases hval x hx with h | h <;> linarith/-- **Brouwer's fixed-point theorem in dimension one**, proved as in every dimension: a
continuous `f : [-1, 1] → [-1, 1]` without fixed points would give the retraction
`r(x) = (x - f(x)) / |x - f(x)|` onto `{-1, 1}`, contradicting `no_retraction_interval`. -/
theorem brouwer_interval {f : ℝ → ℝ} (hf : ContinuousOn f (Icc (-1) 1))
(hmaps : MapsTo f (Icc (-1) 1) (Icc (-1) 1)) : ∃ x ∈ Icc (-1 : ℝ) 1, f x = x := by
by_contra hno
push Not at hno
have hne : ∀ x ∈ Icc (-1 : ℝ) 1, x - f x ≠ 0 := fun x hx =>
sub_ne_zero.mpr fun h => hno x hx h.symm
apply no_retraction_interval
refine ⟨fun x => (x - f x) / |x - f x|, ?_, ?_, ?_, ?_⟩
· exact (continuousOn_id.sub hf).div (continuousOn_id.sub hf).abs fun x hx =>
abs_ne_zero.mpr (hne x hx)
· intro x hx
dsimp only
rcases abs_choice (x - f x) with h | h <;> rw [h]
· exact Or.inl (div_self (hne x hx))
· exact Or.inr (by rw [div_neg, div_self (hne x hx)])
· have hm : (-1 : ℝ) ∈ Icc (-1 : ℝ) 1 := by norm_num
have hlt : -1 - f (-1) < 0 := by
have h1 := (hmaps hm).1
have h2 := hne (-1) hm
exact lt_of_le_of_ne (by linarith) h2
dsimp only
rw [abs_of_neg hlt, div_neg, div_self hlt.ne]
· have hp : (1 : ℝ) ∈ Icc (-1 : ℝ) 1 := by norm_num
have hpos : 0 < 1 - f 1 := by
have h1 := (hmaps hp).2
have h2 := hne 1 hp
exact lt_of_le_of_ne (by linarith) h2.symm
dsimp only
rw [abs_of_pos hpos, div_self hpos.ne']Finally, the combinatorial heart of Theorem 3(a) in one dimension. Sample a function at and count how often the samples cross a level : the count depends on , but its parity depends only on which side of the two ends lie — preimages appear and disappear in pairs:
/-- The number of times the finite sequence `a 0, a 1, …, a N` crosses the level `c`: the
number of steps `i < N` at which `a i < c` and `a (i+1) < c` disagree. -/
noncomputable def crossings (a : ℕ → ℝ) (c : ℝ) (N : ℕ) : ℕ :=
((Finset.range N).filter fun i => decide (a i < c) ≠ decide (a (i + 1) < c)).card/-- **Parity of crossings.** The number of crossings of the level `c` is even exactly when the
two ends `a 0` and `a N` lie on the same side of `c`. The number itself depends on `c` and on the
wiggles of the sequence; its parity depends only on the ends. This is the one-dimensional
heart of the mod 2 degree: the count of preimages changes in pairs. -/
theorem crossings_parity (a : ℕ → ℝ) (c : ℝ) (N : ℕ) :
Even (crossings a c N) ↔ decide (a 0 < c) = decide (a N < c) := by
induction N with
| zero => simp [crossings]
| succ N ih =>
have hstep : crossings a c (N + 1) = crossings a c N +
if decide (a N < c) ≠ decide (a (N + 1) < c) then 1 else 0 := by
unfold crossings
rw [Finset.range_add_one, Finset.filter_insert]
split_ifs with h
· rw [Finset.card_insert_of_notMem (by simp)]
· rfl
rw [hstep]
generalize decide (a 0 < c) = p at *
generalize decide (a N < c) = q at *
generalize decide (a (N + 1) < c) = s
split_ifs with h
· rw [Nat.even_add_one, ih]
cases p <;> cases q <;> cases s <;> simp_all
· rw [add_zero, ih]
cases p <;> cases q <;> cases s <;> simp_all/-- If the sequence starts below the level `c` and ends above it, it crosses `c` an **odd**
number of times, whatever `c` between the ends. -/
theorem odd_crossings {a : ℕ → ℝ} {c : ℝ} {N : ℕ} (h0 : a 0 < c) (hN : c < a N) :
Odd (crossings a c N) := by
rw [← Nat.not_even_iff_odd, crossings_parity]
simp [h0, not_lt.mpr hN.le]What is and is not formalised. Cited from Mathlib: Sard's theorem in equal dimensions (Theorem 2, in a stronger form). Proved here: the critical-value corollary, the constructions in the proof of the hairy ball theorem (the Hopf field, the rotation homotopy, the sign of the antipodal map), Theorems 5 and 6 in dimension one, and the parity lemma for crossings. Not formalised: the degree of maps between manifolds, its invariance (Theorem 3), Theorems 5–8 in higher dimensions, and transversality.
Counting preimages and indices
The first program takes a degree- map of the circle with two folds, , and finds all preimages of several values. Their number is or , depending on the value; the count with the signs of is always . It also lists the four critical values. Then it counts preimages for maps of the Riemann sphere: has three preimages of every value except the critical values , all counted , and has degree .
"""Counting preimages: the unsigned count changes, the signed count does not.
Part 1 takes a wiggly map of the circle to itself, of degree 3, whose
derivative changes sign (it folds back). For several regular values y it
finds every preimage numerically and adds up the signs of the derivative.
The number of preimages depends on y; the signed count is always 3. The few
values where the count jumps are critical values (Sard: a finite set here).
Part 2 does the same for maps of the Riemann sphere: z -> z^3 - 3z, which is
holomorphic (every preimage counts +1), and z -> conj(z)^3, which reverses
orientation (every preimage counts -1). Roots are found with numpy.
This is numerical evidence for the theorem that the degree is well defined.
"""
import math
import numpy as np
TWO_PI = 2 * math.pi
WIGGLE = 4.0
SAMPLE_VALUES = [0.2, 1.0, 1.8, 2.6, 3.1, 4.0, 5.0, 6.1]
def lift(t):
"""A lift F of the circle map: F(t + 2 pi) = F(t) + 3 * 2 pi (degree 3)."""
return 3 * t + WIGGLE * math.sin(2 * t)
def lift_derivative(t):
"""F'(t) = 3 + 2 * WIGGLE * cos(2t); negative near t = pi/2 and 3 pi/2."""
return 3 + 2 * WIGGLE * math.cos(2 * t)
def preimages(y, samples=4000):
"""All t in [0, 2 pi) with F(t) = y mod 2 pi, by sign changes + bisection."""
roots = []
ts = [TWO_PI * k / samples for k in range(samples + 1)]
lo = math.floor((lift(0) - 10 - y) / TWO_PI)
hi = math.ceil((lift(TWO_PI) + 10 - y) / TWO_PI)
for k in range(lo, hi + 1):
target = y + TWO_PI * k
values = [lift(t) - target for t in ts]
for i in range(samples):
a, b = ts[i], ts[i + 1]
fa, fb = values[i], values[i + 1]
if fa == 0 or fa * fb < 0:
for _ in range(60):
m = (a + b) / 2
if (lift(a) - target) * (lift(m) - target) <= 0:
b = m
else:
a = m
roots.append((a + b) / 2)
return sorted(roots)
def signed_count(roots):
"""Sum of the signs of F' at the preimages: the degree at a regular value."""
return sum(1 if lift_derivative(t) > 0 else -1 for t in roots)
def critical_values():
"""The critical values F(t) mod 2 pi, where F'(t) = 0 (cos 2t = -3/(2W))."""
s = math.acos(-3 / (2 * WIGGLE)) / 2
points = [s, math.pi - s, math.pi + s, TWO_PI - s]
return sorted(lift(t) % TWO_PI for t in points)
def complex_preimages(coeffs, w, tol=1e-6):
"""Distinct roots of p(z) = w, p given by numpy coefficients (highest first)."""
c = list(coeffs)
c[-1] -= w
distinct = []
for r in np.roots(c):
if all(abs(r - d) > tol for d in distinct):
distinct.append(r)
return distinct
def critical_values_complex(coeffs):
"""Images p(c) of the critical points c (roots of p')."""
p = np.poly1d(coeffs)
return [complex(p(c)) for c in np.roots(np.polyder(p).coeffs)]
def main():
print("1. The circle map F(t) = 3t + 4 sin 2t (mod 2 pi), degree 3")
crit = ", ".join(f"{v:.3f}" for v in critical_values())
print(f" critical values (mod 2 pi): {crit}")
print(" y preimages signed count")
for y in SAMPLE_VALUES:
roots = preimages(y)
print(f" {y:5.3f} {len(roots):5d} {signed_count(roots):+d}")
print()
print("2. Maps of the Riemann sphere")
cubic = [1, 0, -3, 0]
crit = critical_values_complex(cubic)
for name, w in [("0", 0), ("i", 1j), ("2", 2), ("-2", -2), ("5-3i", 5 - 3j)]:
roots = complex_preimages(cubic, w)
critical = any(abs(w - c) < 1e-9 for c in crit)
label = "critical value" if critical else "regular value"
print(f" z^3 - 3z = {name:<5}: {len(roots)} preimages ({label})")
roots = complex_preimages(cubic, 1j)
conj_roots = [r.conjugate() for r in roots]
print(f" conj(z)^3 = conj(i) has {len(conj_roots)} preimages, each with")
print(" Jacobian -|3z^2|^2 < 0: signed count -3, degree -3.")
print()
print("Epistemic status: numerical root-finding on a grid with bisection, for")
print("finitely many values. The constant signed counts are evidence for the")
print("theorem that the degree does not depend on the regular value; the")
print("proof uses Sard's theorem and the classification of compact 1-manifolds.")
if __name__ == "__main__":
main()The second program computes indices as winding numbers round small circles, then checks Poincaré–Hopf on the sphere (using the two charts and , in which a field becomes ) and on the torus. For instance the constant field has no zeros in the -chart but a zero of index at the north pole: the sum is still .
"""Indices of zeros of vector fields, and the Poincare-Hopf theorem.
The index of an isolated zero p of a planar vector field V is the number of
times V turns round as one walks once anticlockwise round a small circle
about p. We compute it by adding up the changes of the angle of V.
Part 1: the basic zeros (source, sink, centre, saddle, z^2, conj(z)^2, z^3).
Part 2: fields on the sphere. Stereographic projection from the north pole
gives a chart z in which z = 0 is the south pole; the chart w = 1/z covers
the north pole, w = 0. A field V(z) becomes W(w) = -w^2 V(1/w) in the second
chart (differentiate w = 1/z along a flow line). The indices always add up to
2 = chi(S^2). Part 3: the gradient of the height function on a torus has a
maximum, a minimum and two saddles, with indices adding up to 0 = chi(T^2).
"""
import cmath
import math
def index(field, centre, radius=1e-3, steps=720):
"""Winding number of the complex-valued field round a small circle."""
total = 0.0
previous = cmath.phase(field(centre + radius))
for k in range(1, steps + 1):
z = centre + radius * cmath.exp(2j * math.pi * k / steps)
angle = cmath.phase(field(z))
step = angle - previous
step -= 2 * math.pi * round(step / (2 * math.pi))
total += step
previous = angle
return round(total / (2 * math.pi))
def south_chart(field):
"""The same field written in the chart w = 1/z: W(w) = -w^2 V(1/w)."""
def other(w):
return -w * w * field(1 / w)
return other
PLANAR = [
("source V = z", lambda z: z),
("sink V = -z", lambda z: -z),
("centre V = iz", lambda z: 1j * z),
("saddle V = conj(z)", lambda z: z.conjugate()),
("dipole V = z^2", lambda z: z * z),
(" V = conj(z)^2", lambda z: z.conjugate() ** 2),
(" V = z^3", lambda z: z**3),
]
#: (name, field in the north chart, zeros in the north chart, zero at w = 0?)
SPHERE = [
("V = z (flow from S to N)", lambda z: z, [0], True),
("V = iz (rotation)", lambda z: 1j * z, [0], True),
("V = 1 (constant)", lambda z: 1 + 0j, [], True),
("V = z^2 - 1", lambda z: z * z - 1, [1, -1], False),
]
def torus_gradient(big=2.0, small=1.0):
"""Coordinate gradient of h(u, v) = (R + r cos v) cos u, as u + iv."""
def grad(z):
u, v = z.real, z.imag
du = -(big + small * math.cos(v)) * math.sin(u)
dv = -small * math.sin(v) * math.cos(u)
return complex(du, dv)
return grad
def main():
print("1. Indices of planar zeros at the origin")
for name, field in PLANAR:
print(f" {name:<22} index {index(field, 0):+d}")
print()
print("2. Fields on the sphere; W(w) = -w^2 V(1/w) near the north pole")
for name, field, zeros, at_infinity in SPHERE:
parts = [index(field, z) for z in zeros]
if at_infinity:
parts.append(index(south_chart(field), 0))
shown = " + ".join(str(p) for p in parts)
print(f" {name:<26} {shown} = {sum(parts)}")
print()
print("3. Gradient of the height function on a torus (R = 2, r = 1)")
grad = torus_gradient()
total = 0
for name, (u, v) in [("maximum", (0, 0)), ("saddle", (0, math.pi)),
("saddle", (math.pi, math.pi)),
("minimum", (math.pi, 0))]:
k = index(grad, complex(u, v))
total += k
print(f" {name:<8} at (u, v) = ({u:.2f}, {v:.2f}) index {k:+d}")
print(f" sum of indices = {total} = chi(torus)")
print()
print("Epistemic status: numerical winding numbers on circles of radius")
print("0.001, rounded to integers, for a handful of fields. The totals 2 and 0")
print("are evidence for the Poincare-Hopf theorem, which the lesson states.")
if __name__ == "__main__":
main()Both are numerical evidence about finitely many maps and fields. The theorems, proved or sketched above, say why the signed counts never change.
Explore: indices you can see
Drag the loop round the zero of each field and use the walk slider to follow the arrow as you go once round. For the saddle the arrow turns once clockwise (index ); for the "dipole" , the field of the complex function , it turns twice anticlockwise (index ). Move the loop so that it does not enclose the zero: the index drops to . A non-zero index forces a zero inside the loop — the two-dimensional version of the intermediate value theorem.
A saddle: index −1
Walk round the loop: the arrow turns once, clockwise.
F(x, y) = (x, −y)
Drag the gold centre (or click anywhere) to move the loop. With the keyboard, focus the centre and use the arrow keys.
Turns so far: −0.09
- Circulation
- ∮ F·dr ≈ 0 | ∬ curl F dA ≈ 0
- Flux out
- ∮ F·n ds ≈ 0 | ∬ div F dA ≈ 0
- At the centre
- curl F ≈ 0, div F ≈ 0, πr² ≈ 7.069
- Index
- -1
All values are numerical approximations (sums around the loop and over the disc).
Green’s theorem checks out: circulation = total curl inside, and flux = total divergence inside (up to numerical error).
Index -1 ≠ 0: walking once around the loop, the arrow makes -1 net full turns (negative means clockwise). A non-zero index forces the field to vanish somewhere inside the loop.
v = z²: index 2
The arrow turns twice as you walk once round the zero.
F(x, y) = (x² − y², 2·x·y)
Drag the gold centre (or click anywhere) to move the loop. With the keyboard, focus the centre and use the arrow keys.
Turns so far: 0.19
- Circulation
- ∮ F·dr ≈ 3.6191 | ∬ curl F dA ≈ 3.6191
- Flux out
- ∮ F·n ds ≈ 5.4287 | ∬ div F dA ≈ 5.4287
- At the centre
- curl F ≈ 0.8, div F ≈ 1.2, πr² ≈ 4.524
- Index
- 2
All values are numerical approximations (sums around the loop and over the disc).
Green’s theorem checks out: circulation = total curl inside, and flux = total divergence inside (up to numerical error).
Index 2 ≠ 0: walking once around the loop, the arrow makes 2 net full turns (negative means clockwise). A non-zero index forces the field to vanish somewhere inside the loop.
Exercises
1. Differential topology
Warm-upHumanWhat is the degree of the map from the unit circle to itself?
2. Differential topology
Warm-upHumanFind the index at the origin of the planar vector field .
3. Differential topology
CoreHumanWhich of these closed manifolds admit a smooth vector field with no zeros? (Choose all that apply.)
4. Differential topology
CoreHumanLet be the height function of an upright torus. Which statement is correct?
5. Differential topology
CoreHumanThe rotation of the annulus by the angle is continuous and has no fixed point. Which hypothesis of the Brouwer fixed-point theorem does it violate?
6. Differential topology
CoreHumanIn the proof of the hairy ball theorem we use the homotopy from the identity to the antipodal map. Why does the proof need to be a unit tangent vector at every point?
7. Differential topology
CoreHumanA closed orientable surface of genus stands upright, and is its height function — a Morse function with one maximum, one minimum and some saddle points. How many saddle points does it have?
8. Differential topology
StretchFormalThe formal section proves critical_values_null : μ (f '' {x | (fderiv ℝ f x).det = 0}) = 0 for a differentiable f : E → E. Which informal statement is this?
9. Differential topology
StretchComputationalThe degree of a map , and the index of a planar zero, are winding numbers. Write winding(points): given a list of non-zero complex numbers sampled along a closed curve (with ), return the number of times the curve winds anticlockwise round , by adding up the changes of argument (each reduced to the range ) and dividing by . Round to the nearest integer.
Common misconceptions
Misconception
"Almost every value is regular, so every value is regular." Sard's theorem says the critical values form a set of measure zero, not that they are absent. has the critical value ; a height function on a torus has four; a smooth function on can even have uncountably many. Proofs use Sard to choose a regular value, never to assume a given value is regular.
Misconception
"Homeomorphic manifolds are diffeomorphic." Milnor (1956) constructed smooth manifolds homeomorphic but not diffeomorphic to ; Kervaire and Milnor showed there are exactly oriented diffeomorphism classes of smooth structures on the topological -sphere. In dimension the gap is wider still: carries uncountably many pairwise non-diffeomorphic smooth structures, while for carries only one. In dimensions homeomorphic manifolds are diffeomorphic.
Misconception
"The degree is the number of preimages." Only at a regular value, and only with signs. The unsigned count can vary from value to value (the first experiment shows and for a map of degree ) and is infinite above a critical value of a constant map. For holomorphic maps all signs are , which is why the confusion is harmless in complex analysis.
Misconception
"Every surface is hairy." Only those with . The torus and the Klein bottle carry nowhere-vanishing vector fields; so does every odd-dimensional sphere. The hairy ball theorem is about (and even-dimensional spheres), and Poincaré–Hopf explains which manifolds are hairy.
Misconception
"The index of a zero is always ." That is true for non-degenerate zeros (where is invertible), but degenerate zeros can have any index: has index , and has index . Perturbing a degenerate zero splits it into non-degenerate ones whose indices add up to the original index.
Many ways of seeing
Topology— Degree is homology
For closed connected oriented -manifolds, , generated by the fundamental class , and a map induces . The degree is thus the effect of on top homology, and Theorem 3 becomes the homotopy invariance of homology. Hopf's theorem (1927) completes the picture: two maps from a closed connected oriented -manifold are homotopic if and only if they have the same degree, so . Thom (1954) turned the preimage construction into cobordism theory: preimages of regular values of maps to spheres are framed submanifolds, and Pontryagin and Thom showed that homotopy classes of maps correspond to cobordism classes of such submanifolds — a bridge from differential topology to stable homotopy theory. See algebraic topology and homotopy theory.
Geometry— Gauss–Bonnet is Poincaré–Hopf for the Gauss map
For a closed surface , the Gauss map has Jacobian determinant equal to the Gaussian curvature , so . Step 1 of the proof of Poincaré–Hopf identifies with (here is a thickening of and is two copies of ), giving the Gauss–Bonnet theorem . Chern's intrinsic proof runs the argument in reverse, through a vector field on ; see Riemannian geometry. Morse theory has a geometric incarnation too: applied to the energy functional on paths, it relates the topology of the loop space of a Riemannian manifold to its geodesics and conjugate points.
Analysis— Fixed points and degree in infinite dimensions
Analysts use degree to solve equations. Schauder's fixed-point theorem extends Brouwer to compact maps of closed convex sets in Banach spaces, and the Leray–Schauder degree extends the degree to compact perturbations of the identity; both prove existence theorems for nonlinear PDEs by deforming the equation to a solvable one without letting solutions escape through the boundary. In complex analysis the degree is the argument principle: the number of zeros minus poles of a meromorphic function inside a curve is the winding number of its image, . See functional analysis and complex analysis.
Algebra— The Lefschetz number
Brouwer's theorem is a special case of the Lefschetz fixed-point theorem: for a map of a compact triangulable space , if the Lefschetz number is non-zero, then has a fixed point. For the disc only survives and . For the identity of a closed manifold, , and for a smooth with non-degenerate fixed points, is the signed count of fixed points. Applied to the time- flow of a vector field (homotopic to the identity, with fixed points exactly the zeros of for small ), this recovers Poincaré–Hopf. Linear algebra (traces on homology) computes a geometric count.
Combinatorics— Sperner's lemma and the game of Hex
Brouwer's theorem has a purely combinatorial core. Sperner's lemma (1928): colour the vertices of a triangulation of a triangle with three colours so that the corners get different colours and each edge uses only the colours of its endpoints; then some small triangle has all three colours — in fact an odd number of them, by a parity argument like crossings_parity. Taking finer triangulations and a limit proves the two-dimensional Brouwer theorem. David Gale (1979) showed that the fact that a game of Hex cannot end in a draw is equivalent to the two-dimensional Brouwer theorem. These parity proofs also show why computing an approximate fixed point is hard in general: it is the prototypical problem of the complexity class PPAD (Papadimitriou, 1994), which also contains computing a Nash equilibrium — whose existence Nash proved with Brouwer's and Kakutani's theorems.
Physics— Defects, vortices and calm points
In physics, the index is a topological charge. The order parameter of a planar ferromagnet or a liquid crystal film is a field of directions; an isolated defect has a winding number that cannot change under small continuous deformations, so defects can only disappear by meeting defects of opposite charge. On a sphere-shaped object the charges must add up to : the arrangement of whorls in some liquid-crystal droplets, and the two "calm points" of an idealised global wind field, are physical shadows of Poincaré–Hopf. Such arguments are as good as the continuum model behind them; real wind is not a continuous vector field at every scale.
History and global context
- Indices and fixed points. Henri Poincaré introduced the index of a singular point of a vector field on a surface in his memoirs on curves defined by differential equations (1881–1885), and proved the surface case of the index theorem. Piers Bohl in Riga proved a result equivalent to the Brouwer theorem in 1904, and Jacques Hadamard gave a proof in 1910.
- Degree. L. E. J. Brouwer, in Amsterdam, defined the degree of a map and proved invariance of dimension and the fixed-point theorem for the -ball around 1910–1912. Heinz Hopf proved the index theorem in all dimensions and the classification of maps into spheres by degree (both published in 1927).
- Regular values and transversality. Anthony Morse (1939) and Arthur Sard (1942) proved the measure-zero theorem for critical values. Hassler Whitney laid the foundations of smooth manifolds and their embeddings in the 1930s. René Thom introduced transversality and cobordism (1954), and Lev Pontryagin, in Moscow, framed cobordism; Thom received the Fields Medal in 1958.
- Morse theory and exotic structures. Marston Morse developed his theory of critical points from the 1920s, with applications to geodesics. John Milnor's discovery of exotic -spheres (1956) and Stephen Smale's h-cobordism theorem (1961), which proved the Poincaré conjecture in dimensions , showed the power of these methods; both received the Fields Medal. In the 1980s Michael Freedman's topological classification of simply connected -manifolds and Simon Donaldson's gauge-theoretic constraints on smooth ones revealed the exotic s.
Further reading
- John Milnor, Topology from the Differentiable Viewpoint (1965) — sixty pages that cover Sard, degree, Brouwer, the hairy ball and Poincaré–Hopf; the model for this lesson.
- Victor Guillemin and Alan Pollack, Differential Topology (1974) — transversality, intersection theory and Lefschetz numbers, with many exercises.
- Morris W. Hirsch, Differential Topology (1976) — a thorough graduate text, including transversality, tubular neighbourhoods and Morse theory.
- John Milnor, Morse Theory (1963) — the classic introduction, with the application to geodesics.
- John M. Lee, Introduction to Smooth Manifolds (2nd edition, 2013) — Chapter 6 for Sard's theorem and transversality.