$\sum_{i=0}^{n} (-1)^i l(H_i)=\sum_{i=0}^{n} (-1)^i l(G_i)$ 
Let
$$0 \overset{d_{n+1}}{\rightarrow} G_n \overset{d_n}{\rightarrow} G_{n-1}\overset{d_{n-1}}{\rightarrow}\ldots\overset{d_2}{\rightarrow}G_1 \overset{d_1}{\rightarrow} 0$$ be a sequence of modules and
homomorphisms over the commuative ring $R$ such that $d_i \circ d_{i+1}=0$ for all $i=1,..,n-1$, and suppose that $G_i$ has finite
length for all $i$.
Set $H_i=\ker d_i / \text{im} \, d_{i+1}$. Show that
$H_i$ has finite length for all $i$ and that $$\sum_{i=0}^{n} (-1)^i l(H_i)=\sum_{i=0}^{n} (-1)^i l(G_i)$$

It's obvious to see that $H_i$ has finite length by the exact sequence
$$0 \to Im \; d_{i+1}\to Ker \; d_i \to Ker \; d_i / Im \; d_{i+1}\to 0$$
But I can indicate that $\sum_{i=0}^{n} (-1)^i l(H_i)=\sum_{i=0}^{n} (-1)^i l(G_i)$. Can anyone help me?
 A: I think $R$ can be an arbitrary ring (not necessarily unital).  The fact that each $H_i$ is of finite length is due to the Jordan-Hölder theorem.  I assume that $l$ is the module length function.  We first prove a general result (1).  
Let $A\overset{\alpha}{\longrightarrow}B\overset{\beta}{\longrightarrow}C$ be a sequence of homomorphisms of  (not necessarily unitary) left $R$-module, where $A$, $B$, and $C$ are left $R$-modules of finite length and $\beta\circ\alpha=0$.  Write $B'$ for $\ker\beta/\operatorname{im}\alpha$, and $q:\ker \beta\to B'$ is the canonical projection.  We can decompose the maps into short exact sequences of left $R$-modules as follows:
$$0\to\ker \alpha \overset{\subseteq}{\hookrightarrow} A\overset{\alpha}{\twoheadrightarrow} \operatorname{im}\alpha\to 0,$$
$$0\to \operatorname{im}\alpha \overset{\subseteq}{\hookrightarrow} \ker\beta \overset{q}{\twoheadrightarrow} B' \to 0,$$
and
$$0\to \ker\beta\overset{\subseteq}{\hookrightarrow}B \overset{\beta}{\twoheadrightarrow} \operatorname{im}\beta\to 0.$$
It is easy to see that $$l(B)=l(\ker\beta)+l(\operatorname{im}\beta),$$
$$l(\ker\beta)=l(\operatorname{im}\alpha)+l(B'),$$
and
$$l(\operatorname{im}\alpha)=l(A)-l(\ker\alpha).$$
Thus,
$$l(B)=l(B')+l(A)-l(\ker\alpha)+l(\operatorname{im}\beta).\tag{1}$$
Now, if you have $0 \overset{d_{n+1}}{\rightarrow} G_n \overset{d_n}{\rightarrow} G_{n-1}\overset{d_{n-1}}{\rightarrow}\ldots \overset{d_2}{\rightarrow}G_1 \overset{d_1}{\rightarrow} 0$, then for $i=0,1,2,\ldots,n$, we have from (1) that
$$l(G_i)=l(H_i)+l(G_{i+1})-l(\ker d_{i+1})+l(\operatorname{im}d_i).$$
Here, $G_0=G_{n+1}=0$, $d_0=0$, and $H_0=0$.  Thus,
$$l(G_i)-l(G_{i+1})=l(H_i)-l(\ker d_{i+1})+l(\operatorname{im}d_i).$$
That is,
$$\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=\sum_{i=0}^n (-1)^i l(H_i)-\sum_{i=0}^{n}\,(-1)^il(\ker d_{i+1})+\sum_{i=0}^n(-1)^il(\operatorname{im}d_i).$$
So,
$$\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=\sum_{i=0}^n (-1)^i l(H_i)+\sum_{i=1}^{n+1}\,(-1)^il(\ker d_{i})-\sum_{i=1}^{n+1}(-1)^{i}l(\operatorname{im}d_{i-1}).$$
Since $\operatorname{im}d_{0}=\operatorname{im}d_1=0$ and $\ker d_{n+1}=\operatorname{im}d_{n+1}=0$, we get
$$\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=\sum_{i=0}^n (-1)^i l(H_i)+\sum_{i=1}^{n}\,(-1)^il(\ker d_{i})-\sum_{i=3}^{n+2}(-1)^{i}l(\operatorname{im}d_{i-1}).$$
Thus,
$$\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=\sum_{i=0}^n (-1)^i l(H_i)+\sum_{i=1}^{n}\,(-1)^il(\ker d_{i})-\sum_{i=1}^{n}(-1)^{i}l(\operatorname{im}d_{i+1}).$$
That is,
$$\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=\sum_{i=0}^n (-1)^i l(H_i)+\sum_{i=1}^{n}\,(-1)^i\big(l(\ker d_{i})-l(\operatorname{im}d_{i+1})\big).$$
Because $l(H_i)=l(\ker d_{i})-l(\operatorname{im}d_{i+1})$, we obtain
$$\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=\sum_{i=0}^n (-1)^i l(H_i)+\sum_{i=1}^{n}\,(-1)^il(H_i)=2\sum_{i=1}^{n}\,(-1)^il(H_i).$$
It is not difficult to see that $\displaystyle\sum_{i=0}^n(-1)^i\big(l(G_i)-l(G_{i+1})\big)=2\sum_{i=1}^{n}\,(-1)^il(G_i)$.  This means
$$\sum_{i=1}^{n}\,(-1)^il(G_i)=\sum_{i=1}^{n}\,(-1)^il(H_i).$$
As a warning, maybe we should remove the trivial cases $n=0$ (with the sequence $0\to 0$), $n=1$ (with the sequence $0\to G_1\to 0$), and $n=2$ (with the sequence $0\to G_2\to G_1\to 0$ from the proof above.  Deal with them separately, but it is pretty easy for these cases.
