Let $M$ and $N$ be two abelian groups. Suppose that $M$ is a direct factor of $N$ (i.e. there are homomorphisms $i:M\rightarrow N$ and $p:N\rightarrow M$ such that $p\circ i=id_M$) and $N$ is also a direct factor of $M$. Is $M$ isomorphic to $N$?
2 Answers
No. A classic result of Corner (On a conjecture of Pierce concerning direct decompositions of Abelian groups. 1964 Proc. Colloq. Abelian Groups (Tihany, 1963) pp. 43–48, MR0169905 (30 #148)) shows that for any positive integer $r$, there exist a countable torsion free abelian group $G$ such that the direct sum of $m$ copies of $G$ is isomorphic to the direct sum of $n$ copies of $G$ if and only if $n\equiv m\pmod{r}$.
In particular, take $r=2$; there is an abelian group $G$ such that $G\cong G\oplus G\oplus G$, but $G\not\cong G\oplus G$. Take $M=G\oplus G$ and $N=G\cong G\oplus G\oplus G$. Then $M$ is clearly a direct factor of $N$, and $N$ is a direct factor of $N\oplus G= (G\oplus G\oplus G)\oplus G \cong G\oplus G\cong M$, but $N\not\cong M$.
Arturo Magidin's answer is absolutely correct, but there's an earlier counterexample than Corner's.
This question is Kaplansky's first "test problem" in his 1954 book on Infinite Abelian Groups, and was solved by Sąsiada in 1961:
Sąsiada, E., Negative solution of I. Kaplansky's first test problem for Abelian groups and a problem of K. Borsuk concerning cohomology groups, Bull. Acad. Pol. Sci., Ser. Sci. Math. Astron. Phys. 9, 331-334 (1961). ZBL0105.25902.