5. Let $\xi_{0}, \xi_{1}, \ldots, \xi_{N}$ be independent Bernoulli random variables, $\mathrm{P}\left\{\xi_{i}=1\right\}=\mathrm{P}\left\{\xi_{i}=-1\right\}=1 / 2, S_{n}=\xi_{1}+\ldots+\xi_{n}$ and $X_{n}=\xi_{0}(-1)^{S_{n}}-$
a discrete telegraph signal, $1 \leqslant n \leqslant N$. Find the mean and variance of the quantities $X_{n}$.

Also find the conditional distributions $\mathrm{P}\left\{X_{n}=1 \mid \xi_{0}=i\right\}, i= \pm 1$, $1 \leqslant n \leqslant N$.
Solution. Since the random variables $\xi_{0}$ and $(-1)^{S_{n}}$ are independent and $\mathrm{E} \xi_{0}=0$, we obtain

$$
\mathrm{E} X_{n}=\mathrm{E}\left(\xi_{0}(-1)^{S_{n}}\right)=\mathrm{E} \xi_{0} \mathrm{E}(-1)^{S_{n}}=0
$$

Since $X_{n}^{2} \equiv 1$, we have

$$
\mathrm{D} X_{n}=\mathrm{E} X_{n}^{2}-\left(\mathrm{E} X_{n}\right)^{2}=1
$$

Notice that $(-1)^{S_{n}} \equiv(-1)^{n}$, therefore

$\mathrm{P}\left\{X_{n}=1 \mid \xi_{0}=1\right\}=\mathrm{P}\left\{(-1)^{n}=1 \mid \xi_{0}=1\right\}= \begin{cases}1, & n \text { even, } \\ 0, & n \text { odd } ;\end{cases}$

$\mathrm{P}\left\{X_{n}=1 \mid \xi_{0}=-1\right\}=\mathrm{P}\left\{(-1)^{n}=-1 \mid \xi_{0}=-1\right\}= \begin{cases}0, & n \text { even, } \\ 1, & n \text { odd. }\end{cases}$