Idempotent endomorphisms on $\mathbb{Z}\times \mathbb{Z}$ Recall that a homomorphism $f:G\longrightarrow G$ is called idempotent if $f\circ f=f$.   
What are idempotent homomorphisms $f:\mathbb{Z}\times \mathbb{Z}\longrightarrow \mathbb{Z}\times \mathbb{Z}$ exactly?
 A: Hint: a homomorphism ${\mathbf Z}^2\to {\mathbf Z}^2$ is represented by $2\times 2$ matrix of integers. Matrices with nonzero determinant have cancellation.
A: There's the zero endomorphism, the identity, and all endomorphisms given by matrices of the form
$$ \begin{bmatrix} a & b \\ a(1-a)/b & 1-a \end{bmatrix} $$
where $ a, b \in \mathbb Z $ and $ b \mid a(1-a) $. We can get this by noting that the minimal polynomial of such an operator must divide $ x^2 - x $, so there are three choices; these three cases correspond to the three possible choices of minimal polynomial. (To derive the above form, compute the characteristic polynomial and compare coefficients.) 
A: Let $R$ be an arbitrary commutative ring and $V$ a $R$-module. If $f$ is an endomorphism of $V$ with $f^2=f$, then $V=\mathrm{Ker}(f)\oplus\mathrm{Im}(f)$ and $f$ is the projection on the second factor, in this decomposition.
Now suppose that $R$ is a PID (or more generally that every projective $R$-module is free, e.g., $R$ is a polynomial algebra or a local ring). Take $V=R^n$. Then every decomposition of $R^n$ is conjugate, by some element of $\mathrm{GL}_n(R)$, to a standard decomposition $R^k\oplus R^{n-k}$.
This means that any matrix $u$ (square of size $n$) with $u^2=u$ is conjugate to the corresponding diagonal matrix, which can always be chosen of determinant 1. For $R$ additionally required to be a domain, $n=2$ and $u\neq 0,1$, this yields the form given in Starfall's answer.
