# Convergence of random variables in probability but not almost surely.

Can somebody provide me with a sequence of (real-valued) functions, say on $[0,1]$ with the Lebesgue measure, such that the sequence converges in probability, or maybe in $\Vert \cdot \Vert _{L^2}$, but does not converge almost surely?

Consider a sequence $$\{X_n\}$$ of independent random variables such that $$P(X_n=1)=\frac 1n$$ and $$P(X_n=0)=1-\frac 1n$$. For $$0<\varepsilon<1/2$$ we have $$P(|X_n|\geq \varepsilon)=\frac 1n$$ which converges to $$0$$ hence $$X_n\to 0$$ in probability. Since $$\sum_{n\geq 1}P(X_n=1)=+\infty$$ and the events $$\{X_n=1\}$$ are independent, second Borel-Cantelli lemma ensures that $$P(\limsup_n \{X_n=1\})=1$$ hence the sequence $$\{X_n\}$$ does not converge to $$0$$ almost everywhere (in fact the set on which this sequence does not converge to $$0$$ has probability $$1$$).

Counter-example for convergence in $$L^p$$ have already be provided, but I think the example I gave is also useful.

• Hope I can revive this old question. I just started on the subject of martingale convergence and convergence of random variables plays a big part in that. I was wondering about your statement "For $\epsilon$<1+2 we have $\dots$". Doesn't convergence in probability state that something has to hold for all $\epsilon > 0$? And where does the idea of setting $\epsilon<1+2$ even come from? Sorry for being late to the party, hope you can still help me! – Charlie Shuffler Nov 18 '18 at 9:06
• I meant $\varepsilon< 1/2$. If $P(\lvert X_n\rvert \geq \varepsilon)\to 0$ for all $\varepsilon\in (0,1/2)$ then it holds also for all positive $\varepsilon$. Here the point is that for such $\varepsilon$, the event $(\lvert X_n\rvert \geq \vapsilon)$ is contained in $(X_n=1)$ and this inclusion may only hold for $n$ large enough for an arbitrary $\varepsilon$. – Davide Giraudo Nov 18 '18 at 18:07
• Alright that makes more sense. Could you elaborate on why you would have to set $\epsilon < 1/2$ and not, for example $\epsilon < 1$ or $\epsilon < 1/4$ or would all of these choices have been fine also? And do you mean with the last sentence of your comment that the inclusion holds for any $n$ and any $\epsilon$? Thanks again for helping. – Charlie Shuffler Nov 18 '18 at 18:44
• I'm new to this website but I think I forgot to tag you. – Charlie Shuffler Nov 18 '18 at 19:08

The most common example is the ''sliding hump.'' What we do is cut $[0,1]$ into, say, two intervals $[0,1/2]=I_{1}$ and $[1/2, 1]=I_{2}$. Then set $f_{1}=\chi_{I_{1}}$ and $f_{2}=\chi_{I_{2}}$. Then, cut $[0,1]$ into three intervals, and consider the characteristic functions on those. Set $f_{3}, f_{4},$ and $f_{5}$ to be the characteristic functions of those intervals. Repeat this process for $n=1, 2, \dots$. It is easy to see that $\{f_{n}\}$ converges to the $0$ function both in probability and in $L^{p}$ for $0<p<\infty$.

The sequence of functions does not converge almost everywhere (in fact it converges nowhere) because each point will land in infinitely many of our smaller intervals, and lie outside of infinitely many. Hence, we can find subsequences of $\{f_{n}\}$ which send our given point to $0$ and subsequences which send it to $1$.

• The most common example: How do you know? – Did May 25 '12 at 20:37

Consider the sequence of function on [0,1] such that $$f_{n}(x) = \begin{cases} 1 & x \in \left[ \dfrac{k}{2^m},\dfrac{k+1}{2^m}\right]\\ 0 & \text{otherwise}\end{cases}$$ where $m = \lfloor \log_2(n) \rfloor$ and $k = n - 2^m$. This converges in $L^2$ but not almost surely.