Solution (source code)

= Solution

Inclusion and passage to the quotient give a <short exact sequence of chain complexes>
$$
0\longrightarrow C_\bullet(L)
\xrightarrow{i}C_\bullet(K)
\xrightarrow{q}C_\bullet(K,L)
\longrightarrow0.
$$
Define the <connecting homomorphism> as follows. If $[c]\in H_k(K,L)$, then $\bar\partial[c]=0$, so $\partial c\in C_{k-1}(L)$. Since $\partial^2c=0$, it is a <chain cycle> in $L$, and we set
$$
\delta[c]=[\partial c]\in H_{k-1}(L).
$$
Changing $c$ by a relative boundary or a chain in $L$ changes $\partial c$ by a boundary in $L$, so $\delta$ is well defined.

The resulting sequence is
$$
\boxed{
\cdots\longrightarrow H_k(L)
\xrightarrow{i_*}H_k(K)
\xrightarrow{q_*}H_k(K,L)
\xrightarrow{\delta}H_{k-1}(L)
\xrightarrow{i_*}H_{k-1}(K)
\longrightarrow\cdots.}
$$
We verify exactness directly. If a cycle of $K$ maps to zero in the relative homology, it differs from a boundary by a cycle in $L$, so it lies in $\operatorname{im}i_*$. If a relative cycle $[c]$ satisfies $\delta[c]=0$, then $\partial c=\partial\ell$ for some $\ell\in C_k(L)$; hence $c-\ell$ is a cycle in $K$ mapping to $[c]$. Finally, if a cycle $z\in C_{k-1}(L)$ becomes a boundary in $K$, say $z=\partial c$, then $[c]$ is a relative cycle with $\delta[c]=[z]$. The reverse containments follow immediately from consecutive composites being zero. This proves the <long exact sequence in relative homology>.