Elements squaring to zero form an ideal in $\mathbf{Z}/n\mathbf{Z}$ In general, the sum of 2 commuting elements squaring to zero in a ring will always cube to zero, but not necessarily square to zero. For example, it can easily be shown that $(x+y)^2 \notin (x^2, y^2)$ in the ring of polynomials in two variables $x$ and $y$ over a field $K$ not of characteristic 2, so the cosets of $x$ and $y$ in the quotient ring $K[x,y]/(x^2, y^2)$ are nilpotents squaring to zero but their sum does not square to zero (although it cubes to zero). However, it is possible for elements squaring to zero in a non-reduced commutative ring to actually form an ideal (e.g. it holds in the ring $\mathbf{Z}/n\mathbf{Z}$ for any positive integer $n$).
Question: Why do the elements in the ring $\mathbf{Z}/n\mathbf{Z}$ squaring to zero form an ideal?
This question is equivalent to asking whether $n \vert x^2$ and $n \vert y^2$ together imply that $n \vert (x+y)^2$, which in turn is equivalent to asking whether the same hypotheses imply that $n \vert 2xy$ (since $2xy=(x+y)^2-x^2-y^2$).
In fact, we can show that $n \vert x^2$ and $n \vert y^2$ together imply that $n \vert xy$ if we know that $\gcd(x^2, y^2)=\gcd(x, y)^2$ (which in fact is always true). Indeed, since $n$ divides both $x^2$ and $y^2$, it also divides $\gcd(x^2, y^2)$, which equals $\gcd(x, y)^2$, but $\gcd(x, y)^2$ in turn divides $xy$, so $n$ also divides $xy$ (and hence $2xy$) by transitivity of divisibility.
If one needs to look up the exact generator of the ideal of elements squaring to zero in $\mathbf{Z}/n\mathbf{Z}$, then one only needs to look up sequence A019554 in the OEIS.
 A: Recall that Prufer domains are domains $D$ where every nonzero finitely generated ideal is cancellable (or invertible). Thus they are non-Noetherian generalization of Dedekind domains. Equivalently they are integrally-closed domains $D$ satisfying $\!\!\!\!\overbrace{(x,y)^2 }^{\textstyle (x^2,\color{#c00}{xy},y^2)}\!\!\!\!\!\! =(x^2,y^2)\ [\!\iff \color{#c00}{xy}\in (x^2,y^2)\,]$
So $\,  x^2\!=0=y^2\,$ in $D/I\Rightarrow\, x^2,y^2\in I\Rightarrow\, xy \in (x^2,y^2)\subseteq I\,\Rightarrow\, xy = 0=(x\!+\!y)^2\,$ in $R/I$
OP is the special case $\,I = n\Bbb Z,\,$ and $\,D = \Bbb Z,\,$ which is a PID so Prufer.
Remark $ $ It is easy to see that nonzero cancellable ideals satisfy the property at hand, namely
$$\begin{align}(x,y)(x^2,y^2) =&\ (x^3,x^2y,xy^2,x^3)\\[.3em]
=&\ (x,y)^3\\[.3em]
{\rm thus}\ \ (x^2,y^2) =&\ (x,y)^2\ \text{ by cancelling } \,(x,y)\neq 0\end{align}$$
Prüfer domains are ubiquituous due to a remarkable confluence of interesting characterizations. For example, they are those domains satisfying the Chinese Remainder Theorem for ideals, or Gauss's Lemma for polynomial content ideals, or for ideals: $\rm\ A\cap (B + C) = A\cap B + A\cap C,\  $ or $\rm\ (A + B)\ (A \cap B) = A\ B,\ $ or $\rm\ A\supset B\ \Rightarrow\ A\:|\:B\ $ for fin. gen. $\rm\:A\:$ etc. It has been remarked that there are probably around $100$ such characterizations known. See this answer for around $30$  characterizations. 
A: By the Chinese remainder theorem it is enough to prove this when $n$ is a prime power -- say, $n=p^m$.
Since $p^m \mid a^2$ we must have that $p^{\lceil m/2\rceil} \mid a$, and similarly $p^{\lceil m/2\rceil}\mid b$. But then $p^{2\lceil m/2\rceil} \mid 2ab$, and the exponent on the LHS of that is either $m$ or $m+1$.
A: Let $v_p(a)$ be the exponent of $p$ in the prime factorization of $a$.
Then, $ a \mid b$ iff $v_p(a) \le v_p(b)$ for all primes $p$.
Thus, $n \mid x^2$ and $n \mid y^2$ iff $v_p(n) \le 2 v_p(x)$ and $v_p(n) \le 2 v_p(y)$ for all $p$.
Then, $2v_p(n) \le 2 v_p(x) + 2 v_p(y)$, which implies $v_p(n) \le v_p(x) + v_p(y)=v_p(xy)$ for all $p$.
Therefore, $n \mid x^2$ and $n \mid y^2$  imply $n \mid xy$.
