approximating a riemann integrable function by sequences of step functions and sequences of continuously differentiable functions

Suppose that $f$ is Riemann integrable on $[0,M]$.

How can I show that a) $f$ can be approximated uniformly by a sequence of finite step functions? and b) by a sequence of continuously differentiable functions?

Any hints on how to handle this?

Well I thought that for a), since $f$ is Riemann integrable then there is a partition such that the sum of the product of the oscillation at each partition and the length of the partition is uniformly small. But the oscillation at each partition is a difference of two step functions, the one which bounds the function above and the one which bounds the function below... Help would be appreciated.

Use $\mathrm{osc}(f, I) = \sup(f,I) - \inf(f,I)$ for each interval of your partition.
Edit: You can use either the upper step function or lower step function to approximate $f$. If $L$ denotes the lower step function (defined by picking the infimum on each partition interval), why is $|f - L| = |f - \inf_I(f)|$ small for each interval $I$?
• @user1237300 Approximation by continuously differentiable functions cannot be uniform (uniform limit would be continuous). To get pointwise convergence, you can replace two sides of the step function with the piece of $\sin nx$, $|x|\le \pi/(2n)$, appropriately shifted and scaled. This function has zero derivative at the endpoints, which matches with the step function having zero derivative. – 40 votes Jul 12 '13 at 2:33