TITLE: $M\oplus A \cong A\oplus A$ implies $M\cong A$?
QUESTION [11 upvotes]: Let $A$ be a commutative unital ring and $M$ an $A$-module. Suppose that $M\oplus A \cong A\oplus A$. Then is $M\cong A$?

We have that both $M\oplus A$ and $A\oplus A$ are biproduct for $(A, A)$ and $(M, A)$, so actually short exact sequences. Further $A\oplus A$ is the free $A$-module of rank two. However I can't conclude. Maybe I have to use some extension stuff from homological theory or there are some apparent counter-examples that I'm not able to figure out.

REPLY [3 votes]: Let 
$$
\begin{pmatrix}a&b\\ u&v\end{pmatrix}:A\oplus A\to A\oplus M,
$$ 
with $a,b$ in $A$ and $u,v$ in $M$, be an isomorphism. Let 
$$
\begin{pmatrix}c&f\\ d&g\end{pmatrix}:A\oplus M\to A\oplus A
$$ 
with $c,d$ in $A$ and $f,g:M\to A$, be its inverse. (In this post all maps are $A$-linear.)
It is tedious but straightforward to check that 
$$
av-bu:A\to M
$$ 
and 
$$
cg-df:M\to A
$$ 
are inverse isomorphisms.
Edit. I turned this answer into a community wiki because, as pointed out by user26857, the argument had been described a long time ago by Peter LeFanu Lumsdaine in comments under the accepted answer.