38. Provide an example of random variables $\xi_{n}, n \geqslant 1$, such that

$$
\mathrm{E} \sum_{n=1}^{\infty} \xi_{n} \neq \sum_{n=1}^{\infty} \mathrm{E} \xi_{n}
$$
Solution. Define $\xi_{n}, n \geqslant 1$, by

$$
\xi_{n}=n I(n U \leqslant 1)-(n-1) I((n-1) U \leqslant 1),
$$

where $U$ is a random variable with a uniform distribution on $[0,1]$. Then

$$
\sum_{n=1}^{\infty} \xi_{n}=\lim _{n} \sum_{i=1}^{n} \xi_{i}=\lim _{n} n I(n U \leqslant 1)=0
$$

with probability one. Thus

$$
\mathrm{E} \sum_{n=1}^{\infty} \xi_{n}=0 \neq 1=\lim _{n} \mathrm{E} n I(n U \leqslant 1)=\lim _{n} \sum_{i=1}^{n} \mathrm{E} \xi_{i}=\sum_{n=1}^{\infty} \mathrm{E} \xi_{n}
$$