# $L^2$ convergence implies $f=g$ for pointwise convergent $f_n$

Suppose $f_n \rightarrow f$ pointwise on $[0,1]$ and $\int_0^1{|f_n(x)-g(x)|}^2dx \rightarrow0$ as $n \rightarrow \infty$. Prove that if $g,f$ are continuous on $[0,1]$ then $f=g$.

So I tried to prove this claim by contradiction. Suppose there exists a point $x_0 \in [0,1]$ such that $f(x_0) \neq g(x_0)$. Since $f,g$ are continuous, there is an interval $I_0 \subset [0,1]$ containing $x_0$ such that $\int\limits_{I_0}|f(x)-g(x)|^2dx \neq 0$, which violates the assumption that $\lim_{n \to \infty}\int_0^1{|f_n(x)-g(x)|}^2dx =0$. I don't know how to write this rigorously. Am I doing it right?

You haven't shown how $\int_{I_0} |f(x) - g(x)|^2\, dx \neq 0$ contradicts $\lim\limits_{n\to \infty} \int_0^1 |f_n(x) - g(x)|^2\, dx = 0$.
Since $\{\lvert f_n - g\rvert^2\}_{n\in \Bbb N}$ is a sequence of non-negative measurable function that converges pointwise to $\lvert f - g\rvert^2$ on $[0,1]$, Fatou's lemma gives
$$\int_0^1 \lvert f(x) - g(x)\rvert^2\, dx \le \varliminf_{n\to \infty} \int_0^1 \lvert f_n(x) - g(x)\rvert^2\, dx = 0.$$
Hence $\int_0^1 \lvert f(x) - g(x)\rvert^2\, dx = 0$, and thus $0 \le \int_{I_0} \lvert f(x) - g(x)\rvert^2\, dx \le \int_0^1 \lvert f(x) - g(x)\rvert^2\, dx = 0$. This implies $\int_{I_0} \lvert f(x) - g(x)\rvert^2\, dx = 0$. There's your contradiction.