Fix an integer n0n\ge0, using zero chain and cochain groups in negative degrees. Let AXA\subseteq X be a subspace of a topological space XX, and let GG be an abelian group. The inclusion gives a subcomplex C(A;Z)C(X;Z)C_\bullet(A;\mathbb Z)\subseteq C_\bullet(X;\mathbb Z). The relative singular chain group is

Cn(X,A;Z):=Cn(X;Z)/Cn(A;Z),C_n(X,A;\mathbb Z):=C_n(X;\mathbb Z)/C_n(A;\mathbb Z),

and the boundary on C(X;Z)C_\bullet(X;\mathbb Z) induces a boundary on these quotient groups because C(A;Z)C_\bullet(A;\mathbb Z) is a subcomplex. The relative cochains with coefficients in GG are

Cn(X,A;G):=Hom ⁣(Cn(X,A;Z),G).C^n(X,A;G):=\operatorname{Hom}\!\bigl(C_n(X,A;\mathbb Z),G\bigr).

Their coboundary is δφ=φ\delta\varphi=\varphi\circ\partial. The nnth relative singular cohomology group is

Hn(X,A;G):=ker(δ:Cn(X,A;G)Cn+1(X,A;G))/im(δ:Cn1(X,A;G)Cn(X,A;G)).H^n(X,A;G):= \ker(\delta:C^n(X,A;G)\to C^{n+1}(X,A;G)) /\operatorname{im}(\delta:C^{n-1}(X,A;G)\to C^n(X,A;G)).

Thus relative cohomology is the cohomology of the cochain complex dual to the quotient chain complex of the pair. When A=A=\varnothing, this recovers ordinary singular cohomology Hn(X;G)H^n(X;G).

Maps of pairs

A continuous map of pairs f:(X,A)(Y,B)f:(X,A)\to(Y,B), meaning f:XYf:X\to Y with f(A)Bf(A)\subseteq B, induces a pullback

f:Hn(Y,B;G)Hn(X,A;G).f^*:H^n(Y,B;G)\longrightarrow H^n(X,A;G).

The short exact sequence of chain complexes 0C(A;Z)C(X;Z)C(X,A;Z)00\to C_\bullet(A;\mathbb Z)\to C_\bullet(X;\mathbb Z)\to C_\bullet(X,A;\mathbb Z)\to0 yields the long exact sequence of the pair.

Cup product with an absolute class

For coefficients in a commutative ring RR, the usual cochain cup product restricts to

Hp(X;R)×Hq(X,A;R)Hp+q(X,A;R).H^p(X;R)\times H^q(X,A;R)\longrightarrow H^{p+q}(X,A;R).

Indeed, a relative cochain is an absolute cochain vanishing on chains in AA; its product with an absolute cochain still vanishes on such chains. This gives relative cohomology a module structure over the absolute cohomology ring.