# A sequence of functions ${f_n}$ that converges non-uniformly to $f$ but the limit of the integrals equals the integral of the limits?

Construct an example to show that it is possible to have a sequence of continuous functions $\{f_n\}$ that converges non-uniformly to a continuous function $f$ on a closed interval $[a,b]$, but we also have that $$\lim_{n\to\infty}\int_a^b f_n(x) dx = \int_a^bf(x) dx$$

The example I thought of was to define $f(x) = \left\{ \begin{array}{lr} nx & : 0\leq x < 1/n\\ \frac{-n}{n-1}x+\frac{n}{n-1} & : 1/n \leq x \leq1 \end{array} \right.$

I'm fairly certain that $f_n(x) \to f(x)=-x+1$ non-uniformly on $[0,1]$ and both of the integrals would be equal to $\frac{1}{2}$. This example seems a little messy to me though. Are there any cleaner looking examples, perhaps with $f_n$ not defined piece-wise?

EDIT: Looking at my example, I'm not sure that $f_n \to f$ anymore, since that doesn't even converge pointwise.

Consider $[a,b]:=[0,1]$ and $f_n(x):=4n^2\max\{x(1/n-x),0\}$. Then $f_n$ is continuous and converges to $f(x):=0$, but the convergence is not uniform, since $f_n(1/(2n))=1\not\to0=f(0)$. Moreover, \begin{align*} \int_0^1f_n(x)dx=4n^2\int_0^\frac{1}{n}(x/n-x^2)dx=\frac{2}{3n}\to0=\int_0^1f(x)dx. \end{align*}
You can modify your solution by making your function equal to a bump centered at $x = 1/n$ with width $1/2n$ and height $\sqrt{n}$, and zero elsewhere outside the bump. Then your sequence of functions will converge to $f$ being the zero function but not uniformly, but the integrals will converge to zero which is the integral of the limit $f$.