Find all subrings of $\mathbb{Z}^2$
Solution 1:
The strictest interpretation of the question is the one in which rings have identities and subrings have to share identities. Then any subring of $\mathbb{Z}^2$ contains the identity $(1, 1)$, hence the subring generated by $(1, 1)$, which is the diagonal copy $(k, k)$ of $\mathbb{Z}$. If $R$ is a subring, then to describe any extra elements of $R$ it suffices to describe the extra elements of the form $(0, k)$ (since the existence of any particular extra element $(a, b)$ can be deduced from the existence of the extra element $(a, b) - (a, a) = (0, b-a)$.) If there are any extra elements of the form $(0, k)$, they must form an ideal of the second copy of $\mathbb{Z}$ (since they must be closed under addition and under multiplication by the diagonal copy of $\mathbb{Z}$) hence the only choice is that the extra elements are of the form $(0, nk)$ for some fixed positive integer $n$ and all $k \in \mathbb{Z}$. These elements generate the ring $R_n$ of all pairs $(a, b)$ such that $a \equiv b \bmod n$, and these are all possible subrings (if one includes $R_{\infty}$, which corresponds to the diagonal case).
There are two other interpretations: one in which rings have to have identities but subrings don't have to share them, and one in which rings don't have to have identities. I'll leave these as an exercise if you're interested; you should think about the subrings of $\mathbb{Z}$ first as a warm-up.
Solution 2:
It proves instructive to highlight that the argument sketched in Qiaochu's answer is actually a special case of a general relationship between subalgebras and congruences. Generalizing the way that one defines congruences for the ring of integers modulo $\rm\,m,\,$ one defines a congruence $\equiv$ as an equivalence relation on an algebra $\rm A $ that is compatible with the operations on $\rm A $. For example, for rings such compatibility means that if $\rm a'\equiv a,\ b'\equiv b\,$ then $\rm\, a'+b'\,\equiv\, a+b\ $ and similarly for all other operations. Now, viewing the equivalence relation $\equiv$ as a subset of $\rm\ A\times A\,,\, $ this compatibility condition is a closure condition: $ $ if $\rm\, (a',a),\,(b',b)\in\;\equiv\,$ then $\rm\, (a'+b',a+b)\in\; \equiv\,,\, $ i.e. $\,\equiv\,$ is closed under addition in $\rm\, A\times A\,$. Thus an equivalence relation on $\rm A $ is compatible with the operations of $\rm A $ iff it forms a subalgebra of $\rm\,A^2$.
Returning to the case as hand, where $\rm A $ is the ring $\,\mathbb Z,\, $ let $\rm\,S\,$ be a subring of $\rm\,\mathbb Z\times\mathbb Z\,.\, $ By the above, to show that $\rm\,S\,$ is a congruence we need only show that it is an equivalence relation. Firstly, since here $\rm\ (1,1)\in S\ $ generates the full diagonal $\rm\ (1,1)\ \mathbb Z,\, $ we deduce that $\rm\,S\,$ is a reflexive relation. Secondly, $\rm\,S\,$ is symmetric since if $\rm\, (a,b)\in S\ $ then also in $\rm\,S\,$ is $\rm\ (a+b,a+b)-(a,b) = (b,a).\, $ Thirdly, $\rm\,S\,$ is transitive since if $\rm\, (a,b),\ (b,c)\in S\, $ then so too is $\rm\, (a,b)\,+\,(c,c)-(c,b) =(a,c).\, $ Finally,$\,$ for every ring $\rm\,R,\, $ a congruence $\equiv$ is uniquely determined by the congruence class of $\,0,\,$ since $\rm\ a\equiv b\iff a-b\equiv 0.\, $ But the congruence class of $\,0\,$ has the structure of an ideal since $\rm\ a,b\equiv 0\ \Rightarrow\ a+b\equiv 0\ $ and $\rm\ ac\equiv 0,\,$ for all $\rm\,c \in R\,$ (see this answer for more on such ideal-determined algebras, i.e. where congruences are determined by a single equivalence class).
This explains - from general principles - the connection observed in Qiaochu's post between subalgebras of $\,\mathbb Z\times\mathbb Z\,$ and ideals of $\rm\mathbb Z.\, $ Note that while the connections between congruences and subalgebras of the square, and congruences and ideals hold true for every ring $\rm\,R,\,$ the rest of the above argument doesn't follow since generally $\rm\,(1,1)\,$ doesn't generate the full diagonal $\rm\,(1,1)\, R.\,$ Indeed, it generates only the diagonal of the characteristic subring (the image of $\,\mathbb Z\,$ in $\rm\,R)$.
The above argument shows that in order to verify that a subalgebra of $\rm\,R\times R\,$ is a ring congruence it suffices to show that the subalgebra contains the diagonal (i.e. it is reflexive), since this implies the other equivalence relation properties (symmetry and transitivity). This leads to the following
Theorem $\ $ The following are equivalent for a ring $\rm\,R\,$ and set $\rm\ S\subset R\times R$
$\rm(1)\quad S\ $ is a congruence on $\rm\,R\,$
$\rm(2)\quad S\ $ is a subalgebra of $\rm\,R\times R\,$ and $\rm\,S \supset (1,1)\, R$
$\rm(3)\quad I\, :=\, \{\, r\in R\, :\ (r,0)\in S \,\}\ $ is an ideal in $\rm\,R\,$
Proof $\rm\ (1\Rightarrow 2)\ $ follows the same way as sketched above. $\rm\ (1\!\!\iff\!\! 3)$ is well-known.
$\rm (2\Rightarrow 3)\quad i,\,j\in I\ \Rightarrow\ (i,0),\,(j,0)\in S\ \Rightarrow\ (i,0)+(j,0)=(i+j,0)\in S\ \Rightarrow\ i+j\in I $
Also $\rm\; r\in R,\, j\in I\ \Rightarrow\ (r,r),\,(j,0)\in S\ \Rightarrow\ (r,r)\, *\, (j,0) = (r *\, j, 0)\in S\ \Rightarrow\ r\, *\,j \in I$
For further details see any good textbook on universal algebra, e.g. Burris and Sankappanavar's textbook A Course in Universal Algebra or George Bergman's An Invitation to General Algebra and Universal Constructions.