Skip to content
The Lumenary
First-year graduateGraduate 150 min

Homological algebra

Cycles modulo boundaries, long exact sequences, and the derived functors Ext and Tor — exact measurements of how far Hom and ⊗ are from being exact.

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

Measuring what exactness loses

Homological algebra began in topology. To detect the "holes" of a space, Poincaré counted closed loops and surfaces (cycles) that do not bound anything, treating those that bound (boundaries) as trivial. Algebraically this is a sequence of groups and maps ⋯→C2→d2C1→d1C0→0\cdots \to C_2 \xrightarrow{d_2} C_1 \xrightarrow{d_1} C_0 \to 0 with d∘d=0d \circ d = 0 — "the boundary of a boundary is empty" — and the invariant is the quotient ker⁡d/im⁡d\ker d / \operatorname{im} d, the homology.

The same structure appears throughout algebra, for a different reason. The functors HomR(M,−)\Hom_R(M, -), HomR(−,N)\Hom_R(-, N) and −⊗RN- \otimes_R N are not exact: they turn some short exact sequences into sequences that are exact only at one end (see modules). Homological algebra measures the failure precisely. Each such functor FF comes with a sequence of derived functors — Extn\mathrm{Ext}^n for Hom\Hom, Torn\mathrm{Tor}_n for ⊗\otimes — that repair the lost exactness in a long exact sequence. These groups answer concrete questions:

  • Ext1(A,B)\mathrm{Ext}^1(A, B) classifies the ways of building a module EE with submodule BB and quotient AA;
  • Tor1Z(A,Z/n)\mathrm{Tor}_1^\Z(A, \Z/n) is the nn-torsion of AA — hence the name;
  • the homology of RP2\R P^2 with coefficients in F2\mathbb{F}_2 differs from that with coefficients in Q\Q, by an amount computed by Tor\mathrm{Tor}.

This lesson assumes modules, exact sequences and functors. The snake lemma is proved in abelian categories; here we use it. Everything works in any abelian category with enough projectives (or injectives); for concreteness we work with modules over a ring RR.

IntuitionH

Cycles, boundaries and resolutions

Take the boundary of a triangle: vertices u,v,wu, v, w and oriented edges [uv],[vw],[uw][uv], [vw], [uw]. Let C1=Z3C_1 = \Z^3 (edges) and C0=Z3C_0 = \Z^3 (vertices), with d([uv])=v−ud([uv]) = v - u. The chain z=[uv]+[vw]−[uw]z = [uv] + [vw] - [uw] goes once around the triangle and has d(z)=0d(z) = 0: it is a cycle. With no 2-cell to fill the triangle, it is not a boundary, and H1=ker⁡d1=ZzH_1 = \ker d_1 = \Z z detects the hole. Fill the triangle with a 2-cell FF, d2(F)=zd_2(F) = z, and H1H_1 becomes 00.

The same quotient measures failure of exactness. A sequence A→B→CA \to B \to C with composite 00 is exact exactly when its homology ker⁡/im⁡\ker / \operatorname{im} vanishes. To measure how far a functor FF is from exact, homological algebra replaces a module MM by a projective resolution ⋯→P1→P0→M→0\cdots \to P_1 \to P_0 \to M \to 0 — an exact sequence of projective (for instance free) modules: generators, relations among the generators, relations among the relations, and so on. The resolution is a complex with homology only MM in degree 00. Apply FF to the PiP_i and take homology: if FF were exact, the result would again be just F(M)F(M) in degree 00; the higher homology groups LnF(M)L_nF(M) measure exactly what FF fails to preserve. The comparison theorem below says the answer does not depend on which resolution we chose.

DefinitionsH

Definitions

Definition— chain complex, homology

A chain complex C∙C_\bullet is a sequence of modules and homomorphisms ⋯→Cn+1→dn+1Cn→dnCn−1→⋯\cdots \to C_{n+1} \xrightarrow{d_{n+1}} C_n \xrightarrow{d_n} C_{n-1} \to \cdots with dn∘dn+1=0d_n \circ d_{n+1} = 0 for all nn. Its cycles are Zn=ker⁡dnZ_n = \ker d_n, its boundaries Bn=im⁡dn+1⊆ZnB_n = \operatorname{im} d_{n+1} \subseteq Z_n, and its homology is Hn(C)=Zn/BnH_n(C) = Z_n / B_n. A cochain complex has differentials raising the degree, dn:Cn→Cn+1d^n : C^n \to C^{n+1}, and cohomology Hn=ker⁡dn/im⁡dn−1H^n = \ker d^n / \operatorname{im} d^{n-1}. A complex is exact (acyclic) if all its homology vanishes.

Definition— chain map, quasi-isomorphism, chain homotopy

A chain map f:C∙→D∙f : C_\bullet \to D_\bullet is a family fn:Cn→Dnf_n : C_n \to D_n with dfn=fn−1dd f_n = f_{n-1} d; it sends cycles to cycles and boundaries to boundaries, so it induces Hn(f):Hn(C)→Hn(D)H_n(f) : H_n(C) \to H_n(D). It is a quasi-isomorphism if every Hn(f)H_n(f) is an isomorphism. Two chain maps f,gf, g are chain homotopic, f≃gf \simeq g, if there are maps sn:Cn→Dn+1s_n : C_n \to D_{n+1} with

fn−gn=dn+1sn+sn−1dnfor all n.f_n - g_n = d_{n+1} s_n + s_{n-1} d_n \quad \text{for all } n.

A homotopy equivalence is a chain map ff with a chain map gg such that gf≃idgf \simeq \mathrm{id} and fg≃idfg \simeq \mathrm{id}.

Definition— short exact sequence of complexes

A sequence of chain maps 0→A∙→fB∙→gC∙→00 \to A_\bullet \xrightarrow{f} B_\bullet \xrightarrow{g} C_\bullet \to 0 is short exact if 0→An→Bn→Cn→00 \to A_n \to B_n \to C_n \to 0 is exact for every nn.

Definition— projective and injective resolutions

A projective resolution of MM is a complex P∙P_\bullet of projective modules (Pn=0P_n = 0 for n<0n < 0) with a map ε:P0→M\varepsilon : P_0 \to M such that ⋯→P1→P0→εM→0\cdots \to P_1 \to P_0 \xrightarrow{\varepsilon} M \to 0 is exact. Every module has one: take P0P_0 free on generators of MM, then P1P_1 free on generators of ker⁡ε\ker \varepsilon, and so on. An injective resolution 0→N→I0→I1→⋯0 \to N \to I^0 \to I^1 \to \cdots is the dual notion, with the InI^n injective; every module has one. The projective dimension of MM is the shortest length of a projective resolution (possibly ∞\infty); the global dimension of RR is the supremum of the projective dimensions of all modules.

Definition— derived functors; Tor and Ext

Let FF be an additive functor from RR-modules to abelian groups. If FF is covariant and right exact, its left derived functors are LnF(M)=Hn(F(P∙))L_nF(M) = H_n(F(P_\bullet)) for a projective resolution P∙→MP_\bullet \to M. If FF is contravariant and left exact, its right derived functors are RnF(M)=Hn(F(P∙))R^nF(M) = H^n(F(P_\bullet)). In particular

TornR(M,N)=Hn(P∙⊗RN),ExtRn(M,N)=Hn(HomR(P∙,N)).\mathrm{Tor}_n^R(M, N) = H_n(P_\bullet \otimes_R N), \qquad \mathrm{Ext}^n_R(M, N) = H^n\bigl(\Hom_R(P_\bullet, N)\bigr).

Equivalently, ExtRn(M,N)=Hn(HomR(M,I∙))\mathrm{Ext}^n_R(M, N) = H^n(\Hom_R(M, I^\bullet)) for an injective resolution N→I∙N \to I^\bullet, and Tor\mathrm{Tor} may be computed by resolving either variable ("balance"; Weibel, §2.7). For non-commutative RR, MM is a right and NN a left module in Tor\mathrm{Tor}.

Definition— extension; equivalence

An extension of AA by BB is a short exact sequence 0→B→E→A→00 \to B \to E \to A \to 0. Two extensions E,E′E, E' are equivalent if there is a homomorphism E→E′E \to E' making both squares commute (it is then an isomorphism by the five lemma). The split extension is 0→B→B⊕A→A→00 \to B \to B \oplus A \to A \to 0.

Worked examplesH

Examples

Example— A complex with torsion homology

The real projective plane is a square with boundary word abababab: one 2-cell FF, two edges a,ba, b, and two vertices v,wv, w (aa runs from vv to ww, bb from ww to vv). Its cellular chain complex is

0→Z→ d2 Z2→ d1 Z2→0,d2(F)=2a+2b,d1(a)=w−v,d1(b)=v−w.0 \to \Z \xrightarrow{\ d_2\ } \Z^2 \xrightarrow{\ d_1\ } \Z^2 \to 0, \qquad d_2(F) = 2a + 2b, \quad d_1(a) = w - v, \quad d_1(b) = v - w.

Then ker⁡d1=Z(a+b)\ker d_1 = \Z(a + b) and im⁡d2=Z⋅2(a+b)\operatorname{im} d_2 = \Z \cdot 2(a + b), so H1≅Z/2H_1 \cong \Z/2; H2=ker⁡d2=0H_2 = \ker d_2 = 0; and H0=Z2/Z(w−v)≅ZH_0 = \Z^2 / \Z(w - v) \cong \Z. With F2\mathbb{F}_2 coefficients, d2=0d_2 = 0 and d1d_1 has rank 11, so Hn(RP2;F2)=F2H_n(\R P^2; \mathbb{F}_2) = \mathbb{F}_2 for n=0,1,2n = 0, 1, 2. (Formalised in part below; computed for four surfaces in the second experiment.)

Example— Resolutions

  • Over Z\Z: 0→Z→nZ→Z/n→00 \to \Z \xrightarrow{n} \Z \to \Z/n \to 0. Every abelian group has a free resolution of length ≤1\leq 1 (subgroups of free abelian groups are free), so Z\Z has global dimension 11.
  • Over k[x]k[x]: 0→k[x]→x−ak[x]→k[x]/(x−a)→00 \to k[x] \xrightarrow{x - a} k[x] \to k[x]/(x - a) \to 0.
  • Over k[x,y]k[x, y], the Koszul resolution of k=k[x,y]/(x,y)k = k[x, y]/(x, y):
0→k[x,y]→(−yx)k[x,y]2→(x  y)k[x,y]→k→0.0 \to k[x, y] \xrightarrow{\begin{pmatrix} -y \\ x \end{pmatrix}} k[x, y]^2 \xrightarrow{(x \ \ y)} k[x, y] \to k \to 0.
  • Over Z/4\Z/4, the module Z/2\Z/2 has the infinite periodic resolution ⋯→2Z/4→2Z/4→2Z/4→Z/2→0\cdots \xrightarrow{2} \Z/4 \xrightarrow{2} \Z/4 \xrightarrow{2} \Z/4 \to \Z/2 \to 0, and no finite one: Z/4\Z/4 has infinite global dimension.

Example— Tor and Ext over ℤ

Resolve Z/m\Z/m by 0→Z→mZ→00 \to \Z \xrightarrow{m} \Z \to 0. Tensoring with NN gives N→mNN \xrightarrow{m} N, and Hom(−,N)\Hom(-, N) gives N→mNN \xrightarrow{m} N as well, so

Tor0(Z/m,N)=N/mN,Tor1(Z/m,N)=N[m]={x:mx=0},Hom(Z/m,N)=N[m],Ext1(Z/m,N)=N/mN,\mathrm{Tor}_0(\Z/m, N) = N/mN, \quad \mathrm{Tor}_1(\Z/m, N) = N[m] = \{x : mx = 0\}, \quad \mathrm{Hom}(\Z/m, N) = N[m], \quad \mathrm{Ext}^1(\Z/m, N) = N/mN,

and all higher groups vanish. For N=Z/nN = \Z/n each of these is cyclic of order gcd⁡(m,n)\gcd(m, n); for N=ZN = \Z: Tor1(Z/m,Z)=0\mathrm{Tor}_1(\Z/m, \Z) = 0 and Ext1(Z/m,Z)≅Z/m\mathrm{Ext}^1(\Z/m, \Z) \cong \Z/m. In general Tor1Z(Z/n,A)\mathrm{Tor}_1^\Z(\Z/n, A) is the nn-torsion subgroup of AA — the origin of the name "Tor".

Example— Tor and Ext over k[x] and ℤ/4

Over R=k[x]R = k[x], with Sa=k[x]/(x−a)S_a = k[x]/(x - a), the resolution above gives Sb→x−aSbS_b \xrightarrow{x - a} S_b, which is multiplication by b−ab - a on kk. So Tor1k[x](Sa,Sb)≅Extk[x]1(Sa,Sb)≅k\mathrm{Tor}_1^{k[x]}(S_a, S_b) \cong \mathrm{Ext}^1_{k[x]}(S_a, S_b) \cong k if a=ba = b, and 00 otherwise: the two points must coincide to interact. Over Z/4\Z/4, the periodic resolution gives TornZ/4(Z/2,Z/2)≅Z/2\mathrm{Tor}_n^{\Z/4}(\Z/2, \Z/2) \cong \Z/2 for every n≥0n \geq 0: derived functors over a ring of infinite global dimension need not stop.

ProofH

The main theorems

Theorem— Theorem 1 (long exact homology sequence)

A short exact sequence of chain complexes 0→A∙→fB∙→gC∙→00 \to A_\bullet \xrightarrow{f} B_\bullet \xrightarrow{g} C_\bullet \to 0 induces an exact sequence

⋯→Hn(A)→f∗Hn(B)→g∗Hn(C)→ ∂ Hn−1(A)→f∗Hn−1(B)→g∗Hn−1(C)→⋯\cdots \to H_n(A) \xrightarrow{f_*} H_n(B) \xrightarrow{g_*} H_n(C) \xrightarrow{\ \partial\ } H_{n-1}(A) \xrightarrow{f_*} H_{n-1}(B) \xrightarrow{g_*} H_{n-1}(C) \to \cdots

in which the connecting homomorphism is ∂[c]=[a]\partial[c] = [a] where c=g(b)c = g(b) and db=f(a)d b = f(a).

Proof

Apply the snake lemma to the map of short exact sequences dn:(0→An→Bn→Cn→0)→(0→An−1→Bn−1→Cn−1→0)d_n : (0 \to A_n \to B_n \to C_n \to 0) \to (0 \to A_{n-1} \to B_{n-1} \to C_{n-1} \to 0). Its kernel part says that 0→Zn(A)→Zn(B)→Zn(C)0 \to Z_n(A) \to Z_n(B) \to Z_n(C) is exact; applied to dn+1d_{n+1}, its cokernel part says that An/Bn(A)→Bn/Bn(B)→Cn/Bn(C)→0A_n/B_n(A) \to B_n/B_n(B) \to C_n/B_n(C) \to 0 is exact. Since d∘d=0d \circ d = 0, the differential induces maps dˉ:Cn/Bn(C)→Zn−1(C)\bar d : C_n / B_n(C) \to Z_{n-1}(C), and similarly for AA and BB, giving a commutative diagram with exact rows

An/Bn(A)→Bn/Bn(B)→Cn/Bn(C)→0↓dˉ↓dˉ↓dˉ0→Zn−1(A)→Zn−1(B)→Zn−1(C).\begin{array}{ccccccc} A_n/B_n(A) & \to & B_n/B_n(B) & \to & C_n/B_n(C) & \to & 0 \\ \downarrow \bar d & & \downarrow \bar d & & \downarrow \bar d & & \\ 0 \to Z_{n-1}(A) & \to & Z_{n-1}(B) & \to & Z_{n-1}(C). & & \end{array}

The kernel of dˉ:Cn/Bn→Zn−1\bar d : C_n/B_n \to Z_{n-1} is Zn/Bn=Hn(C)Z_n / B_n = H_n(C) and its cokernel is Zn−1/Bn−1=Hn−1(C)Z_{n-1}/B_{n-1} = H_{n-1}(C), and likewise for AA and BB. The snake lemma now gives the exact sequence Hn(A)→Hn(B)→Hn(C)→∂Hn−1(A)→Hn−1(B)→Hn−1(C)H_n(A) \to H_n(B) \to H_n(C) \xrightarrow{\partial} H_{n-1}(A) \to H_{n-1}(B) \to H_{n-1}(C), and these six-term pieces overlap to form the long exact sequence. Unwinding the snake's construction: lift a cycle cc to b∈Bnb \in B_n; then g(db)=dc=0g(db) = dc = 0, so db=f(a)db = f(a) for a unique aa, which is a cycle because f(da)=ddb=0f(da) = ddb = 0 and ff is injective; and ∂[c]=[a]\partial[c] = [a].

∎

Theorem— Theorem 2 (homotopy invariance)

If f≃g:C∙→D∙f \simeq g : C_\bullet \to D_\bullet, then Hn(f)=Hn(g)H_n(f) = H_n(g) for all nn. Hence a homotopy equivalence is a quasi-isomorphism, and additive functors, which preserve chain homotopies, send homotopy equivalences to homotopy equivalences.

Proof

For a cycle z∈Zn(C)z \in Z_n(C), f(z)−g(z)=ds(z)+s(dz)=ds(z)f(z) - g(z) = d s(z) + s(dz) = d s(z) is a boundary, so [f(z)]=[g(z)][f(z)] = [g(z)]. If FF is additive, applying it to f−g=ds+sdf - g = ds + sd gives F(f)−F(g)=F(d)F(s)+F(s)F(d)F(f) - F(g) = F(d)F(s) + F(s)F(d).

∎

Theorem— Theorem 3 (comparison theorem)

Let P∙→MP_\bullet \to M be a complex of projective modules over MM (that is, Pn=0P_n = 0 for n<0n < 0 and ⋯→P1→P0→M→0\cdots \to P_1 \to P_0 \to M \to 0 is a complex), and Q∙→NQ_\bullet \to N a resolution (exact, not necessarily projective). Then every homomorphism φ:M→N\varphi : M \to N lifts to a chain map f:P∙→Q∙f : P_\bullet \to Q_\bullet compatible with the augmentations, and any two such lifts are chain homotopic.

Proof

Existence. φεP:P0→N\varphi \varepsilon_P : P_0 \to N lifts through the surjection εQ:Q0→N\varepsilon_Q : Q_0 \to N because P0P_0 is projective; call the lift f0f_0. Suppose f0,…,fnf_0, \dots, f_n have been built with dfk=fk−1dd f_k = f_{k-1} d (and εQf0=φεP\varepsilon_Q f_0 = \varphi \varepsilon_P). The map fnd:Pn+1→Qnf_n d : P_{n+1} \to Q_n lands in ker⁡(Qn→Qn−1)\ker(Q_n \to Q_{n-1}) (with Q−1=NQ_{-1} = N): indeed dfnd=fn−1dd=0d f_n d = f_{n-1} d d = 0, or εQf0d=φεPd=0\varepsilon_Q f_0 d = \varphi \varepsilon_P d = 0 when n=0n = 0. By exactness of Q∙→NQ_\bullet \to N, that kernel is the image of d:Qn+1→Qnd : Q_{n+1} \to Q_n, so projectivity of Pn+1P_{n+1} gives fn+1:Pn+1→Qn+1f_{n+1} : P_{n+1} \to Q_{n+1} with dfn+1=fndd f_{n+1} = f_n d.

Uniqueness up to homotopy. Let f,gf, g be two lifts and h=f−gh = f - g, a lift of 00. We build sn:Pn→Qn+1s_n : P_n \to Q_{n+1} with hn=dsn+sn−1dh_n = d s_n + s_{n-1} d, starting from s−1=0s_{-1} = 0. Since εQh0=0\varepsilon_Q h_0 = 0, h0h_0 lands in ker⁡εQ=im⁡(Q1→Q0)\ker \varepsilon_Q = \operatorname{im}(Q_1 \to Q_0); lift to s0s_0 with ds0=h0d s_0 = h_0. Inductively, hn−sn−1dh_n - s_{n-1} d lands in ker⁡(d:Qn→Qn−1)\ker(d : Q_n \to Q_{n-1}), because

d(hn−sn−1d)=hn−1d−dsn−1d=(hn−1−dsn−1)d=sn−2dd=0,d(h_n - s_{n-1} d) = h_{n-1} d - d s_{n-1} d = (h_{n-1} - d s_{n-1}) d = s_{n-2} d d = 0,

and so, by exactness and projectivity of PnP_n, it equals dsnd s_n for some sn:Pn→Qn+1s_n : P_n \to Q_{n+1}.

∎

Theorem— Corollary 4 (derived functors are well defined)

Any two projective resolutions of MM are homotopy equivalent, by a homotopy equivalence lifting idM\mathrm{id}_M that is unique up to homotopy. Consequently LnF(M)L_nF(M), Torn\mathrm{Tor}_n and Extn\mathrm{Ext}^n do not depend on the resolution, up to canonical isomorphism, and are functorial in MM. Moreover:

  1. L0F=FL_0F = F for right exact FF, so Tor0(M,N)=M⊗N\mathrm{Tor}_0(M, N) = M \otimes N; and Ext0(M,N)=Hom(M,N)\mathrm{Ext}^0(M, N) = \Hom(M, N);
  2. LnF(P)=0L_nF(P) = 0 for n≥1n \geq 1 if PP is projective; so Torn(P,N)=Extn(P,N)=0\mathrm{Tor}_n(P, N) = \mathrm{Ext}^n(P, N) = 0;
  3. a short exact sequence 0→M′→M→M′′→00 \to M' \to M \to M'' \to 0 gives long exact sequences
⋯→Tor1(M′′,N)→M′⊗N→M⊗N→M′′⊗N→0,\cdots \to \mathrm{Tor}_1(M'', N) \to M' \otimes N \to M \otimes N \to M'' \otimes N \to 0,0→Hom(M′′,N)→Hom(M,N)→Hom(M′,N)→Ext1(M′′,N)→Ext1(M,N)→⋯ .0 \to \Hom(M'', N) \to \Hom(M, N) \to \Hom(M', N) \to \mathrm{Ext}^1(M'', N) \to \mathrm{Ext}^1(M, N) \to \cdots.

Proof

If P∙,Q∙P_\bullet, Q_\bullet resolve MM, Theorem 3 gives lifts f:P→Qf : P \to Q and g:Q→Pg : Q \to P of idM\mathrm{id}_M; gfgf and idP\mathrm{id}_P both lift idM\mathrm{id}_M, so gf≃idPgf \simeq \mathrm{id}_P by uniqueness, and likewise fg≃idQfg \simeq \mathrm{id}_Q. By Theorem 2, F(P)F(P) and F(Q)F(Q) have canonically isomorphic homology. (1): P1→P0→M→0P_1 \to P_0 \to M \to 0 is exact and FF is right exact, so H0(F(P))=coker⁡F(P1→P0)≅F(M)H_0(F(P)) = \operatorname{coker} F(P_1 \to P_0) \cong F(M); dually for Hom\Hom. (2): PP resolves itself (P0=PP_0 = P, Pn=0P_n = 0 otherwise). (3): The horseshoe lemma builds projective resolutions P′P', PP, P′′P'' forming a short exact sequence of complexes 0→P′→P→P′′→00 \to P' \to P \to P'' \to 0 that is split in each degree (since Pn′′P''_n is projective). Additive functors preserve split exact sequences, so 0→F(P′)→F(P)→F(P′′)→00 \to F(P') \to F(P) \to F(P'') \to 0 is short exact, and Theorem 1 gives the long exact sequence (Weibel, Lemma 2.2.8 and Theorem 2.4.6).

∎

Theorem— Theorem 5 (Ext¹ classifies extensions)

There is a bijection between equivalence classes of extensions 0→B→E→A→00 \to B \to E \to A \to 0 and ExtR1(A,B)\mathrm{Ext}^1_R(A, B), under which the split extension corresponds to 00. In particular every extension of AA by BB splits if and only if Ext1(A,B)=0\mathrm{Ext}^1(A, B) = 0.

Proof

Choose a short exact sequence 0→K→ιP→πA→00 \to K \xrightarrow{\iota} P \xrightarrow{\pi} A \to 0 with PP projective. Its long exact Ext(−,B)\mathrm{Ext}(-, B) sequence, with Ext1(P,B)=0\mathrm{Ext}^1(P, B) = 0, gives

Ext1(A,B)  ≅  coker⁡(ι∗:Hom(P,B)→Hom(K,B)).\mathrm{Ext}^1(A, B) \;\cong\; \operatorname{coker}\bigl(\iota^* : \Hom(P, B) \to \Hom(K, B)\bigr).

From extensions to classes. Given 0→B→jE→qA→00 \to B \xrightarrow{j} E \xrightarrow{q} A \to 0, lift π\pi through qq to β:P→E\beta : P \to E (projectivity). Then qβι=πι=0q \beta \iota = \pi\iota = 0, so βι=jφ\beta \iota = j \varphi for a unique φ:K→B\varphi : K \to B. Another lift is β+jψ\beta + j\psi with ψ:P→B\psi : P \to B, changing φ\varphi to φ+ψι\varphi + \psi\iota; so the class Θ(E)=[φ]\Theta(E) = [\varphi] is well defined, and equivalent extensions give the same class.

From classes to extensions. Given φ:K→B\varphi : K \to B, let EφE_\varphi be the pushout (B⊕P)/{(φ(k),−ι(k)):k∈K}(B \oplus P)/\{(\varphi(k), -\iota(k)) : k \in K\}, with B→EφB \to E_\varphi, b↦[b,0]b \mapsto [b, 0], and Eφ→AE_\varphi \to A, [b,p]↦π(p)[b, p] \mapsto \pi(p). A diagram chase shows 0→B→Eφ→A→00 \to B \to E_\varphi \to A \to 0 is exact, and replacing φ\varphi by φ+ψι\varphi + \psi\iota gives an equivalent extension, via the map Eφ+ψι→EφE_{\varphi + \psi\iota} \to E_\varphi, [b,p]↦[b+ψ(p),p][b, p] \mapsto [b + \psi(p), p].

They are inverse. For EφE_\varphi, the lift β(p)=[0,p]\beta(p) = [0, p] satisfies βι(k)=[0,ι(k)]=[φ(k),0]\beta\iota(k) = [0, \iota(k)] = [\varphi(k), 0], so Θ(Eφ)=[φ]\Theta(E_\varphi) = [\varphi]. Conversely, for an extension EE with lift β\beta and class [φ][\varphi], the map Eφ→EE_\varphi \to E, [b,p]↦j(b)+β(p)[b, p] \mapsto j(b) + \beta(p), is well defined and compatible with both ends, hence an equivalence. Finally, Θ(E)=0\Theta(E) = 0 iff φ=ψι\varphi = \psi\iota for some ψ\psi, iff the lift β−jψ\beta - j\psi vanishes on KK and so factors through AA as a section of qq, iff EE splits.

∎

Under this bijection, Ext1(Z/2,Z)≅Z/2\mathrm{Ext}^1(\Z/2, \Z) \cong \Z/2 has two elements: the split extension Z⊕Z/2\Z \oplus \Z/2 and 0→Z→2Z→Z/2→00 \to \Z \xrightarrow{2} \Z \to \Z/2 \to 0. The group structure on Ext1\mathrm{Ext}^1 corresponds to the Baer sum of extensions (Baer, 1934). Higher Extn\mathrm{Ext}^n classify nn-fold exact sequences 0→B→En→⋯→E1→A→00 \to B \to E_n \to \cdots \to E_1 \to A \to 0 up to a suitable equivalence (Yoneda).

Theorem— Theorem 6 (three landmarks; stated)

  1. Universal coefficient theorem. For a chain complex C∙C_\bullet of free abelian groups and an abelian group GG there are natural short exact sequences, split but not naturally,
0→Hn(C)⊗G→Hn(C⊗G)→Tor1Z(Hn−1(C),G)→0.0 \to H_n(C) \otimes G \to H_n(C \otimes G) \to \mathrm{Tor}_1^\Z(H_{n-1}(C), G) \to 0.
  1. Hilbert's syzygy theorem (1890). Every finitely generated module over k[x1,…,xn]k[x_1, \dots, x_n] has a free resolution of length at most nn; the global dimension of k[x1,…,xn]k[x_1, \dots, x_n] is exactly nn.
  2. Auslander–Buchsbaum–Serre (1956). A Noetherian local ring is regular if and only if it has finite global dimension.

Proofs: Hatcher, Algebraic Topology, Theorem 3A.3, or Weibel, Theorem 3.6.2 (universal coefficients); Weibel, §4.3–4.4, and Eisenbud, Chapter 19 (syzygies and regular rings). The third theorem is a striking use of homological algebra in commutative algebra: it shows at once that localisations of regular local rings are regular, which had resisted direct attack.

Explore

Explore: chain complexes of glued squares

Each surface below is a square with its sides glued in pairs. Its cellular chain complex has one 2-cell FF, one 1-cell for each letter, and one 0-cell for each class of glued corners, and the boundary of FF is read off the word: d2(F)d_2(F) is the sum of the letters, with sign −1-1 for an inverse. So:

  • torus aba−1b−1aba^{-1}b^{-1}: d2(F)=a+b−a−b=0d_2(F) = a + b - a - b = 0, so H2=ZH_2 = \Z and H1=Z2H_1 = \Z^2;
  • Klein bottle aba−1baba^{-1}b: d2(F)=2bd_2(F) = 2b, so H2=0H_2 = 0 and H1=Z⊕Z/2H_1 = \Z \oplus \Z/2;
  • projective plane abababab: d2(F)=2a+2bd_2(F) = 2a + 2b, so H2=0H_2 = 0 and H1=Z/2H_1 = \Z/2;
  • sphere aa−1bb−1aa^{-1}bb^{-1}: d2(F)=0d_2(F) = 0 and three vertices, so H2=ZH_2 = \Z, H1=0H_1 = 0.

Walk the flatlander across the seams. Exactly on the non-orientable surfaces it comes back mirror-reversed — and exactly there d2(F)≠0d_2(F) \neq 0, so the 2-cell is not a cycle over Z\Z and H1H_1 acquires the torsion Z/2\Z/2. Over F2\mathbb{F}_2 the coefficient 22 vanishes, and every one of these closed surfaces has H2(X;F2)=F2H_2(X; \mathbb{F}_2) = \mathbb{F}_2, as the universal coefficient theorem predicts: for the Klein bottle and RP2\R P^2 this class comes from Tor1(Z/2,F2)=F2\mathrm{Tor}_1(\Z/2, \mathbb{F}_2) = \mathbb{F}_2.

Gluing words and boundary maps

Where the flag flips, the boundary of the 2-cell is not zero.

abab

Keys: ↑ forward, ↓ back, ← and → turn, Space walks or stops. You can also drag it.

Projective planea b a b
Orientable
No
Euler characteristic
χ = 1

Gluing turns the 4 corners into V = 2, the 4 sides into E = 2 and the square into F = 1: V − E + F = 2 − 2 + 1 = 1

Same way round as at the start.

Sides crossed so far: 0

Both pairs of opposite sides are glued with a twist. This is the real projective plane: non-orientable, with χ = 1. Like the Klein bottle, it cannot sit in 3D space without passing through itself.

The second experiment builds these chain complexes from the words and computes all their homology groups.

Formal mathematicsF

Homological algebra in Lean and Mathlib

We begin with the chain complex of RP2\R P^2 as integer matrices, verify d1d2=0d_1 d_2 = 0, and prove that H1H_1 contains an element of order exactly 22: the cycle a+ba + b is not a boundary, but twice it is.

rp2_d2Lean 4Formally verified
/-- The cellular boundary `d₂ : ℤ → ℤ²` of the real projective plane, glued from a square with
boundary word `a b a b`: the 2-cell runs along `a` twice and `b` twice, so `d₂(F) = 2a + 2b`. -/
def rp2_d2 : Matrix (Fin 2) (Fin 1) ℤ := !![2; 2]
Axioms used: propext, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
rp2_d1Lean 4Formally verified
/-- The cellular boundary `d₁ : ℤ² → ℤ²` (edges `a, b` to vertices `v, w`): `a` runs from `v` to
`w` and `b` from `w` back to `v`, so `d₁(a) = w - v` and `d₁(b) = v - w`. Columns are edges. -/
def rp2_d1 : Matrix (Fin 2) (Fin 2) ℤ := !![-1, 1; 1, -1]
Axioms used: propext, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
rp2_ddLean 4Proved here from basic factsFormally verified
/-- **`d ∘ d = 0`**: the boundary of the boundary vanishes, `d₁(2a + 2b) = 2(w - v) + 2(v - w)`.
A direct matrix computation. -/
theorem rp2_dd : rp2_d1 * rp2_d2 = 0 := by
  ext i j
  fin_cases i <;> fin_cases j <;> simp [rp2_d1, rp2_d2, Matrix.mul_apply, Fin.sum_univ_two]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
rp2_torsion_cycleLean 4Proved here from basic factsFormally verified
/-- **`H₁(ℝP²)` has a non-trivial element of order `2`.** The chain `a + b` is a cycle
(`d₁(a + b) = 0`), it is not a boundary (boundaries `d₂(n) = (2n, 2n)` have even coordinates), but
twice it is the boundary `d₂(1)`. So its class in `H₁ = ker d₁ / im d₂` is non-zero with order
`2`; the experiment computes `H₁(ℝP²; ℤ) ≅ ℤ/2` completely. -/
theorem rp2_torsion_cycle :
    rp2_d1.mulVec ![1, 1] = 0 ∧ (∀ n : Fin 1 → ℤ, rp2_d2.mulVec n ≠ ![1, 1]) ∧
      rp2_d2.mulVec ![1] = 2 • ![1, 1] := by
  refine ⟨?_, ?_, ?_⟩
  · ext i
    fin_cases i <;> simp [rp2_d1, Matrix.mulVec, dotProduct, Fin.sum_univ_two]
  · intro n h
    have h0 := congrFun h 0
    simp [rp2_d2, Matrix.mulVec, dotProduct] at h0
    omega
  · ext i
    fin_cases i <;> simp [rp2_d2, Matrix.mulVec, dotProduct]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor

Next, the computation behind two misconceptions: there are no non-zero homomorphisms Z/2→Z\Z/2 \to \Z, so the extension 0→Z→Z→Z/2→00 \to \Z \to \Z \to \Z/2 \to 0 does not split (its class in Ext1(Z/2,Z)\mathrm{Ext}^1(\Z/2, \Z) is non-zero), and the quasi-isomorphism from [Z→2Z][\Z \xrightarrow{2} \Z] to Z/2\Z/2 has no inverse chain map.

hom_zmod_two_intLean 4Proved here from basic factsFormally verified
/-- **`Hom(ℤ/2, ℤ) = 0`.** If `f : ℤ/2 → ℤ` is additive then `2 f(1) = f(1 + 1) = f(0) = 0`, so
`f(1) = 0`, and `f` vanishes on both elements of `ℤ/2`. -/
theorem hom_zmod_two_int (f : ZMod 2 →+ ℤ) : f = 0 := by
  have h1 : f 1 = 0 := by
    have h : f 1 + f 1 = 0 := by
      rw [← map_add]
      have : (1 : ZMod 2) + 1 = 0 := rfl
      rw [this, map_zero]
    omega
  ext x
  have hx : x = 0 ∨ x = 1 := by
    revert x
    decide
  rcases hx with rfl | rfl
  · simp
  · simp [h1]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
not_splitLean 4Proved here from basic factsFormally verified
/-- **The extension `0 → ℤ --2·--> ℤ → ℤ/2 → 0` does not split**: reduction mod `2` has no
additive section, because the only homomorphism `ℤ/2 → ℤ` is zero. Equivalently, the chain map
from the complex `[ℤ --2·--> ℤ]` to `ℤ/2` (in degree `0`) is a quasi-isomorphism with no chain map
going back that induces the inverse on homology: in degree `0` such a map would be a section
`ℤ/2 → ℤ`. -/
theorem not_split : ¬ ∃ s : ZMod 2 →+ ℤ, ∀ x : ZMod 2, ((s x : ℤ) : ZMod 2) = x := by
  rintro ⟨s, hs⟩
  have h := hs 1
  rw [hom_zmod_two_int s] at h
  exact absurd h (by decide)
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor

The resolution computation of Tor1(Z/4,Z/6)\mathrm{Tor}_1(\Z/4, \Z/6) and Ext1(Z/4,Z/6)\mathrm{Ext}^1(\Z/4, \Z/6), as a kernel and a cokernel of multiplication by 44 on Z/6\Z/6, decided by evaluation:

tor_four_sixLean 4Proved here from basic factsFormally verified
/-- **`Tor₁(ℤ/4, ℤ/6)` has `2` elements.** Resolve `ℤ/4` by `0 → ℤ --4·--> ℤ → ℤ/4 → 0`, tensor
with `ℤ/6` to get `ℤ/6 --4·--> ℤ/6`; `Tor₁` is the kernel of this map. A finite computation:
the kernel is `{0, 3}`, with `gcd(4, 6) = 2` elements. -/
theorem tor_four_six : (Finset.univ.filter (fun x : ZMod 6 => 4 * x = 0)).card = 2 := by
  decide
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
ext_four_sixLean 4Proved here from basic factsFormally verified
/-- **`Ext¹(ℤ/4, ℤ/6)` has `2` elements.** Applying `Hom(−, ℤ/6)` to the same resolution gives
`ℤ/6 --4·--> ℤ/6` again, and `Ext¹` is its cokernel: the image `{0, 2, 4}` has index `2`. -/
theorem ext_four_six : (Finset.univ.image (fun x : ZMod 6 => 4 * x)).card * 2 = 6 := by
  decide
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor

Mathlib develops homological algebra in an arbitrary abelian category. Its long exact sequence is built from the snake lemma, exactly as in Theorem 1; homotopy invariance, the comparison theorem and Ext\mathrm{Ext} as a derived functor are all there:

long_exact_connectingLean 4Applies a library theoremFormally verified
/-- **The long exact sequence, at the connecting map.** For a short exact sequence of chain
complexes `0 → X₁ → X₂ → X₃ → 0` and indices with `c.Rel i j`, the sequence
`Hᵢ(X₂) → Hᵢ(X₃) --δ--> Hⱼ(X₁)` is exact. Mathlib: `ShortComplex.ShortExact.homology_exact₃`;
`δ` is built from the snake lemma, as in the lesson. -/
theorem long_exact_connecting {ι : Type*} {c : ComplexShape ι}
    {S : ShortComplex (HomologicalComplex C c)} (hS : S.ShortExact) (i j : ι) (hij : c.Rel i j) :
    (ShortComplex.mk _ _ (hS.comp_δ i j hij)).Exact :=
  hS.homology_exact₃ i j hij
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
long_exact_after_connectingLean 4Applies a library theoremFormally verified
/-- **The long exact sequence, after the connecting map**: `Hᵢ(X₃) --δ--> Hⱼ(X₁) → Hⱼ(X₂)` is
exact. Mathlib: `ShortComplex.ShortExact.homology_exact₁`. -/
theorem long_exact_after_connecting {ι : Type*} {c : ComplexShape ι}
    {S : ShortComplex (HomologicalComplex C c)} (hS : S.ShortExact) (i j : ι) (hij : c.Rel i j) :
    (ShortComplex.mk _ _ (hS.δ_comp i j hij)).Exact :=
  hS.homology_exact₁ i j hij
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
homotopy_invarianceLean 4Applies a library theoremFormally verified
/-- **Chain-homotopic maps induce the same map on homology.** Mathlib: `Homotopy.homologyMap_eq`. -/
theorem homotopy_invariance {ι : Type*} {c : ComplexShape ι} {K L : HomologicalComplex C c}
    {f g : K ⟶ L} (h : Homotopy f g) (i : ι) :
    HomologicalComplex.homologyMap f i = HomologicalComplex.homologyMap g i :=
  h.homologyMap_eq i
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
comparisonLean 4Applies a library theoremFormally verified
/-- **The comparison theorem**: any two projective resolutions of the same object are chain
homotopy equivalent (via lifts of the identity, unique up to homotopy). Mathlib:
`ProjectiveResolution.homotopyEquiv`, built from `ProjectiveResolution.lift` and
`ProjectiveResolution.liftHomotopy`. -/
theorem comparison {X : C} (P Q : ProjectiveResolution X) :
    Nonempty (HomotopyEquiv P.complex Q.complex) :=
  ⟨ProjectiveResolution.homotopyEquiv P Q⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
ext_via_resolutionLean 4Applies a library theoremFormally verified
/-- **`Ext` does not depend on the resolution**: `Extⁿ(X, Y)` is the `n`-th cohomology of
`Hom(P•, Y)` for *any* projective resolution `P• → X`. Mathlib defines `Ext R C n` as a derived
functor and proves this as `ProjectiveResolution.isoExt`. -/
theorem ext_via_resolution (R : Type*) [Ring R] [Linear R C] [EnoughProjectives C] {X : C}
    (P : ProjectiveResolution X) (n : ℕ) (Y : C) :
    Nonempty (((Ext R C n).obj (Opposite.op X)).obj Y ≅
      (P.complex.linearYonedaObj R Y).homology n) :=
  ⟨P.isoExt n Y⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor
ext_projectiveLean 4Applies a library theoremFormally verified
/-- **Projectives have no higher Ext**: `Extⁿ⁺¹(P, Y) = 0` for projective `P` (resolve `P` by
itself). Mathlib: `isZero_Ext_succ_of_projective`. -/
theorem ext_projective (R : Type*) [Ring R] [Linear R C] [EnoughProjectives C] (X Y : C)
    [Projective X] (n : ℕ) : IsZero (((Ext R C (n + 1)).obj (Opposite.op X)).obj Y) :=
  isZero_Ext_succ_of_projective X Y n
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/HomologicalAlgebra.leanTry it in the Lean web editor

What is and is not formalised. Proved here: d1d2=0d_1 d_2 = 0 for RP2\R P^2 and an element of order 22 in H1H_1; Hom(Z/2,Z)=0\Hom(\Z/2, \Z) = 0 and the non-splitting of 0→Z→Z→Z/2→00 \to \Z \to \Z \to \Z/2 \to 0; the sizes of Tor1(Z/4,Z/6)\mathrm{Tor}_1(\Z/4, \Z/6) and Ext1(Z/4,Z/6)\mathrm{Ext}^1(\Z/4, \Z/6) as a kernel and cokernel. From Mathlib: the long exact sequence, homotopy invariance, the comparison theorem, the independence of Ext\mathrm{Ext} from the resolution, and the vanishing of Ext\mathrm{Ext} on projectives. Not formalised here: the full computation H1(RP2)≅Z/2H_1(\R P^2) \cong \Z/2 as a quotient module, Theorem 5 (Mathlib relates Ext1\mathrm{Ext}^1 in the derived category to short exact sequences, but we do not use it), the universal coefficient theorem, and the general formula Tor1(Z/m,Z/n)≅Z/gcd⁡(m,n)\mathrm{Tor}_1(\Z/m, \Z/n) \cong \Z/\gcd(m, n), which the first experiment checks for m,n≤20m, n \leq 20.

ComputationC

Tor, Ext and homology, computed

The first experiment computes Tor0\mathrm{Tor}_0, Tor1\mathrm{Tor}_1, Hom\Hom and Ext1\mathrm{Ext}^1 of Z/m\Z/m and Z/n\Z/n from the resolution 0→Z→mZ→Z/m→00 \to \Z \xrightarrow{m} \Z \to \Z/m \to 0 for all m,n≤20m, n \leq 20, then recomputes Tor1\mathrm{Tor}_1 from a different, non-minimal resolution 0→Z2→Z2→Z/m→00 \to \Z^2 \to \Z^2 \to \Z/m \to 0 — a concrete instance of Corollary 4.

Tor and Ext of cyclic groups from resolutionsPythonExact computationExhaustive finite checkComputationally tested
"""Tor and Ext of cyclic groups from projective resolutions, two ways.

Z/m has the free resolution 0 -> Z --m--> Z -> Z/m -> 0. Tensoring with Z/n
gives the complex Z/n --m--> Z/n, whose homology is Tor_1 (kernel) and
Tor_0 = Z/m (x) Z/n (cokernel); applying Hom(-, Z/n) gives the same map, whose
kernel is Hom(Z/m, Z/n) and cokernel Ext^1(Z/m, Z/n). We count kernels and
cokernels by brute force and compare with gcd(m, n). Then we redo Tor_1 with
a different, non-minimal resolution 0 -> Z^2 --A--> Z^2 -> Z/m -> 0 and check
that the answer does not change, as the comparison theorem predicts.
Exact finite arithmetic, exhaustive in the stated range.
"""

from itertools import product
from math import gcd

def kernel_size(m, n):
    """Number of x in Z/n with m x = 0."""
    return sum(1 for x in range(n) if m * x % n == 0)

def cokernel_size(m, n):
    """|Z/n / m(Z/n)|."""
    return n // len({m * x % n for x in range(n)})

def tor1_from_matrix(a, n):
    """Kernel size of the integer matrix a (2x2) acting on (Z/n)^2."""
    count = 0
    for x, y in product(range(n), repeat=2):
        u = (a[0][0] * x + a[0][1] * y) % n
        v = (a[1][0] * x + a[1][1] * y) % n
        count += u == 0 and v == 0
    return count

def second_resolution(m):
    """A 2x2 integer matrix with cokernel Z/m: relations (m, 0) and (3, 1)."""
    return [[m, 3], [0, 1]]

def main():
    limit = 20
    pairs = [(m, n) for m in range(1, limit + 1) for n in range(1, limit + 1)]
    ker_ok = sum(kernel_size(m, n) == gcd(m, n) for m, n in pairs)
    cok_ok = sum(cokernel_size(m, n) == gcd(m, n) for m, n in pairs)
    alt_ok = sum(tor1_from_matrix(second_resolution(m), n) == gcd(m, n)
                 for m, n in pairs)
    print(f"All {len(pairs)} pairs 1 <= m, n <= {limit}; Z/n (x) - and "
          "Hom(-, Z/n) give Z/n --m--> Z/n:")
    print(f"  kernel = Tor_1 = Hom(Z/m, Z/n) has gcd(m, n) elements:  {ker_ok}")
    print(f"  cokernel = Tor_0 = Ext^1(Z/m, Z/n) has gcd(m, n) elements: "
          f"{cok_ok}")
    print(f"  Tor_1 from the resolution Z^2 --A--> Z^2, A = [[m, 3], [0, 1]]: "
          f"{alt_ok}")
    print("Examples (|kernel|, |cokernel|):")
    for m, n in [(4, 6), (2, 2), (3, 5), (12, 18)]:
        print(f"  m = {m}, n = {n}: {kernel_size(m, n)}, {cokernel_size(m, n)}")
    print("Ext^1(Z/n, Z) = Z / nZ, so Ext^1(Z/2, Z) has 2 elements: the split")
    print("  extension Z + Z/2 and the non-split 0 -> Z --2--> Z -> Z/2 -> 0.")
    print()
    print("Epistemic status: exact and exhaustive for m, n <= 20, using one "
          "particular\nsecond resolution. It illustrates the comparison "
          "theorem and the formula\nTor_1(Z/m, Z/n) = Z/gcd(m, n); both are "
          "proved in the lesson for all m, n.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The second builds the cellular chain complexes of the four glued squares from the visualisation, computes their homology over Z\Z (with torsion, by Smith normal form), over F2\mathbb{F}_2, F3\mathbb{F}_3 and Q\Q, and checks the universal coefficient theorem and the Euler characteristic χ=V−E+F=∑(−1)ndim⁡Hn\chi = V - E + F = \sum (-1)^n \dim H_n in every case.

Homology of glued squares and universal coefficientsPythonExact computationComputationally tested
"""Cellular homology of four surfaces, and the universal coefficient theorem.

Glue the sides of a square in pairs by a word such as "a b a' b'" (a' is a
inverse, read counter-clockwise from the bottom-left corner). This gives a
cell complex with one 2-cell, the distinct edge letters as 1-cells and the
classes of identified corners as 0-cells, with cellular chain complex
Z --d2--> Z^E --d1--> Z^V. We build d2 and d1 from the word, check d1 d2 = 0,
and compute homology over Z (Smith normal form: Betti numbers and torsion),
over F_2, F_3 and over Q (ranks). Then we check the universal coefficient
theorem dim H_n(X; F_p) = b_n + t_n(p) + t_(n-1)(p), where t_n(p) counts the
torsion factors of H_n(X; Z) divisible by p, and the Euler characteristic.
"""

from fractions import Fraction

WORDS = {
    "torus": "a b a' b'",
    "Klein bottle": "a b a' b",
    "sphere": "a a' b b'",
    "projective plane": "a b a b",
}

def cell_complex(word):
    """(d2, d1) as integer matrices (lists of rows) for a square gluing word."""
    sides = [(s[0], -1 if s.endswith("'") else 1) for s in word.split()]
    letters = sorted({s for s, _ in sides})
    parent = list(range(4))                  # corners 0..3, union-find

    def find(c):
        while parent[c] != c:
            c = parent[c]
        return c

    ends = {}                                # letter -> (tail, head) corners
    for k, (s, e) in enumerate(sides):
        tail, head = (k, (k + 1) % 4) if e == 1 else ((k + 1) % 4, k)
        if s in ends:
            for old, new in zip(ends[s], (tail, head)):
                parent[find(old)] = find(new)
        else:
            ends[s] = (tail, head)
    vertices = sorted({find(c) for c in range(4)})
    d2 = [[sum(e for s, e in sides if s == letter)] for letter in letters]
    d1 = [[0] * len(letters) for _ in vertices]
    for j, letter in enumerate(letters):
        tail, head = ends[letter]
        d1[vertices.index(find(head))][j] += 1
        d1[vertices.index(find(tail))][j] -= 1
    return d2, d1

def matmul(a, b):
    """Product of integer matrices given as lists of rows."""
    return [[sum(x * y for x, y in zip(row, col)) for col in zip(*b)]
            for row in a]

def rank(mat, p=None):
    """Rank over F_p (p prime) or over Q (p = None)."""
    rows = [[Fraction(v) if p is None else v % p for v in r] for r in mat]
    r, cols = 0, len(rows[0]) if rows else 0
    for c in range(cols):
        piv = next((i for i in range(r, len(rows)) if rows[i][c] != 0), None)
        if piv is None:
            continue
        rows[r], rows[piv] = rows[piv], rows[r]
        inv = 1 / rows[r][c] if p is None else pow(rows[r][c], p - 2, p)
        rows[r] = [v * inv if p is None else v * inv % p for v in rows[r]]
        for i in range(len(rows)):
            if i != r and rows[i][c] != 0:
                k = rows[i][c]
                rows[i] = [(a - k * b) if p is None else (a - k * b) % p
                           for a, b in zip(rows[i], rows[r])]
        r += 1
    return r

def smith_diagonal(matrix):
    """Smith normal form diagonal (d1 | d2 | ...) of an integer matrix."""
    a = [list(row) for row in matrix]
    m, n = len(a), len(a[0]) if a else 0
    diag = []
    for t in range(min(m, n)):
        cells = [(abs(a[i][j]), i, j) for i in range(t, m)
                 for j in range(t, n) if a[i][j]]
        if not cells:
            break
        while True:
            _, i, j = min(cells)
            a[t], a[i] = a[i], a[t]
            for row in a:
                row[t], row[j] = row[j], row[t]
            done = True
            for i in range(t + 1, m):
                q = a[i][t] // a[t][t]
                a[i] = [x - q * y for x, y in zip(a[i], a[t])]
                done &= a[i][t] == 0
            for j in range(t + 1, n):
                q = a[t][j] // a[t][t]
                for row in a:
                    row[j] -= q * row[t]
                done &= a[t][j] == 0
            bad = [i for i in range(t + 1, m) for j in range(t + 1, n)
                   if a[i][j] % a[t][t]]
            if done and bad:
                a[t] = [x + y for x, y in zip(a[t], a[bad[0]])]
                done = False
            if done:
                break
            cells = [(abs(a[i][j]), i, j) for i in range(t, m)
                     for j in range(t, n) if a[i][j]]
        diag.append(abs(a[t][t]))
    return diag

def torsion(mat):
    """Invariant factors > 1 of an integer matrix: the torsion of its cokernel."""
    return [d for d in smith_diagonal(mat) if d > 1]

def homology(word, p=None):
    """Betti numbers (b0, b1, b2) over Q or F_p, plus integral torsion."""
    d2, d1 = cell_complex(word)
    v, e = len(d1), len(d2)
    r1, r2 = rank(d1, p), rank(d2, p)
    betti = (v - r1, e - r1 - r2, 1 - r2)
    return betti, {0: torsion(d1), 1: torsion(d2), 2: []}

def main():
    print("Surface            V E F  d1d2=0  H_0, H_1, H_2 over Z        chi")
    uct_ok = True
    for name, word in WORDS.items():
        d2, d1 = cell_complex(word)
        zero = all(x == 0 for row in matmul(d1, d2) for x in row)
        b, tors = homology(word)
        groups = []
        for n in range(3):
            parts = ["Z"] * b[n] + [f"Z/{t}" for t in tors[n]]
            groups.append(" + ".join(parts) or "0")
        chi = len(d1) - len(d2) + 1
        print(f"{name:18} {len(d1)} {len(d2)} 1  {str(zero):6}  "
              f"{', '.join(groups):26} {chi}")
        for p in (2, 3):
            bp, _ = homology(word, p)
            t = [sum(1 for f in tors[n] if f % p == 0) for n in range(3)]
            predicted = tuple(b[n] + t[n] + (t[n - 1] if n else 0)
                              for n in range(3))
            uct_ok = uct_ok and bp == predicted
            uct_ok = uct_ok and chi == bp[0] - bp[1] + bp[2] == b[0] - b[1] + b[2]
    print("Betti numbers over F_2 for the Klein bottle and RP^2:",
          homology(WORDS["Klein bottle"], 2)[0],
          homology(WORDS["projective plane"], 2)[0])
    print("Universal coefficients over F_2, F_3 and chi = V - E + F agree:",
          uct_ok)
    print()
    print("Epistemic status: exact integer and modular arithmetic for four "
          "small cell\ncomplexes; it confirms the theorems in these cases "
          "only. The universal\ncoefficient theorem is stated in the lesson "
          "and proved in the references.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Exercises

Exercises

1. Homological algebra

Warm-upHuman

Consider the chain complex 0→Z→d2Z2→d1Z→00 \to \mathbb{Z} \xrightarrow{d_2} \mathbb{Z}^2 \xrightarrow{d_1} \mathbb{Z} \to 0 with d2(n)=(2n,4n)d_2(n) = (2n, 4n) and d1(a,b)=2a−bd_1(a, b) = 2a - b. How many elements does H1=ker⁡d1/im⁡d2H_1 = \ker d_1 / \operatorname{im} d_2 have?

2. Homological algebra

Warm-upHuman

Which statements about chain maps are true in general? (Choose all that apply.)

Choose all that apply

3. Homological algebra

CoreHuman

How many elements does Tor1Z(Z/12,Z/18)\mathrm{Tor}_1^{\mathbb{Z}}(\mathbb{Z}/12, \mathbb{Z}/18) have?

4. Homological algebra

CoreHuman

How many equivalence classes of extensions 0→Z/5→E→Z/5→00 \to \mathbb{Z}/5 \to E \to \mathbb{Z}/5 \to 0 of abelian groups are there?

5. Homological algebra

CoreHuman

In the existence part of the comparison theorem, why does fnd:Pn+1→Qnf_n d : P_{n+1} \to Q_n land in ker⁡(d:Qn→Qn−1)\ker(d : Q_n \to Q_{n-1}) (for n≥1n \geq 1)?

Choose one

6. Homological algebra

StretchHuman

Apply −⊗Z/2- \otimes \mathbb{Z}/2 and its derived functors to 0→Z→2Z→Z/2→00 \to \mathbb{Z} \xrightarrow{2} \mathbb{Z} \to \mathbb{Z}/2 \to 0. The long exact sequence reads Tor1(Z,Z/2)→Tor1(Z/2,Z/2)→∂Z/2→2Z/2→Z/2→0\mathrm{Tor}_1(\mathbb{Z}, \mathbb{Z}/2) \to \mathrm{Tor}_1(\mathbb{Z}/2, \mathbb{Z}/2) \xrightarrow{\partial} \mathbb{Z}/2 \xrightarrow{2} \mathbb{Z}/2 \to \mathbb{Z}/2 \to 0. What is Tor1(Z/2,Z/2)\mathrm{Tor}_1(\mathbb{Z}/2, \mathbb{Z}/2)?

Choose one

7. Homological algebra

CoreFormal

Which Lean statement says that the extension 0→Z→2Z→Z/2→00 \to \mathbb{Z} \xrightarrow{2} \mathbb{Z} \to \mathbb{Z}/2 \to 0 does not split (as proved in not_split)?

Choose one

8. Homological algebra

StretchComputational

A chain complex 0→C2→d2C1→d1C0→00 \to C_2 \xrightarrow{d_2} C_1 \xrightarrow{d_1} C_0 \to 0 of free abelian groups is given by integer matrices d2 (shape dim⁡C1×dim⁡C2\dim C_1 \times \dim C_2) and d1 (shape dim⁡C0×dim⁡C1\dim C_0 \times \dim C_1), as lists of rows. Write betti_mod_p(d2, d1, p) returning [b0, b1, b2], the dimensions of Hn(C⊗Fp)H_n(C \otimes \mathbb{F}_p) for a prime pp, using bn=dim⁡Cn−rank⁡dn−rank⁡dn+1b_n = \dim C_n - \operatorname{rank} d_n - \operatorname{rank} d_{n+1} over Fp\mathbb{F}_p (with d0=d3=0d_0 = d_3 = 0).

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

Common misconceptions

Misconception

"A quasi-isomorphism has an inverse chain map." It need not. The chain map from C=[ 0→Z→2Z→0 ]C = [\,0 \to \Z \xrightarrow{2} \Z \to 0\,] (degrees 11 and 00) to Z/2\Z/2 in degree 00, given by reduction mod 22, is a quasi-isomorphism: both complexes have homology Z/2\Z/2 in degree 00 only. A chain map back would be a homomorphism Z/2→Z\Z/2 \to \Z in degree 00, and the only one is 00 (formalised above), which does not induce an isomorphism. Inverting quasi-isomorphisms formally is exactly what the derived category does. Homotopy equivalences, by contrast, do have inverses up to homotopy, and between bounded-below complexes of projectives every quasi-isomorphism is a homotopy equivalence.

Misconception

"A complex is determined by its homology." Not up to isomorphism: CC above and Z/2[0]\Z/2[0] have the same homology but different terms. Not even up to quasi-isomorphism in general: over Z/4\Z/4, the complex D=[ Z/4→2Z/4 ]D = [\,\Z/4 \xrightarrow{2} \Z/4\,] and Z/2[1]⊕Z/2[0]\Z/2[1] \oplus \Z/2[0] (zero differential) have the same homology, but every chain map D→Z/2[1]⊕Z/2[0]D \to \Z/2[1] \oplus \Z/2[0] kills H1(D)=2Z/4H_1(D) = 2\Z/4 (a map Z/4→Z/2\Z/4 \to \Z/2 sends 22 to 00), and every chain map in the other direction kills H0H_0 (its degree-00 component lands in 2Z/42\Z/4). Since DD consists of projectives, any zigzag of quasi-isomorphisms could be replaced by a single chain map out of DD, so the two complexes are not quasi-isomorphic (Weibel, §10.4). Over Z\Z, or any ring of global dimension at most 11, every complex is quasi-isomorphic to the direct sum of its shifted homology groups.

Misconception

"Ext1(A,B)\mathrm{Ext}^1(A, B) counts the possible middle modules EE." It classifies extensions up to equivalence, which remembers the maps. ExtZ1(Z/p,Z/p)≅Z/p\mathrm{Ext}^1_\Z(\Z/p, \Z/p) \cong \Z/p has pp elements, but there are only two isomorphism types of middle group: Z/p⊕Z/p\Z/p \oplus \Z/p (the split class 00) and Z/p2\Z/p^2, which carries the p−1p - 1 non-zero classes, differing in how Z/p\Z/p is embedded and how the quotient is identified with Z/p\Z/p.

Misconception

"Tor and Ext depend on the resolution chosen." The groups computed from different resolutions are canonically isomorphic (Corollary 4), and the first experiment checks one instance. What depends on choices is the chain level: the resolution itself, and the representing cocycles.

ViewpointsH

Viewpoints

Topology— Homology theories and universal coefficients

Singular homology Hn(X;G)H_n(X; G) is the homology of the singular chain complex C∙(X)⊗GC_\bullet(X) \otimes G, and the long exact sequence of Theorem 1, applied to 0→C∙(A)→C∙(X)→C∙(X)/C∙(A)→00 \to C_\bullet(A) \to C_\bullet(X) \to C_\bullet(X)/C_\bullet(A) \to 0 or to a Mayer–Vietoris sequence, is the main computational tool of algebraic topology. The universal coefficient theorem says that integral homology determines homology with any coefficients, with Tor\mathrm{Tor} as the correction: H2(RP2;F2)≅Tor1(Z/2,F2)=F2H_2(\R P^2; \mathbb{F}_2) \cong \mathrm{Tor}_1(\Z/2, \mathbb{F}_2) = \mathbb{F}_2 although H2(RP2;Z)=0H_2(\R P^2; \Z) = 0. The Künneth theorem has a Tor\mathrm{Tor} term too: H3(RP2×RP2;Z)≅Tor1(Z/2,Z/2)=Z/2H_3(\R P^2 \times \R P^2; \Z) \cong \mathrm{Tor}_1(\Z/2, \Z/2) = \Z/2, a class not visible in any product of homology classes. On a smooth manifold, the de Rham theorem identifies the cohomology of the cochain complex of differential forms, d∘d=0d \circ d = 0, with singular cohomology with real coefficients.

Geometry— Sheaf cohomology and deformations

On a space or variety XX, the global sections functor Γ(X,−)\Gamma(X, -) on sheaves is left exact but not exact, and its right derived functors — computed with injective resolutions, which exist in the abelian category of sheaves — are sheaf cohomology Hn(X,F)H^n(X, \mathcal{F}). They measure the obstruction to passing from local to global solutions: on C∖{0}\C \setminus \{0\} every nowhere-zero holomorphic function has a logarithm locally, and the obstruction to a global one lies in H1(X,Z)≅ZH^1(X, \Z) \cong \Z (the winding number). In algebraic geometry, Ext\mathrm{Ext} groups of sheaves govern deformation theory: for a sheaf F\mathcal{F} on a projective variety, Ext1(F,F)\mathrm{Ext}^1(\mathcal{F}, \mathcal{F}) is the tangent space to the space of first-order deformations of F\mathcal{F}, and obstructions to extending them lie in Ext2(F,F)\mathrm{Ext}^2(\mathcal{F}, \mathcal{F}) (see sheaves).

Algebra— Group cohomology

For a group GG and a GG-module MM (a module over the group ring ZG\Z G), group cohomology is Hn(G,M)=ExtZGn(Z,M)H^n(G, M) = \mathrm{Ext}^n_{\Z G}(\Z, M), with Z\Z the trivial module. In low degrees it is classical: H0(G,M)=MGH^0(G, M) = M^G, the invariants; H1(G,M)H^1(G, M) is crossed homomorphisms modulo principal ones; and H2(G,M)H^2(G, M) classifies group extensions 1→M→E→G→11 \to M \to E \to G \to 1 inducing the given action, as Ext¹ classifies module extensions. For a cyclic group Cn=⟨t⟩C_n = \langle t \rangle there is a periodic free resolution of Z\Z by ZCn\Z C_n, with maps alternating between t−1t - 1 and 1+t+⋯+tn−11 + t + \cdots + t^{n-1}, so H2k(Cn,Z)≅Z/nH^{2k}(C_n, \Z) \cong \Z/n for k≥1k \geq 1 and H2k+1(Cn,Z)=0H^{2k+1}(C_n, \Z) = 0. For finite GG and n≥1n \geq 1, Hn(G,M)H^n(G, M) is annihilated by ∣G∣|G|, so it vanishes when ∣G∣|G| acts invertibly on MM — the cohomological form of Maschke's theorem (see representation theory).

Number theory— Galois cohomology and Kummer theory

For a field KK with absolute Galois group GKG_K, the cohomology of the Galois module K‾×\overline{K}^\times carries arithmetic. Hilbert's Theorem 90 says H1(GK,K‾×)=0H^1(G_K, \overline{K}^\times) = 0. Applying the long exact cohomology sequence to the Kummer sequence 1→μn→K‾×→x↦xnK‾×→11 \to \mu_n \to \overline{K}^\times \xrightarrow{x \mapsto x^n} \overline{K}^\times \to 1 (exact when nn is invertible in KK) gives

H1(GK,μn)≅K×/(K×)n,H^1(G_K, \mu_n) \cong K^\times / (K^\times)^n,

which classifies cyclic extensions of degree dividing nn when μn⊆K\mu_n \subseteq K — Kummer theory, whose classical form predates cohomology. The next term, H2(GK,μn)H^2(G_K, \mu_n), is the nn-torsion of the Brauer group, the central object of local and global class field theory (see algebraic number theory).

Category theory— Derived functors and derived categories

Derived functors are a categorical construction: in an abelian category with enough projectives, LnFL_nF is defined by the same recipe, and Grothendieck's Tôhoku paper (1957) set up the theory in that generality, including the existence of enough injectives in categories of sheaves (see abelian categories). The modern view packages all LnFL_nF into one total derived functor LF:D−(A)→D−(B)LF : D^-(\mathcal{A}) \to D^-(\mathcal{B}) between derived categories, in which quasi-isomorphisms have become isomorphisms; Extn(A,B)=HomD(A)(A,B[n])\mathrm{Ext}^n(A, B) = \Hom_{D(\mathcal{A})}(A, B[n]), and long exact sequences become distinguished triangles (see derived categories and triangulated categories). The comparison theorem is then the statement that the homotopy category of bounded-below complexes of projectives is equivalent to D−(A)D^-(\mathcal{A}).

History & global context

History and global context

  • Henri Poincaré introduced Betti numbers and torsion coefficients of spaces in Analysis Situs (1895) and its supplements. Around 1925 Emmy Noether pointed out that they are invariants of homology groups, an idea taken up by Heinz Hopf, Pavel Alexandrov and Leopold Vietoris; Walther Mayer gave an early purely algebraic treatment of chain complexes (1929).
  • David Hilbert's syzygy theorem (1890) was the first theorem about free resolutions. Reinhold Baer studied extensions of abelian groups and their sum (1934). Witold Hurewicz introduced exact sequences in topology (1941), and Samuel Eilenberg and Saunders Mac Lane defined Ext\mathrm{Ext} and group cohomology in the 1940s, from questions in topology.
  • Henri Cartan and Samuel Eilenberg's Homological Algebra (1956) created the subject in its modern form — projective and injective resolutions, derived functors, Tor\mathrm{Tor} and Ext\mathrm{Ext} for modules. Nobuo Yoneda described Extn\mathrm{Ext}^n by nn-fold extensions (1954). Alexander Grothendieck's Tôhoku paper (1957) extended the theory to abelian categories and sheaves.
  • Maurice Auslander, David Buchsbaum and Jean-Pierre Serre (1956) characterised regular local rings homologically, and Jean-Louis Verdier's thesis (1960s) introduced derived and triangulated categories, following Grothendieck's ideas.
Further reading

Further reading

  • Charles A. Weibel, An Introduction to Homological Algebra (1994) — the standard graduate text: Chapters 1–3 cover this lesson.
  • Henri Cartan and Samuel Eilenberg, Homological Algebra (1956) — the founding text.
  • Joseph J. Rotman, An Introduction to Homological Algebra (2nd ed., 2009) — detailed, with many examples.
  • Peter J. Hilton and Urs Stammbach, A Course in Homological Algebra (2nd ed., 1997) — concise, with group cohomology.
  • Allen Hatcher, Algebraic Topology (2002) — Chapters 2–3 for homology, universal coefficients and Künneth from the topologist's side.
  • Sergei I. Gelfand and Yuri I. Manin, Methods of Homological Algebra (2nd ed., 2003) — derived categories and the modern viewpoint.