# Spivak Calculus Chapter 13 Question 28.

Prove that if $f$ is integrable on $[a,b]$ then for any $\varepsilon>0$ there is a continuous function $g \le f$ such that the integral from $a$ to $b$ of $(f-g)<\varepsilon$.

Thing is, I've already gotten a step function that works from a previous exercise $(s_1\le f)$, but I can't for the life of me get a continuous one. I was thinking something along the lines of a linear function that would zigzag around each step of $s$ three times (ie: one above $x^2$, one below $x^2$, and another above $x^2$)

The key point is that if you already have a step function that has close integral to $f$, you could 'smoothen' each step by a small amount to get a continuous function and you can make the shavings arbitrarily small, because there are finitely many steps. You could use straight line segments to accomplish this, but in fact $g$ can even be made infinitely differentiable if you use bump functions.
By what you showed take a step function $s \le f$ such that $\int_{a}^bf -\int_{a}^b s < \varepsilon/2$ , and since $f$ is integrable it is bounded so take $M$ such that $|f(x)|\le M$. $s$ is constant on some intervals of the form $(j_{i-1},j_i)$ $i=1,\ldots,n$ for some $n$. let $\delta>0$ and define $g=s$ on $[j_{i-1}+\delta /2,j_{i}+\delta /2]$ and on $[j_i-\delta /2,j_{i}]$ and $[j_i,j_{i}+\delta /2]$ to be a straight line where $g(j_i)=-M$. So now we have $g\le s$ and $$\int_{a}^bs-\int_{a}^bg<nM\delta$$ Take $\delta<\varepsilon/2nM$ this gives $\int_{a}^bs-\int_{a}^bg<nM\delta<\varepsilon /2$. $\int_{a}^bf-\int_{a}^bg = \int_{a}^bf-\int_{a}^bg-\int_{a}^bs+\int_{a}^bs \le \varepsilon$