# 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! Nov 18, 2018 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$. Nov 18, 2018 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. Nov 18, 2018 at 18:44
• This proof certainly works, but what about the following example? Let $X_n$ be a RV defined on space $([0,1], \mu)$ ($\mu$ is Lebesgue measure) with density $P(X_n) = 1$ on $[0,\frac{1}{n}]$ and $0$ everywhere else. Define $E_n := \{X_n = 1\} = [0,\frac{1}{n}]$. I may construct of sequence of RV $\{X_n\}$, and note that $\cup_{n=N}^\infty E_n = E_N$. Then, $\limsup_n E_n = \cap_n\cup_{m \geq n} E_m = \cap_n E_n = \{0\}$ so that $\mu(\limsup_n E_n) = 0$. This example is a contradiction to the statement above that $P(\limsup_n E_n) = 1$. May 8 at 18:28
• @DavideGiraudo Oh I see. i.e. wlog $m < n$, then $\mu(E_m \cap E_n) = \mu(E_n)$ so not independent. Thanks! May 8 at 20:27

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, 2012 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.

An even stronger exemple is the The Typewriter Sequence that converge in $$L^1$$ to zero, hence converge in probability to zero, but that doesn't converge a.s./point wise to zero nowhere!
Here you ll be able to see very great comment and exemple.
The Typewriter Sequence