Trying to solve the following problem:
Let $f(x)$ be a continuous real-valued function on $[0,3]$. Given any $\varepsilon>0$ prove there exists a polynomial, $p(x)$, such that $\int_0^3|f(x)-p(x)|\,dx<\varepsilon$
This almost seems trivially true, which leads me to believe that I'm thinking about it incorrectly. If by Weierstrass theorem we know there exists a sequence of polynomials $P_n(x)$ in $[0,3]$ such that $\lim_{n \to \infty} P_n(x)=f(x)$, then if we set $p(x)=\lim_{n \to \infty} P_n(x)=f(x)$, then $|f(x)-p(x)|=|f(x)-f(x)|=0$ and therefore it is obviously true that $\int_0^3|f(x)-p(x)|\,dx<\varepsilon$. I'm almost certain this is not correct, so what am I doing wrong?
SW says that for any $\epsilon > 0$ there is a polynomial $p(x)$ such that $\forall x \in [0, 3]$ we have $|f(x) - p(x)| < \epsilon / 4$.
Then $$ \int_0^3 |f(x) - p(x)|\text{d}x \le (3 - 0) \times \sup_{x \in [0, 3]}|f(x) - p(x)| < 3 \times \frac{\epsilon}{4} < \epsilon $$