Let $f:[0,1]\rightarrow\mathbb{R}$ is Riemann-integrable. Prove that exist some sequence of polynomials $p_n$, such that: $$\int_0^1|f(x)-p_n(x)|^2dx\rightarrow0$$ My attempt:
Obviously, for all $\varepsilon>0$ the set of discontinuous-$f$-points-on-number-more-$\varepsilon$ can not be densely on $[a,b]$, where $0\leq a<b\leq 1$.
Now choose number $\varepsilon'$ and build the set $M_{\varepsilon'}$, such that $f$ is discontinuous-on-number-more-$\varepsilon'$ in $x$ iff $x\in M_{\varepsilon'}$.
Build continuous function $g_{\varepsilon'}:[0,1]\rightarrow\mathbb{R}$, such that:
1) $f(0)=g_{\varepsilon'}(0)$ and $f(1)=g_{\varepsilon'}(1)$
2) $|g_{\varepsilon'}(x)-f(x)|<\varepsilon'$ for $x$ not from $\varepsilon'$-vicinity of $M_{\varepsilon'}$.
3) $g_{\varepsilon'}$ is liner on every interval of closure $\varepsilon'$-vicinity of $M_{\varepsilon'}$.
Build polynomial $p_{\varepsilon'}$, such that for all $x\in[0,1]$ was true $|g_{\varepsilon'}(x)-p_{\varepsilon'}(x)|<\varepsilon'$. (Stone-Weierstrass theorem)
Help me to check is the sequence $p_i=p_{\frac{1}{2^{i+1}}}$ correct for this problem.