# Give a example where the opposite direction of $\mathbb{E}|X_{n}-X|^{2}\rightarrow 0 \Rightarrow X_{n}\overset{(p)}{\rightarrow} X$ is not available.

Give a example where the opposite direction of $$\mathbb{E}|X_{n}-X|^{2}\rightarrow 0 \Rightarrow X_{n}\overset{(p)}{\rightarrow} X$$ is not available.

Remark: Look online for an example of this situation and I didn't find it, one day I started thinking about it and I found it, I want to share my proposal, another person may need it. If you have another example I would like you to share it here.

My attempt We consider $$X=0$$ and $$X_{n}$$ with density function $$f_{n}$$ where $$f_{n}=\frac{n-1}{n}f_{n}^{(1)}+\frac{1}{n}f_{n}^{(2)}.$$ where $$f_{n}^{(1)}$$ is the $$\mathrm{Uniform}[0,1/n]$$ density and $$f_{n}^{(1)}$$ is the $$\mathrm{Uniform}[n,n+1/n]$$ density.

What about $$X_n(\omega):= \sqrt{n}1_{[0,\frac{1}{n}]}(\omega).$$ with $$\Omega = [0,1]$$ and the Lebesgue measure?
Then $$X_n(\omega) \rightarrow 0$$ a.s. and $$E[|X_n-0|^2]=1$$ for all $$n,$$ so $$X_n$$ doesn't converge in $$L^2.$$ However, $$X_n \rightarrow 0$$ in probability.