Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let $f : \mathbb R \rightarrow \mathbb R$ be a continuous function. I am trying to prove that for each $\epsilon > 0$, there is a continuous function $g$ whose derivative exists and equals 0 almost everywhere such that $|f(x) - g(x)| < \epsilon$ for each $x \in \mathbb R$. So far, I've considered trying to use linear combinations of the cantor-lebesgue function (which is continuous and has zero derivative a.e.), but have not met with much success.

share|cite|improve this question
up vote 4 down vote accepted

This cries out loud for the Stone-Weierstrass theorem.

The singular functions are a subalgebra of $C[a,b]$, they contain the constant functions and they separate points, hence every continuous function on $[a,b]$ can be uniformly approximated by singular functions.

Now we can paraphrase Robert Israel's answer here:

Approximate by [singular functions] $p_k(x)$ on each interval $[k,k+2]$, and put them together using a smooth partition of unity: if $\phi(x)$ is a smooth function with $\phi(x) = 0$ for $x \le 0$, $\phi(x) = 1$ for $x \ge 1$, and $0 \le \phi(x) \le 1$ for $0 \le x \le 1$, take $g(x) = \phi(x-k) p_k(x) + (1 - \phi(x-k)) p_{k-1}(x)$ for $k \le x \le k+1$.

share|cite|improve this answer

Here is how to do this on $I=[0,1]$. $f$ is uniformly continuous on $I$, so find the $n$ so that if $|x-y|<1/n\;$, $|f(x)-f(y)|<\epsilon\;$. For $x\in[k/n,(k+1)/n]$ define $$ g(x)=f(k/n)+C(nx-k)(f((k+1)/n)-f(k/n)) $$ Where $C$ is the Cantor-Lebesgue function. This can then be repeated for other compact intervals.

share|cite|improve this answer
+1: I prefer your solution to applying Stone-Weierstrass! – commenter Sep 25 '11 at 3:11
@commenter: thanks. While an answer using S-W is nice in its generality, I prefer a constructive answer, too. – robjohn Sep 25 '11 at 3:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.