Convergence uniformly in $\mathbb{R}$, but not in $L^{2}(\mathbb{R})$, and convergence in $L^{2}(\mathbb{R})$, but not uniformly in $\mathbb{R}$

Solution 1:

For the first one, let $f_{n}(x)=\dfrac{1}{n}\chi_{[-n^{3},n^{3}]}(x)$, then $|f_{n}(x)|\leq\dfrac{1}{n}$, so $f_{n}\rightarrow 0$ uniformly on $\mathbb{R}$. But then $\displaystyle\int_{\mathbb{R}}f_{n}^{2}(x)dx=\dfrac{1}{n^{2}}\cdot 2n^{3}=2n\rightarrow\infty$, so $f_{n}$ does not converge to $0$ in $L^{2}(\mathbb{R})$.