Where is the error in this solution?

Lemma: If $f$ is a nonnegative measurable function and $\int f<\infty$, then $\int f = \lim_{n\to \infty}\int_{[-n,n]} f$.

Proof: We know that $\int_{[-n,n]}f = \int f \cdot \chi_{[-n,n]}$. If $n < m$, then $f \cdot \chi_{[-n,n]} \leq f \cdot \chi_{[-m,m]} \leq f$. So the limit exists and $\lim_{N\to \infty} \int_{[-N,N]} f\leq \int f$.

Now we want to show the reverse. Suppose $\epsilon > 0$. There exists a simple integrable function $g$ such that $0 \leq g \leq f$, and $\int f \leq \int g + \epsilon$. Let $n$ be sufficiently large such that $g = 0$ outside of $[-n,n]$. Then, $g = g \cdot \chi_{[-n,n]}$, so $\int g = \int_{[-n,n]} g$. Now $g\leq f$ implies $g \cdot \chi_{[-n,n]} \leq f \cdot \chi_{[-n,n]}$. Therefore, $\int f \leq \int g + \epsilon = \int_{[-n,n]}g + \epsilon \leq \int_{[-n,n]}f + \epsilon$ for $n > N \in \mathbb{N}$. So $\int f \leq \lim_{n\to \infty} \int_{[-n,n]} f + \epsilon$. Now letting $\epsilon \to 0$, we obtain $\int f \leq \lim_{n\to \infty} \int_{[-n,n]} f$, and we are done.

There is a problem in this proof, but I can't seem to find/correct it. Can anyone help?

-

A simple function is a linear combination $\sum\limits_{k=1}^na_k\mathbf 1_{A_k}$ of indicator functions $\mathbf 1_{A_k}$ of measurable sets $A_k$ but one does not usually asks that the sets $A_k$ are intervals nor even bounded, only measurable. Hence the step Let $N$ be sufficiently large that $g=0$ outside of $[-N,N]$ is not guaranteed.
To fix the solution proposed by the OP, choose $N$ such that the integral of $g−g\mathbf 1_{[−N,+N]}$ is at most $\epsilon$, and proceed.
Choose $N$ such that the integral of $g-g\mathbf 1_{[-N,+N]}$ is at most $\epsilon$, and proceed. – Did Mar 17 '12 at 6:59