# Let $f_n \to f$ pointwise on $[0,1]$. If $f_n, f$ are continuous, is it true that $\int_0^1 f_n(x) dx \to \int_0^1 f(x)dx$?

Let $\{f_n\}$ be a sequence of continuous functions on on $[0,1]$. Let $f_n \to f$ pointwise. If $f$ is continuous on $[0,1]$, is it true that $$\int_0^1 f_n(x) dx \to \int_0^1 f(x)dx?$$

I couldn't think of a counter-example, so my inclination is that it is true. If I can show that $f_n \to f$ uniformly, then I would be done, since I can choose an $N$ such that for all $n > N$ and $x\in [0,1]$ we have $|f_n(x) - f(x)| < \varepsilon$, which gives $$\left| \int_0^1 f_n(x) - f(x) dx \right| \leq \int_0^1 |f_n(x) - f(x)|dx < \varepsilon$$

Can it be shown that $f_n \to f$ uniformly since we're working on a compact set and $f$ is continuous? Or can a counter-example be constructed from here?

No. Take$$\begin{array}{rccc}f_n\colon&[0,1]&\longrightarrow&\mathbb R\\&x&\mapsto&\begin{cases}n\sin(n\pi x)&\text{ if }x\leqslant\frac1n\\0&\text{ otherwise.}\end{cases}\end{array}$$Then $\lim_{n\to\infty}f_n(x)=0$ for each $x\in[0,1]$, but, for each $n\in\mathbb N$, $\int_0^1f_n(x)\,\mathrm dx=\frac2\pi$.
• @user296113 I know you meant well, and that is reasonable to conclude that that was the correct version. However, there are two reasons I never do edits like that, and I don't think anyone should. 1) If José was in the middle of making a large addition to his answer, and you make your minor edit, that appears as a pop-up on his screen. If he's careless and clicks that, then everything he's been working on is gone. It has happened to me, and I would not want to risk causing that to anyone of I could help it 2) You can't really, truly know that $x\leq \frac1x$ wasn't what he really meant. May 15 '18 at 22:12
There is an easy and well-known counter-example. Consider $f_n=(n-n^2x)X_{[0,1/n]}$.
Let $f_n(x) = n^2x^n(1-x).$ Then $f_n\to 0$ pointwise everywhere in $[0,1],$ but $\int_0^1 f_n(x)\,dx \to 1.$
• i have confusion in ur answer@Zhw $\int_0^1 \ n^2x^n(1-x)dx =n^2\frac{x^{n+1}}{n+1} -n^2 \frac{x^{n+2}}{n+2}]_{x=0}^{1}=0.$ Im not getting how did u get $1$ i mean How $\int_0^1 f_n(x)\,dx \to 1. ???$ Nov 26 '19 at 21:29