Existence of a bounded measurable function

How do I prove the following:

Let $f$ be a measurable function on $[0,1]$ such that $f$ is finite almost everywhere. Then for any $\varepsilon \gt 0$, $\exists$ a bounded measurable function $g$ such that $$\mu\{x\in [0,1]: f(x)\neq g(x)\}\lt \varepsilon .$$ $\mu$ is the Lebesgue measure.

-
To make the question better, please indicate where you ran into the problem - what context did you see it in, what book are you using, etc. This will help others answer your question in a way that is more useful to you. –  Carl Mummert Nov 23 '11 at 15:15
As a hint, consider for each $n \in \mathbb{N}$ the set $A_n = \{ x : |f(x)| \in [n,n+1)\}$. –  Carl Mummert Nov 23 '11 at 15:16
@CarlMummert: I'm studying for an exam on Lebesgue measure. I saw the question in one of the old exams. thanks for the hint. –  AKM Nov 23 '11 at 16:04

For each positive integer $n$, let $A_n=\{x\in[0,1] : |f(x)|\le n\}$. Note that $A=\bigcup\limits_{n=1}^\infty A_n$ is the set of points where $f$ is finite.

Now, each $A_n$ is measurable and $A_n\subset A_{n+1}$ for each $n$; thus, $$\lim_{n\rightarrow\infty} \mu(A_n) =\mu (A)=1.$$

So, given $\epsilon>0$, we may (and do) choose $N$ with $\mu( A_N^C\,)\lt\epsilon$.

Define $g(x)=\cases{f(x),& x\in A_N\cr 0, &x\in A_N^C}\$.

Then $g$ is bounded, measurable (since the $A_n$ are), and $$\mu\bigl(\{x\in[0,1]:f(x)\ne g(x)\} \, \bigr)=\mu(A_N^C\thinspace)\lt\epsilon.$$

-
Thanks for your answer. Is there a particular reason, why you defined $g$ the way you did? Also why is $\mu\bigl(\{x\in[0,1]:f(x)\ne g(x)\} \, \bigr)=\mu(A_N^C\thinspace)$ –  AKM Nov 23 '11 at 16:05
Just look at the definition: $g$ is just the function $f$ with "the big part lopped off". The basic problem is to show that the measure of the set where $f$ is big ($A_n^C$) tends to zero. –  David Mitra Nov 23 '11 at 16:16

This is a slight elaboration on David Mitra's answer, but is too long to fit in a comment box.

To understand this question and how to solve it, you have to ask yourself what it means for the measure of the set where $f(x) \neq g(x)$ to be small (i.e. $< \epsilon$).

The smallest possible set is the empty set; to say that the set where $f(x) \neq g(x)$ is empty is to say that $f$ and $g$ are equal.

Now we can't necessarily take $f$ and $g$ to be equal, because $f$ may not be bounded, but we want $g$ to be bounded.

So instead, we are going to allow $g$ to differ from $f$, but only on a small set (one of measure $< \epsilon$).

Intuitively speaking, the "closer" $g$ is to the original function $f$, the smaller the set on which they differ will be.

So we want to find a way to change $f$ as little as possible while making it bounded. How can we do this?

Well, just choose a threshhold $n$, and define $f(x) = g(x)$ if $f(x) \leq n$, and $g(x) = 0$ otherwise. (The particular choice of $0$ here is not important, any number of absolute value $\leq n$ would do.)

Now $g(x)$ and $f(x)$ coincide unless $|f(x)|$ is too big.

So the problem is reduced to showing that the set of points where $|f(x)|$ is too big (i.e. where $|f(x)| > n$), which is the set of points where $f$ and $g$ differ, is small.

Now you have to use something: after all, if instead of a function on $[0,1]$, we had $f(x) = x$ on the whole real line $\mathbb R$, then the set of points where $|f(x)| > n$ (which is now just the set $(-\infty,-n) \cup (n,\infty)$) has infinite measure, and so is not small at all.

This is what David Mitra shows in his answer: because the total measure of $[0,1]$ is finite, and because $f(x)$ takes finite values almost everywhere, the set of points whre $|f(x)|> n$ has arbitrarily small measure, if we take $n$ large enough. QED

Some final remarks: from your comments on David Mitra's answer, I get the impression that you are thinking about this question in a very formal way. I would recommend that you practice translating formulaic expressions into more intuitive terms, i.e. try to read $\{x \, | \, f(x) \neq g(x)\}$ as "the set where $f$ and $g$ differ", and try to read $\mu(X) < \epsilon$ as "the set $X$ is small". Then you will have more chance of understanding what is really involved in a question, and hence have a better chance of answering it.

-