Show that $a+b+c+d$ is even in the following exact sequence I'm stuck on the following question:
If $0 \rightarrow \mathbb{Z}^a \rightarrow \mathbb{Z}^b \rightarrow \mathbb{Z}^c \rightarrow \mathbb{Z}^d \rightarrow 0$ is an exact sequence, show that $a+b+c+d$ is even.
I'm sure that I'm missing some obvious trick, any help would be appreciated.
 A: From the definition of exact:


*

*The zero dimensional image of $0$ is the kernel in the map $\mathbb{Z}^a \rightarrow \mathbb{Z}^b$.

*The $a$ dimensional image of $\mathbb{Z}^a$ is the kernel in the map $\mathbb{Z}^b \rightarrow \mathbb{Z}^c$, so the image has dimension $b-a$.

*Likewise, the image in $\mathbb{Z}^c \rightarrow \mathbb{Z}^d$ has dimension $c-(b-a)$.

*Finally, the $c-(b-a)$ dimensional image in $\mathbb{Z}^c \rightarrow \mathbb{Z}^d$ must be all of $\mathbb{Z}^d$, since the next map has all of $\mathbb{Z}^d$ as kernel.


So we have $d = c -(b-a)$.  Adding $a$, $b$, and $c$ to both sides, we have \begin{align*}
a+b+c+d &= a+b+c + c - (b - a)  \\
    &= a+b+c + c - b + a  \\
    &= 2a + 2c  \\
    &= 2(a+c)  \text{,}
\end{align*}
so is even.
(If you are concerned about the somewhat cavalier use of the rank-nullity theorem on these free $\mathbb{Z}$-modules (in fact for any module over a PID), see Rank-nullity theorem for free $\mathbb Z$-modules.)
A: You can split the exact sequence into two short exact sequences
\begin{gather}
0\to\mathbb{Z}^a\to\mathbb{Z}^b\to A\to0\\
0\to A\to\mathbb{Z}^c\to\mathbb{Z}^d\to0
\end{gather}
The second sequence tells you that $A\cong\mathbb{Z}^{c-d}$, so the first one gives $a+c-d=b$.
Can you finish?

Actually this is very simple if you tensor with $\mathbb{Q}$, which is flat so it preserves all exact sequences (and this works for finitely generated free modules over any domain): you get the exact sequence
$$
0\to\mathbb{Q}^a\to\mathbb{Q}^b\to\mathbb{Q}^c\to\mathbb{Q}^d\to0
$$
and the statement becomes an easy one for finite dimensional vector spaces, not even requiring to know that $A$ is free (which it couldn't be over a domain which is not a PID).
