Convergence of integrals but $\int_a^b|f_n(x)-f(x)|dx$ does not converge to $0$ Can I have an example of a sequence of continuous functions $(f_n)_n$ and a continuous function $f:[a,b]\to \mathbb{R}$ such that
$$\int_a^bf_n(x)dx\to\int_a^bf(x)dx,$$
when $n\to+\infty$, but 
$$\int_a^b|f_n(x)-f(x)|dx$$
does not go to $0$ when $n\to+\infty$.
 A: Let $[a,b] = [0,4]$ and
$$f_n(x) = \begin{cases}\quad n^2x &, 0 \leqslant x \leqslant \frac{1}{n}\\
n^2\left(\frac{2}{n}-x\right) &, \frac{1}{n} \leqslant x \leqslant \frac{3}{n}\\
n^2\left(x-\frac{4}{n}\right) &, \frac{3}{n}\leqslant x \leqslant \frac{4}{n}\\
\qquad 0 &,\frac{4}{n}\leqslant x \leqslant 4.\end{cases}$$
Then $\int_0^4 f_n(x)\,dx = 0$ for all $n$, and $f_n(x) \to 0$ for all $x\in [0,4]$, but
$$\int_0^4 \lvert f_n(x)\rvert\,dx = 2$$
for all $n$.
A: It might be helpful to think of how to build an example from the bottom up. 
Let's start by making an example where $f_n > 0$, $f_n \to 0$ pointwise, and $\int_a^b f_n dx = C$ for some $C < \infty$. To do this we just want to make $f_n$ blow up (so that they are not dominated) on a rapidly shrinking set. So $f_n = n \chi_{[0,1/n]}$, $[a,b]=[0,1]$ will do the job.
Now we also want to have $\int_0^1 f_n \to 0$. The easiest way to do this is to have $\int_0^1 f_n = 0$. To do this, just flip the sign on $f_n$ on half of its domain, that is, take $f_n = n \left ( \chi_{[0,1/2n]} - \chi_{[1/2n,1/n]} \right )$.
Now we need to smooth out this example without changing its integral. This is not difficult but it is messy, mostly because we have to get "back to zero" continuously. The simplest way to do it is to make a piecewise linear function. The idea is to draw it so that you get two triangles of the same area, one above the axis and one below the axis. Here's one way to do it, which is a smoothing out of the discontinuous example above. Make the first triangle be formed by the segment between $(0,n)$ and $(1/n,0)$; this has area $1/2$. This line has slope $-n^2$. Continue this line some additional distance $x/2$, so that the minimum is $-n^2x/2$, and then rise back up to $0$. The resulting triangle has area $n^2x^2/2$, so to get the overall integral to be $0$ we want $x=1/n$. Doing some algebra, our function is
$$f_n(x) = \begin{cases} n-n^2x & x \in [0,3/2n] \\ n^2(x-3/2n)-n^2(1/2n) & x \in (3/2n,2/n] \\ 0 & x \in (2/n,2] \end{cases}$$
Now $\int_0^2 f_n dx = 0$, $f_n \to 0$ pointwise, but $\int_0^2 |f_n| dx = 1$.
This is very similar to Daniel Fischer's example, except he starts at 0, draws an isosceles triangle above the axis, and then draws its reflection below the axis.
