Solution (source code)

= Solution

By <independent random variables>[independence] of the two <simple random walk>[simple random walks], <linearity of expectation>, and symmetry of their transition probabilities,
$$
\begin{aligned}
\mathbb E Z
&=\sum_{n=0}^{\infty}\mathbb P(X_n=Y_n)\\
&=\sum_{n=0}^{\infty}\sum_{x\in\mathbb Z}p_{0x}(n)^2\\
&=\sum_{n=0}^{\infty}\sum_{x\in\mathbb Z}p_{0x}(n)p_{x0}(n).
\end{aligned}
$$
The <Chapman-Kolmogorov equation> identifies the inner sum as $p_{00}(2n)$, so
$$
\boxed{\mathbb E Z=\sum_{n=0}^{\infty}p_{00}(2n)}.
$$
A <simple random walk on the integer line> can return to $0$ only at an <even number>[even] time. Since it is recurrent at $0$, part (a) gives
$$
\sum_{m=0}^{\infty}p_{00}(m)=\sum_{n=0}^{\infty}p_{00}(2n)=\infty.
$$
Therefore $\boxed{\mathbb E Z=\infty}$.