Example of a submodule of $\mathbb{Z} \oplus \mathbb{Z}$ that is not a direct summand We will call a submodule $A$ a direct summand of $K$ if there exists a submodule $B$ such that $A \oplus B = K$.  I think this is a question that can be formulated in terms of rank of a proper free sumbmodules but I am not sure how to ask it.

Consider the $\mathbb{Z}$-module $\mathbb{Z} \oplus \mathbb{Z}$.  Is there an example of two submodules of $A,B$ of $\mathbb{Z} \oplus \mathbb{Z}$ such that $A$ and $B$ are direct summands of $\mathbb{Z} \oplus \mathbb{Z}$ but $A+B$ is not a direct summand of $\mathbb{Z} \oplus \mathbb{Z}$?

I first thought that $\mathbb{Z}\oplus 0$ and $ 0 \oplus \mathbb{Z}$ was an example until I realized every module is a direct summand of itself...
 A: $\newcommand\ZZ{\mathbb Z}$Every subgroup of $\ZZ\oplus\ZZ$ generated by an element of the form $(x,y)$ with $x$,~$y\in\ZZ$ coprime is a direct summand.
Using this, it is easy to give examples of subgroups which are direct summands. For example, it follows from this that the subgroups $A$ and $B$ generated by $(2,3)$ and by $(2,5)$ are direct summands of $\ZZ\oplus\ZZ$. 
Now, it is easy to check that $$
\left(
\begin{array}{cc}
 -1 & 1 \\
 -3 & 2
\end{array}
\right)
\left(
\begin{array}{cc}
 2 & 2 \\
 3 & 5
\end{array}
\right)
\left(
\begin{array}{cc}
 1 & -3 \\
 0 & 1
\end{array}
\right)
=
\left(
\begin{array}{cc}
 1 & 0 \\
 0 & 4
\end{array}
\right).
$$
(I found this factorization using a Smith normal form implementation)
As a consequence of this, we see that the image of the map $$\left(
\begin{array}{cc}
 2 & 2 \\
 3 & 5
\end{array}
\right):\ZZ^2\to\ZZ^2$$ has index $4$ in its codomain, so that the subgroup $A+B$ is not a summand.
A: Here's a slightly more high-brow way to say what Mariano is saying.  A vector $(a,b) \in \mathbb{Z}^2$ spans a direct summand if and only if it is primitive, i.e. not divisible by any integer other than $\pm 1$.  However, two linearly independent vectors $(a,b)$ and $(c,d)$ span a direct summand of $\mathbb{Z}^2$ (which necessarily must be $\mathbb{Z}^2$ itself) if and only if the determinant of the matrix $\left( \begin{array}{cc} a & c\\b & d \end{array}\right)$ is $\pm 1$.  This is a very special property.  If you write down two random primitive vectors, you will probably get a huge determinant.
