Solution (source code)

= Solution

<Independence> means that for all subsets $A,B\subseteq\mathbb Z$,
$$
\mathbb P(X\in A,Y\in B)=\mathbb P(X\in A)\mathbb P(Y\in B).
$$
For discrete <random variables>, this is equivalent to the pointwise factorization
$$
\boxed{p_{X,Y}(x,y)=p_X(x)p_Y(y)\quad\text{for every }x,y\in\mathbb Z.}
$$
One direction takes singleton sets; the other sums the pointwise identity over $A\times B$.