Determining all homomorphisms from $\Bbb Z_n \times \Bbb Z_m$ to itself I know how to determine all homomorphisms from $\def\Z{\Bbb Z}\Z_n$ to $\Z_m$ (and to itself, naturally), but I can't seem to find an approach towards determining all homomorphisms from $\Z_n \times \Z_m$ to itself. For example, from $\Z_2\times\Z_2$ to itself. 

You can simply send the generator of $\def\Z{\Bbb Z}\Z/n\Z$ to any element $x$ satisfying $nx=0$, and the generator of $\def\Z{\Bbb Z}\Z/m\Z$ to any element $y$ satisfying $my=0$. Then of course $(a,b)$ maps to $ax+by$. The sets of allowed values for $x,y$ are easy to determine, but depend somewhat on possible common divisors of $n$ and $m$.
For instance for $(\Z/2\Z)\times(\Z/2\Z)$, all elements satisfy $2x=0$, so you have $4^2=16$ different group endomorphisms.
