# Weierstrass Approximation Theorem and Riemann Integrable functions

I am trying to show that given a Riemann integrable function $f$ on $[-\pi,\pi]$ and $\epsilon > 0$, there exists a continuous function $g$ such that $\int_{-\pi}^{\pi}|f(x)-g(x)|\, dx < \epsilon$.

So far, I have tried to partition $[-\pi,\pi]$ into $n$ intervals, say $[a_i,b_i]$ of length $2\pi/n$ each, and split $f$ into parts $f_i$ such that $f_i$ is continuous on each interval $[a_i,b_i]$. Then I use the Weierstrass approximation theorem to get a some polynomial $g_i$ that approximates each $f_i$ on the interval $[a_i,b_i]$.

I am not sure if this is the right approach however as I don't know if these polynomials $g_n$ will fit together to get a continuous function $g$ such that the above integral will hold. Any hints would be greatly appreciated.

• You might not find such an interval so that $f_i$ are continuous. – user99914 Nov 13 '14 at 4:31
• Right, then which function would serve as an approximation? I only thought of this to get continuity so that I could find an approximation. @John – ngold5 Nov 13 '14 at 4:37
• Note that one can find (almost by definition of Riemann integral) a step function $g$ so that $\int |f(x)-g(x)|dx$ is small. Now find a continuous function $h$ to approximate $g$. – user99914 Nov 13 '14 at 4:39

You can get the existence of a step function with this property (for $\epsilon/2$) practically from the definition of Riemann integrability. Then approach the step function with a continuous piecewise linear function, such that the integral of their absolute difference is bounded by $\epsilon/2$.