Skip to content
The Lumenary
First-year graduateGraduate 140 min

Differential topology

Count the solutions of f(x)=yf(x) = y with signs, and the answer refuses to change — the idea behind Brouwer's fixed points, the hairy ball and the Poincaré–Hopf theorem.

Formally verified · 14 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review
MotivationH

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 f:M→Nf : M \to N between manifolds of the same dimension, count the solutions of f(x)=yf(x) = y, with a sign telling whether ff preserves or reverses orientation near xx. For a generic yy the count is finite, and — this is the miracle — it does not depend on yy, nor on deforming ff. 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.

IntuitionH

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 22. But the extra two passes go in opposite directions, so if we count forward passes as +1+1 and backward ones as −1-1, the signed count is still 33.

y
Part of the graph of a map that folds back. The level $y$ is met three times; the middle crossing (the differently coloured dot) runs backwards, so the signed count is $1 - 1 + 1 = 1$ — the same as for a level above the peak or below the valley, which is met only once. The unsigned count jumps only at the critical values, the heights of the peak and the valley.

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.

DefinitionsH

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 f:M→Nf : M \to N be smooth. A point x∈Mx \in M is critical if dfx:TxM→Tf(x)Ndf_x : T_xM \to T_{f(x)}N is not surjective; its image f(x)f(x) is a critical value. Every other point of NN — including every point not in the image — is a regular value. A subset A⊆NA \subseteq N has measure zero if φ(A∩U)\varphi(A \cap U) has Lebesgue measure zero for every chart (U,φ)(U, \varphi); this is well defined because diffeomorphisms of open subsets of Rn\R^n preserve null sets.

Definition— degree

Let f:M→Nf : M \to N be smooth, with MM closed, NN connected and dim⁡M=dim⁡N=n\dim M = \dim N = n. For a regular value yy, the preimage f−1(y)f^{-1}(y) is finite (it is compact, and discrete by the inverse function theorem). The mod 2 degree is deg⁡2f=#f−1(y) mod 2\deg_2 f = \# f^{-1}(y) \bmod 2. If MM and NN are oriented, each x∈f−1(y)x \in f^{-1}(y) has a sign sign⁡dfx=±1\operatorname{sign} df_x = \pm 1 according as the isomorphism dfxdf_x preserves or reverses orientation, and the degree is

deg⁡f=∑x∈f−1(y)sign⁡dfx∈Z.\deg f = \sum_{x \in f^{-1}(y)} \operatorname{sign} df_x \in \Z .

That these numbers do not depend on yy is Theorem 3 below.

Definition— index of a zero of a vector field

Let vv be a vector field with an isolated zero at pp. In a chart centred at pp, vv becomes a map Rn⊇U→Rn\R^n \supseteq U \to \R^n with v(0)=0v(0) = 0 and no other zeros in a small ball BεB_\varepsilon. The index ind⁡p(v)\operatorname{ind}_p(v) is the degree of u↦v(u)/∣v(u)∣u \mapsto v(u)/|v(u)| from the sphere ∂Bε\partial B_\varepsilon to Sn−1S^{n-1}. It does not depend on ε\varepsilon or on the chart. In the plane it is the number of times vv turns round as one walks once anticlockwise round pp.

Definition— transversality

A smooth map f:X→Yf : X \to Y is transverse to a submanifold Z⊆YZ \subseteq Y if im⁡dfx+Tf(x)Z=Tf(x)Y\operatorname{im} df_x + T_{f(x)}Z = T_{f(x)}Y whenever f(x)∈Zf(x) \in Z. Two submanifolds are transverse if the inclusion of one is transverse to the other. A regular value is the special case Z={y}Z = \{y\}.

Definition— Morse function

A critical point pp of h:M→Rh : M \to \R is non-degenerate if the Hessian of hh at pp (in any chart) is invertible; its Morse index λ\lambda is the number of negative eigenvalues. hh is a Morse function if all its critical points are non-degenerate.

Worked examplesH

Examples

Example— Degrees of maps of circles and spheres

  • z↦zkz \mapsto z^k on S1⊂CS^1 \subset \C has degree kk: for k>0k > 0 each ww has kk preimages, all orientation-preserving; for k<0k < 0 all ∣k∣|k| preimages reverse orientation. The degree of a map S1→S1S^1 \to S^1 is its winding number.
  • Complex conjugation z↦zˉz \mapsto \bar z has degree −1-1.
  • The antipodal map a(x)=−xa(x) = -x of SnS^n is the restriction of −I-I on Rn+1\R^{n+1}; it sends the outward normal at xx to the outward normal at −x-x, so it preserves the orientation of SnS^n exactly when det⁡(−I)=(−1)n+1>0\det(-I) = (-1)^{n+1} > 0. Hence deg⁡a=(−1)n+1\deg a = (-1)^{n+1}.
  • A constant map, or any map that is not onto, has degree 00 (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 pp of degree dd extends to the Riemann sphere C∪{∞}\C \cup \{\infty\} with p(∞)=∞p(\infty) = \infty. Being holomorphic, it preserves orientation at every regular point (its Jacobian determinant is ∣p′(z)∣2>0|p'(z)|^2 > 0), so its degree is dd, the number of solutions of p(z)=wp(z) = w for a regular value ww. In particular every ww 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 v(z)v(z).

fieldpictureindex
v=zv = zsource+1+1
v=−zv = -zsink+1+1
v=izv = izcentre (rotation)+1+1
v=zˉv = \bar zsaddle−1-1
v=zkv = z^kk−1k-1 "petals"kk
v=zˉkv = \bar z^k−k-k

A source and a sink both have index +1+1: the index sees how the arrow turns, not whether the flow goes in or out. For a linear field v(x)=Axv(x) = Ax with det⁡A≠0\det A \ne 0, the index is sign⁡det⁡A\operatorname{sign}\det A. In particular the gradient of h=−x12−⋯−xλ2+xλ+12+⋯+xn2h = -x_1^2 - \dots - x_\lambda^2 + x_{\lambda+1}^2 + \dots + x_n^2 has index (−1)λ(-1)^\lambda at 00.

Example— Vector fields on the sphere and the torus

On S2S^2, the rotation field (−y,x,0)(-y, x, 0) vanishes at the two poles, each of index +1+1; the gradient of the height function zz (projected onto the sphere) has a source at the south pole and a sink at the north pole, again +1+1=2+1 + 1 = 2. On the torus, the field ∂θ\partial_\theta along the parallels vanishes nowhere: total index 00. The gradient of the height of an upright torus has a maximum, a minimum and two saddles: +1−1−1+1=0+1 - 1 - 1 + 1 = 0. In every case the total is the Euler characteristic.

Example— Critical values that cannot be avoided

f(x)=x2f(x) = x^2 on R\R has the single critical point 00 and the critical value 00. 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 R→R\R \to \R 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.)

ProofH

Sard's theorem

Theorem— Theorem 1 (Sard, 1942)

For every smooth map f:M→Nf : M \to N, the set of critical values has measure zero in NN. 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 ff of class CkC^k with k≥max⁡(1,dim⁡M−dim⁡N+1)k \ge \max(1, \dim M - \dim N + 1). Degree theory only needs the case of equal dimensions, which has a short complete proof.

Theorem— Theorem 2 (Sard in equal dimensions)

Let U⊆RnU \subseteq \R^n be open, f:U→Rnf : U \to \R^n of class C1C^1, and C={x∈U:det⁡Df(x)=0}C = \{x \in U : \det Df(x) = 0\}. Then f(C)f(C) has Lebesgue measure zero.

Proof

UU is a countable union of closed cubes, and a countable union of null sets is null, so it suffices to show that f(C∩Q)f(C \cap Q) is null for a closed cube Q⊆UQ \subseteq U of side ℓ\ell. Let M=max⁡Q∥Df∥M = \max_Q \|Df\|. Since DfDf is uniformly continuous on QQ, there is a function ε(η)→0\varepsilon(\eta) \to 0 as η→0\eta \to 0 with ∥Df(y)−Df(x)∥≤ε(η)\|Df(y) - Df(x)\| \le \varepsilon(\eta) whenever x,y∈Qx, y \in Q, ∣x−y∣≤η|x - y| \le \eta. By the mean value inequality applied to y↦f(y)−Df(x)(y−x)y \mapsto f(y) - Df(x)(y - x) on the segment [x,y]⊆Q[x, y] \subseteq Q,

∣f(y)−f(x)−Df(x)(y−x)∣≤ε(η) ∣y−x∣(∣y−x∣≤η).\big| f(y) - f(x) - Df(x)(y - x) \big| \le \varepsilon(\eta)\, |y - x| \qquad (|y - x| \le \eta).

Divide QQ into NnN^n subcubes of side ℓ/N\ell/N and diameter η=n ℓ/N\eta = \sqrt n\, \ell / N. Suppose a subcube Q′Q' contains a critical point xx. For y∈Q′y \in Q', the point f(x)+Df(x)(y−x)f(x) + Df(x)(y - x) lies in the affine subspace f(x)+im⁡Df(x)f(x) + \operatorname{im} Df(x), of dimension at most n−1n - 1, within distance MηM\eta of f(x)f(x); and f(y)f(y) lies within ε(η)η\varepsilon(\eta)\eta of it. Choosing orthonormal coordinates in which a hyperplane containing im⁡Df(x)\operatorname{im}Df(x) is {yn=0}\{y_n = 0\}, we see that f(Q′)f(Q') lies in a box with n−1n - 1 sides of length 2(M+ε(η))η2(M + \varepsilon(\eta))\eta and one side of length 2ε(η)η2\varepsilon(\eta)\eta. So

vol⁡f(Q′)≤2n(M+ε(η))n−1ε(η) ηn.\operatorname{vol} f(Q') \le 2^n \big(M + \varepsilon(\eta)\big)^{n-1} \varepsilon(\eta)\, \eta^n .

There are at most NnN^n such subcubes and Nnηn=(n ℓ)nN^n \eta^n = (\sqrt n\, \ell)^n, so the outer measure of f(C∩Q)f(C \cap Q) is at most 2n(M+ε(η))n−1ε(η)(n ℓ)n2^n (M + \varepsilon(\eta))^{n-1} \varepsilon(\eta) (\sqrt n\,\ell)^n, which tends to 00 as N→∞N \to \infty. ∎

∎

For manifolds of the same dimension, apply Theorem 2 in countably many charts. Mathlib proves an even stronger version — differentiability suffices, no continuity of DfDf is needed — and we cite it in the formal section.

ProofH

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 11-manifold with boundary is diffeomorphic to a circle or to a closed interval. Hence a compact 11-manifold with boundary has an even number of boundary points; if it is oriented, its boundary points (with their Stokes signs) sum to 00.

We also use the regular value theorem for manifolds with boundary: if yy is a regular value of F:W→NF : W \to N and of F∣∂WF|_{\partial W}, then F−1(y)F^{-1}(y) is a manifold with boundary F−1(y)∩∂WF^{-1}(y) \cap \partial W, of dimension dim⁡W−dim⁡N\dim W - \dim N.

Theorem— Theorem 3 (invariance of the degree)

Let MM be closed, NN connected, dim⁡M=dim⁡N\dim M = \dim N. Then (a) #f−1(y) mod 2\#f^{-1}(y) \bmod 2 is the same for all regular values yy of ff; (b) homotopic maps have the same mod 2 degree. If MM and NN are oriented, the same holds for the signed count deg⁡f\deg f.

Proof

Local constancy. If yy is regular with f−1(y)={x1,…,xk}f^{-1}(y) = \{x_1, \dots, x_k\}, the inverse function theorem gives disjoint neighbourhoods Ui∋xiU_i \ni x_i mapped diffeomorphically onto a common neighbourhood VV of yy; shrinking VV to avoid the compact set f(M∖⋃Ui)f(M \setminus \bigcup U_i), every y′∈Vy' \in V is regular with exactly kk preimages, of the same signs.

Homotopy invariance (b). Let F:M×[0,1]→NF : M \times [0, 1] \to N be a smooth homotopy from ff to gg, and let yy be a regular value of ff and gg. By local constancy and Sard's theorem we may replace yy by a nearby value zz that is regular for FF too, without changing the counts for ff and gg. Then F−1(z)F^{-1}(z) is a compact 11-manifold with boundary

F−1(z)∩(M×{0,1})=f−1(z)×{0}  ⊔  g−1(z)×{1}.F^{-1}(z) \cap \big(M \times \{0, 1\}\big) = f^{-1}(z) \times \{0\} \;\sqcup\; g^{-1}(z) \times \{1\}.

By the Fact the number of boundary points is even, so #f−1(z)≡#g−1(z)(mod2)\#f^{-1}(z) \equiv \#g^{-1}(z) \pmod 2. With orientations, an arc of F−1(z)F^{-1}(z) joining two points of f−1(z)f^{-1}(z) joins points of opposite sign, an arc joining f−1(z)f^{-1}(z) to g−1(z)g^{-1}(z) joins points of the same sign, and so the signed counts agree (Milnor, §5, checks the sign conventions).

Independence of yy (a). For regular values y,zy, z of ff there is a diffeomorphism h:N→Nh : N \to N, smoothly isotopic to the identity, with h(y)=zh(y) = z (the homogeneity lemma: move points along flows of compactly supported vector fields, and use connectedness of NN). Then h∘f≃fh \circ f \simeq f, and (h∘f)−1(z)=f−1(y)(h \circ f)^{-1}(z) = f^{-1}(y), with the same signs since hh preserves orientation. By (b), #f−1(y)=#(h∘f)−1(z)≡#f−1(z)\#f^{-1}(y) = \#(h\circ f)^{-1}(z) \equiv \#f^{-1}(z), and likewise for signed counts. ∎

∎

Theorem— Corollary 4 (properties of the degree)

deg⁡(g∘f)=deg⁡g⋅deg⁡f\deg(g \circ f) = \deg g \cdot \deg f; a diffeomorphism has degree ±1\pm 1; a map of non-zero degree is surjective; and if M=∂WM = \partial W for a compact oriented WW and ff extends to a smooth F:W→NF : W \to N, then deg⁡f=0\deg f = 0.

The last statement is proved like (b): for yy regular for FF and ff, the preimage F−1(y)F^{-1}(y) is a compact oriented 11-manifold with boundary f−1(y)f^{-1}(y), so the signs sum to 00.

ProofH

Brouwer's fixed-point theorem and the hairy ball theorem

Theorem— Theorem 5 (no retraction)

There is no smooth map r:D‾n→Sn−1r : \overline{D}{}^n \to S^{n-1} with r(x)=xr(x) = x for all x∈Sn−1x \in S^{n-1}.

Proof

(M. Hirsch.) Suppose rr exists. By Sard's theorem it has a regular value y∈Sn−1y \in S^{n-1}; yy is also regular for r∣Sn−1=idr|_{S^{n-1}} = \mathrm{id}. So r−1(y)r^{-1}(y) is a compact 11-manifold with boundary r−1(y)∩Sn−1={y}r^{-1}(y) \cap S^{n-1} = \{y\} — a single point. This contradicts the Fact. ∎

∎

Theorem— Theorem 6 (Brouwer's fixed-point theorem)

Every continuous map f:D‾n→D‾nf : \overline{D}{}^n \to \overline{D}{}^n has a fixed point.

Proof

Smooth case. Suppose ff is smooth with f(x)≠xf(x) \ne x for all xx. Let u(x)=x−f(x)≠0u(x) = x - f(x) \ne 0 and send xx along the ray from f(x)f(x) through xx until it meets the sphere: r(x)=x+t(x) u(x)r(x) = x + t(x)\,u(x), where t(x)≥0t(x) \ge 0 solves ∣x+tu∣2=1|x + t u|^2 = 1, that is

t(x)=−⟨x,u⟩+⟨x,u⟩2+∣u∣2(1−∣x∣2)∣u∣2.t(x) = \frac{-\langle x, u\rangle + \sqrt{\langle x, u\rangle^2 + |u|^2 (1 - |x|^2)}}{|u|^2}.

The discriminant is positive on the disc: for ∣x∣<1|x| < 1 because ∣u∣2(1−∣x∣2)>0|u|^2(1 - |x|^2) > 0, and for ∣x∣=1|x| = 1 because ⟨x,u⟩=1−⟨x,f(x)⟩>0\langle x, u\rangle = 1 - \langle x, f(x)\rangle > 0, by Cauchy–Schwarz and f(x)≠xf(x) \ne x. So tt is smooth, and for ∣x∣=1|x| = 1 it gives t=0t = 0, r(x)=xr(x) = x. Thus rr is a smooth retraction, contradicting Theorem 5.

Continuous case. If a continuous ff has no fixed point, then ∣f(x)−x∣≥μ>0|f(x) - x| \ge \mu > 0 on the compact disc. By the Weierstrass approximation theorem there is a polynomial map PP with ∣P−f∣<μ/2|P - f| < \mu/2 on the disc. Then P1=P/(1+μ/2)P_1 = P/(1 + \mu/2) maps the disc into itself, ∣P1−f∣<μ|P_1 - f| < \mu, and so P1P_1 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 Rn\R^n (translate it). It says nothing about how many fixed points there are, or how to find one.

Theorem— Theorem 7 (hairy ball theorem)

SnS^n has a continuous tangent vector field without zeros if and only if nn is odd.

Proof

If n=2m−1n = 2m - 1 is odd, regard Sn⊂CmS^n \subset \C^m and let v(z)=izv(z) = iz, i.e. (x1,y1,…,xm,ym)↦(−y1,x1,…,−ym,xm)(x_1, y_1, \dots, x_m, y_m) \mapsto (-y_1, x_1, \dots, -y_m, x_m). Then ⟨z,v(z)⟩=0\langle z, v(z)\rangle = 0 and ∣v(z)∣=∣z∣=1|v(z)| = |z| = 1.

Conversely, suppose vv is a nowhere-zero tangent field on SnS^n. 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 11 (divide by ∣v∣|v|). Then

F(x,t)=cos⁡(πt) x+sin⁡(πt) v(x)F(x, t) = \cos(\pi t)\, x + \sin(\pi t)\, v(x)

is a unit vector, since x⊥v(x)x \perp v(x), so FF is a homotopy on SnS^n from F0=idF_0 = \mathrm{id} to F1=aF_1 = a, the antipodal map. By Theorem 3, 1=deg⁡id=deg⁡a=(−1)n+11 = \deg \mathrm{id} = \deg a = (-1)^{n+1}, so nn is odd. ∎

∎

On the round Earth (n=2n = 2) every continuous horizontal wind field has a calm point — a statement about an idealised continuous model, but a theorem about that model.

ProofH

The Poincaré–Hopf theorem and Morse theory

Theorem— Theorem 8 (Poincaré–Hopf)

Let MM be a closed manifold and vv a smooth vector field on MM with only isolated zeros p1,…,pkp_1, \dots, p_k. Then

∑i=1kind⁡pi(v)=χ(M),\sum_{i=1}^k \operatorname{ind}_{p_i}(v) = \chi(M),

the Euler characteristic of MM (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 vv. Embed MM in RN\R^N and take a closed tubular neighbourhood TT of MM. Extend vv to a vector field ww on TT that points outward along ∂T\partial T and has the same zeros, with the same indices. On the compact manifold with boundary TT minus small balls round the zeros, w/∣w∣w/|w| is defined; by Corollary 4, the degree of w/∣w∣w/|w| on ∂T\partial T equals the sum of the degrees on the small spheres, which is ∑ind⁡(v)\sum \operatorname{ind}(v). But on ∂T\partial T, w/∣w∣w/|w| is homotopic to the outward unit normal (the Gauss map of ∂T\partial T), which does not involve vv. Step 2: compute it for one field. Take a triangulation of MM 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 kk-simplex the flow is attracting in the kk directions of the simplex and repelling in the n−kn - k others, so the index is (−1)k(-1)^k, so the sum is ∑k(−1)k#{k-simplices}=χ(M)\sum_k (-1)^k \#\{k\text{-simplices}\} = \chi(M). Alternatively, use the gradient of a Morse function, as below. □\square

Consequences:

  • The hairy ball theorem again: χ(S2)=2≠0\chi(S^2) = 2 \ne 0, so every vector field on S2S^2 vanishes somewhere. The torus and the Klein bottle (χ=0\chi = 0) carry nowhere-zero fields; a surface of genus g≥2g \ge 2 does not.
  • Hopf's converse (stated): a closed connected manifold has a nowhere-zero vector field if and only if χ(M)=0\chi(M) = 0. Every closed odd-dimensional manifold has χ=0\chi = 0 (by Poincaré duality), so it has one.
  • Morse theory. If hh is a Morse function, its gradient (for any metric) has a zero of index (−1)λ(-1)^\lambda at each critical point of Morse index λ\lambda (from the normal form h=h(p)−x12−⋯−xλ2+xλ+12+⋯+xn2h = h(p) - x_1^2 - \dots - x_\lambda^2 + x_{\lambda+1}^2 + \dots + x_n^2, the Morse lemma). So ∑λ(−1)λcλ=χ(M)\sum_\lambda (-1)^\lambda c_\lambda = \chi(M), where cλc_\lambda is the number of critical points of index λ\lambda. For the upright torus, 1−2+1=01 - 2 + 1 = 0. Morse proved more: MM has a cell decomposition with one λ\lambda-cell for each critical point of index λ\lambda, which gives the Morse inequalities cλ≥bλc_\lambda \ge b_\lambda (the Betti numbers).

Transversality. Regular values generalise to transversality, and Sard's theorem to Thom's transversality theorem: if F:X×S→YF : X \times S \to Y is smooth and transverse to ZZ, then Fs=F(⋅,s)F_s = F(\cdot, s) is transverse to ZZ for almost every ss. Hence any map can be perturbed to be transverse to a given submanifold. For XX compact with dim⁡X+dim⁡Z=dim⁡Y\dim X + \dim Z = \dim Y, the number of points of Fs−1(Z)F_s^{-1}(Z) 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 00.

Formal mathematicsF

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_equidimensionalLean 4Applies a library theoremFormally verified
/-- **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
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
critical_values_nullLean 4Proved here from basic factsFormally verified
/-- **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 => hx
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor

Degree theory, the Brouwer theorem in dimension ≥2\ge 2, the hairy ball theorem and Poincaré–Hopf are not yet in Mathlib (they need either homology or the classification of 11-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 z↦izz \mapsto iz on Cn=R2n\C^n = \R^{2n} is tangent to every sphere and has length ∣z∣|z|:

dotLean 4Formally verified
/-- 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)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
hopfFieldLean 4Formally verified
/-- 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
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
hopfField_tangentLean 4Proved here from basic factsFormally verified
/-- 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
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
hopfField_lengthLean 4Proved here from basic factsFormally verified
/-- 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 _
  ring
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor

Next, 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 (−1)n+1(-1)^{n+1}, which is −1-1 on even-dimensional spheres:

rotation_homotopyLean 4Proved here from basic factsFormally verified
/-- **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]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
antipodal_detLean 4Proved here from basic factsFormally verified
/-- 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]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
antipodal_det_evenLean 4Proved here from basic factsFormally verified
/-- 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]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor

In dimension one, the whole argument of Theorems 5 and 6 can be formalised: the "1-manifold" r−1(y)r^{-1}(y) is replaced by the intermediate value theorem, and the retraction is r(x)=(x−f(x))/∣x−f(x)∣r(x) = (x - f(x))/|x - f(x)|:

no_retraction_intervalLean 4Proved here from basic factsFormally verified
/-- **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
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
brouwer_intervalLean 4Proved here from basic factsFormally verified
/-- **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']
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor

Finally, the combinatorial heart of Theorem 3(a) in one dimension. Sample a function at 0,1,…,N0, 1, \dots, N and count how often the samples cross a level cc: the count depends on cc, but its parity depends only on which side of cc the two ends lie — preimages appear and disappear in pairs:

crossingsLean 4Formally verified
/-- 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
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
crossings_parityLean 4Proved here from basic factsFormally verified
/-- **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
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor
odd_crossingsLean 4Proved here from basic factsFormally verified
/-- 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]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/DifferentialTopology.leanTry it in the Lean web editor

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.

ComputationC

Counting preimages and indices

The first program takes a degree-33 map of the circle with two folds, F(t)=3t+4sin⁡2tF(t) = 3t + 4\sin 2t, and finds all preimages of several values. Their number is 55 or 77, depending on the value; the count with the signs of F′F' is always 33. It also lists the four critical values. Then it counts preimages for maps of the Riemann sphere: z3−3zz^3 - 3z has three preimages of every value except the critical values ±2\pm 2, all counted +1+1, and zˉ3\bar z^3 has degree −3-3.

Counting preimages with and without signsPythonNumerical approximationComputationally tested
"""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()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The second program computes indices as winding numbers round small circles, then checks Poincaré–Hopf on the sphere (using the two charts zz and w=1/zw = 1/z, in which a field V(z)V(z) becomes W(w)=−w2V(1/w)W(w) = -w^2 V(1/w)) and on the torus. For instance the constant field V=1V = 1 has no zeros in the zz-chart but a zero of index 22 at the north pole: the sum is still 2=χ(S2)2 = \chi(S^2).

Indices of vector fields and the Poincare-Hopf theoremPythonNumerical approximationComputationally tested
"""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()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Both are numerical evidence about finitely many maps and fields. The theorems, proved or sketched above, say why the signed counts never change.

Explore

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 −1-1); for the "dipole" v=z2v = z^2, the field of the complex function z2z^2, it turns twice anticlockwise (index 22). Move the loop so that it does not enclose the zero: the index drops to 00. 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.

Examples

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.

Examples

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

Exercises

1. Differential topology

Warm-upHuman

What is the degree of the map f(z)=zˉ 4f(z) = \bar z^{\,4} from the unit circle S1⊂CS^1 \subset \C to itself?

2. Differential topology

Warm-upHuman

Find the index at the origin of the planar vector field v(x,y)=(x2−y2, −2xy)v(x, y) = (x^2 - y^2, \, -2xy).

3. Differential topology

CoreHuman

Which of these closed manifolds admit a smooth vector field with no zeros? (Choose all that apply.)

Choose all that apply

4. Differential topology

CoreHuman

Let h:T2→Rh : T^2 \to \R be the height function of an upright torus. Which statement is correct?

Choose one

5. Differential topology

CoreHuman

The rotation of the annulus A={1≤∣z∣≤2}A = \{1 \le |z| \le 2\} by the angle π\pi is continuous and has no fixed point. Which hypothesis of the Brouwer fixed-point theorem does it violate?

Choose one

6. Differential topology

CoreHuman

In the proof of the hairy ball theorem we use the homotopy F(x,t)=cos⁡(πt) x+sin⁡(πt) v(x)F(x, t) = \cos(\pi t)\, x + \sin(\pi t)\, v(x) from the identity to the antipodal map. Why does the proof need v(x)v(x) to be a unit tangent vector at every point?

Choose one

7. Differential topology

CoreHuman

A closed orientable surface of genus 22 stands upright, and hh 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

StretchFormal

The 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?

Choose one

9. Differential topology

StretchComputational

The degree of a map S1→S1S^1 \to S^1, and the index of a planar zero, are winding numbers. Write winding(points): given a list of non-zero complex numbers w0,w1,…,wn−1w_0, w_1, \dots, w_{n-1} sampled along a closed curve (with wn=w0w_n = w_0), return the number of times the curve winds anticlockwise round 00, by adding up the changes of argument (each reduced to the range (−π,π](-\pi, \pi]) and dividing by 2π2\pi. Round to the nearest integer.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

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. x↦x2x \mapsto x^2 has the critical value 00; a height function on a torus has four; a smooth function on R\R 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 S7S^7; Kervaire and Milnor showed there are exactly 2828 oriented diffeomorphism classes of smooth structures on the topological 77-sphere. In dimension 44 the gap is wider still: R4\R^4 carries uncountably many pairwise non-diffeomorphic smooth structures, while Rn\R^n for n≠4n \ne 4 carries only one. In dimensions ≤3\le 3 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 55 and 77 for a map of degree 33) and is infinite above a critical value of a constant map. For holomorphic maps all signs are +1+1, which is why the confusion is harmless in complex analysis.

Misconception

"Every surface is hairy." Only those with χ≠0\chi \ne 0. The torus and the Klein bottle carry nowhere-vanishing vector fields; so does every odd-dimensional sphere. The hairy ball theorem is about S2S^2 (and even-dimensional spheres), and Poincaré–Hopf explains which manifolds are hairy.

Misconception

"The index of a zero is always ±1\pm 1." That is true for non-degenerate zeros (where dvpdv_p is invertible), but degenerate zeros can have any index: zkz^k has index kk, and zˉk\bar z^k has index −k-k. Perturbing a degenerate zero splits it into non-degenerate ones whose indices add up to the original index.

ViewpointsH

Many ways of seeing

Topology— Degree is homology

For closed connected oriented nn-manifolds, Hn(M;Z)≅ZH_n(M; \Z) \cong \Z, generated by the fundamental class [M][M], and a map ff induces f∗[M]=(deg⁡f)[N]f_*[M] = (\deg f)[N]. The degree is thus the effect of ff on top homology, and Theorem 3 becomes the homotopy invariance of homology. Hopf's theorem (1927) completes the picture: two maps M→SnM \to S^n from a closed connected oriented nn-manifold are homotopic if and only if they have the same degree, so πn(Sn)≅Z\pi_n(S^n) \cong \Z. 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 S⊂R3S \subset \R^3, the Gauss map ν:S→S2\nu : S \to S^2 has Jacobian determinant equal to the Gaussian curvature KK, so ∫SK dA=area⁡(S2)⋅deg⁡ν=4πdeg⁡ν\int_S K\, dA = \operatorname{area}(S^2) \cdot \deg \nu = 4\pi \deg \nu. Step 1 of the proof of Poincaré–Hopf identifies 2deg⁡ν2\deg\nu with χ(S)\chi(S) (here TT is a thickening of SS and ∂T\partial T is two copies of SS), giving the Gauss–Bonnet theorem ∫SK dA=2πχ(S)\int_S K\, dA = 2\pi\chi(S). Chern's intrinsic proof runs the argument in reverse, through a vector field on SS; 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, 12πi∮f′/f dz\frac{1}{2\pi i}\oint f'/f\, dz. 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 ff of a compact triangulable space XX, if the Lefschetz number L(f)=∑k(−1)ktr⁡(f∗:Hk(X;Q)→Hk(X;Q))L(f) = \sum_k (-1)^k \operatorname{tr}\big(f_* : H_k(X; \Q) \to H_k(X; \Q)\big) is non-zero, then ff has a fixed point. For the disc only H0H_0 survives and L(f)=1L(f) = 1. For the identity of a closed manifold, L(id)=χ(M)L(\mathrm{id}) = \chi(M), and for a smooth ff with non-degenerate fixed points, L(f)L(f) is the signed count of fixed points. Applied to the time-ε\varepsilon flow of a vector field vv (homotopic to the identity, with fixed points exactly the zeros of vv for small ε\varepsilon), 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 χ(S2)=2\chi(S^2) = 2: 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 & global context

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 nn-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 77-spheres (1956) and Stephen Smale's h-cobordism theorem (1961), which proved the Poincaré conjecture in dimensions ≥5\ge 5, showed the power of these methods; both received the Fields Medal. In the 1980s Michael Freedman's topological classification of simply connected 44-manifolds and Simon Donaldson's gauge-theoretic constraints on smooth ones revealed the exotic R4\R^4s.
Further reading

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.