TITLE: Hopfian modules
QUESTION [7 upvotes]: My question is slightly motivated by basic results in linear algebra, for example, that if $F$ is a field then a surjective linear map $F^n \rightarrow F^n$ is injective. More generally, any surjective endomorphism of a finitely generated module for a Noetherian ring is injective.
Let $R$ be a unital ring, not necessarily commutative. An $R$-module $M$ is Hopfian if any surjective $R$-module endomorphism $f : M \rightarrow M$ is injective. 

Is there a ring $R$ and an $R$-module $M$ such that $M$ is Hopfian but $M \oplus M$ is not?

As a follow-up, in the event the answer is `yes', is there an example where $M=R$?

REPLY [7 votes]: Let $R$ be Shepherdson's ring, that is, a domain for which the two by two matrix ring, $M_2 R$, contains
elements $x$ and $y$ such that $xy = 1$, but $yx \neq 1$. With right module $M =
R$, every homomorphism $M \to M$ is given by left multiplication by an
element of $R$, so every nonzero endomorphism of $M$ is one to one (as $R$
has no zero divisors).
On the other hand, $x$ is an endomorphism of $ M \oplus M$ that is
clearly onto, but is not one to one, as $x(1-yx) = 0$.
To clarify, a finitely generated module free on $n$ generators is Hopfian iff the $n \times n$ matrix ring is directly finite (latter means one-sided inverses are two-sided). The argument is simple: if $x$ is onto, then the map splits.