Solution (source code)

= Solution

Use integral <singular homology>. The <singular chain group> $C_n(B)$ is the <free abelian group> on continuous maps $\Delta^n\to B$, and its <boundary operator> is
$$
\partial\sigma=\sum_{j=0}^n(-1)^j\sigma|_{[0,\ldots,\widehat j,\ldots,n]}.
$$
For $i<j$, deleting vertex $j$ and then vertex $i$ has sign $(-1)^{i+j}$, while deleting $i$ and then the shifted vertex $j-1$ has sign $(-1)^{i+j-1}$. Both yield the same codimension-two face. Pairing these terms proves $\partial^2=0$. The inclusion $A\subset B$ identifies $C_n(A)$ with the subgroup spanned by those simplices having image in $A$, so it is injective and preserved by $\partial$.

The <relative chain complex> is $C_n(B,A)=C_n(B)/C_n(A)$ with induced boundary $\partial\bar b=\overline{\partial b}$. Thus there is a degreewise <short exact sequence of chain complexes>
$$
0\longrightarrow C_*(A)\xrightarrow{i}C_*(B)\xrightarrow{q}C_*(B,A)\longrightarrow0.
$$
Inclusion and quotient take <homological cycles> to <homological cycles> and boundaries to boundaries, hence define the <group homomorphisms> $i_*$ and $q_*$ on <homology (mathematics)>. We construct and prove exactness of the resulting sequence directly, rather than invoke an unproved algebraic lemma:
$$
\cdots\longrightarrow H_{n+1}(B,A)\xrightarrow{\delta}H_n(A)\xrightarrow{i_*}H_n(B)\xrightarrow{q_*}H_n(B,A)\xrightarrow{\delta}H_{n-1}(A)\longrightarrow\cdots
$$
ending in $H_0(A)\to H_0(B)\to H_0(B,A)\to0$.

For the <relative homology connecting homomorphism>, lift a <relative cycle> $\bar b\in C_n(B,A)$ to $b\in C_n(B)$. Since $\partial\bar b=0$, the chain $\partial b$ belongs to $C_{n-1}(A)$; it is a <homological cycle> because $\partial^2=0$. Define
$$
\delta[\bar b]=[\partial b]\in H_{n-1}(A).
$$
Changing the lift by $a\in C_n(A)$ changes the boundary by $\partial a$, hence does not change its <homology (mathematics)> class. More generally, if a different <relative cycle> represents the same <relative homology class>, lifts satisfy $b'-b=\partial c+a$ for some $c\in C_{n+1}(B)$ and $a\in C_n(A)$. Then $\partial b'-\partial b=\partial a$. This proves independence both of the lift and of the <homology (mathematics)> representative. Lifting a sum by the sum of lifts proves additivity, so $\delta$ is a well-defined <group homomorphism>.

At $H_n(A)$, an element in the image of $\delta$ is represented by $\partial b$ for some $b\in C_{n+1}(B)$, so its image in $H_n(B)$ is zero. Conversely, if a <homological cycle> in $A$ $a$ has $i_*[a]=0$, then $a=\partial b$ for a $B$-chain $b\in C_{n+1}(B)$. Its quotient $\bar b$ is a <relative cycle> and $\delta[\bar b]=[a]$. Thus
$$
\boxed{\operatorname{im}\bigl(\delta:H_{n+1}(B,A)\to H_n(A)\bigr)=\ker i_*.}
$$
For completeness, the other terms are exact by the same elementary chain argument. At $H_n(B)$, clearly $q_*i_*=0$. If a <homological cycle> in $B$ $b$ has zero relative class, then $\bar b=\partial\bar c$ for a quotient chain $\bar c$. Lifting $c$ gives $a=b-\partial c\in C_n(A)$, and $\partial a=0$. Hence $[b]=i_*[a]$, proving $\ker q_*=\operatorname{im}i_*$. At $H_n(B,A)$, absolute <homological cycles> have zero connecting image. Conversely, if $\delta[\bar b]=0$, then $\partial b=\partial a$ for some $a\in C_n(A)$; the chain $b-a$ is an absolute <homological cycle> and maps to $[\bar b]$. Therefore $\ker\delta=\operatorname{im}q_*$. In degree zero every quotient chain lifts to an absolute <homological cycle>, because the differential to degree $-1$ is zero, so $q_*:H_0(B)\to H_0(B,A)$ is surjective. These proofs establish the whole <long exact sequence in relative homology> and all the algebraic facts used in its construction.