Knowing the middle of module of a short exact sequence This question actually comes up when I am working in algebraic topology.
If I am given a short exact sequence (we may consider this as a short exact sequence of $\mathbb{Z}$-modules) $$0\to \mathbb{Z}^2\to X\to\mathbb{Z}^7\to 0$$
for instance, can I conclude that $X$ is isomorphic to $\mathbb{Z}^9$? I know the claim is true for when we consider vector space, but I cannot quite persuade myself the same is immediately true for general ring. Is there anything to do with the freeness?
 A: In this case, you can conclude that $X \cong \mathbb Z^9$, and it is indeed due to freeness. Let's label these maps $\mathbb Z^2 \xrightarrow{f} X \xrightarrow{g} \mathbb Z^7$. Now, by exactness at $\mathbb Z^7$ the map $g$ is onto. Thus, each $e_i \in \mathbb Z^7$ can be written as $g(x_i)$ for some $x_i \in X$. Here, $e_i = (0, \dots, 0, 1, 0, \dots 0)$. By freeness of $\mathbb Z^7$, we can define a group homomorphism $s: \mathbb Z^7 \longrightarrow X$ such that $s(e_i) = x_i$. This then satisfies the condition $g \circ s = id_{\mathbb Z^7}$. $s$ therefore allows us to embed a copy of $\mathbb Z^7$ within $X$, which I claim is complementary to the copy of $\mathbb Z^2$ embedded in $X$ via $f$.
More formally, take $x \in X$. Then we can write $x = (x - s(g(x))) + s(g(x))$. The term $(x - s(g(x))) \in \ker(g)$ as $g \circ s = id$ and of course $s(g(x)) \in im(s)$. Hence, $X = \ker(g) + im(s)$. Now, we claim that they overlap trivially. Indeed, suppose we had an $x \in \ker(g) \cap im(s)$. Then we write $x = s(a)$ for some $a \in \mathbb Z^7$. We have by assumption that $0 = g(x) = g(s(a))$. Hence, as $g \circ s = id$, we have $a = 0$ so $x = s(0) = 0$. So the overlap $\ker(g) \cap im(s) = 0$. This allows us to write $X = \ker(g) \oplus im(s)$. By exactness at $X$, $\ker(g) = im(f)$, so $X = im(f) \oplus im(s)$. We have that $s$ is an isomorphism onto its image because $g \circ s = id$ and that $f$ is an isomorphism onto its image by exactness at $\mathbb Z^2$. Thus, $X = im(f) \oplus im(s) \cong \mathbb Z^2 \oplus \mathbb Z^7 \cong \mathbb Z^9$ as desired.
I used freeness here, but the more general property is that $\mathbb Z^7$ is a projective $\mathbb Z$ module. Projectivity is the precise condition that allows us to split the middle term of a short exact sequence into a direct sum of the left and right terms. See the splitting lemma.
Just for completeness, this is not true for all short exact sequences of $\mathbb Z$ modules. Consider $0 \rightarrow \mathbb Z\xrightarrow{\cdot 2} \mathbb Z \rightarrow \mathbb Z/2 \rightarrow 0$. We cannot write $\mathbb Z \cong \mathbb Z \oplus \mathbb Z/2$.
