Computing the Lebesgue integral of $\frac{1}{1+x^2}$ I'm asked to show that $f(x)=\frac{1}{1+x^2}$ is Lebesgue integrable over the real line and that its integral is $\pi$.
I can bound this function by the measurable function $\phi=\sum_{n=0}^{\infty}\frac{1}{1+n^2}\chi_{I_n}$ where $I_n = (n-1,n]\cup [n,n+1)$ and $\chi$ means characteristic function.  This function $\phi$ can be written as the limit of its increasing sequence of partial sums, so I know that its integral is $2\sum_{n=0}^{\infty}\frac{1}{1+n^2}$ which converges.  This ensures that the integral of $f$ is bounded, and hence $f$ is Lebesgue integrable.
I'm a bit stuck on how to show that $\int f$ is $\pi$ however.  I suspect that I'm intended to write $\int f$ as a limit of series like that above.  By cutting up those characteristic functions ever more finely, I can express the integral of $f$ as $$\lim_{k\to \infty} \frac{2}{k} \sum_{n=0}^{\infty} \frac{1}{1+(n/k)^2}$$
but I don't at all know how to evaluate that limit (though apparently it does evaluate to $\pi$).
So, I suppose my question is whether this is a good way to go about this (the overall point is to use the theory of Lebesgue measure and Lebesgue integration), and whether this last limit I've written is somehow easily seen to converge to $\pi$?  Or, should I try to express the function as a limit of some other functions?
 A: I don't know that this is what they intend, but here are a few observations to get you started:
(1) On a finite interval, continuous functions which are Lebesgue integrable are Riemann integrable, and the two integrals agree.  Thus, you can actually calculate $\int_a^b \frac{dx}{1+x^2}$ with the fundamental theorem of calculus.
(2) If $\int_X \left| f(x) \right| dx<\infty$, then dominated convergence allows you to say that $\int_X f dx= \lim \int_X f\chi_I dx=\lim \int_I f dx$ where the limit is over some increasing collection of subsets (intervals $I$) which exhaust your space.
These two together allow you to solve the problem essentially as you would in a regular calculus class.
If there is some particularly clever and elementary (but completely ad hoc) way to see this integral without either the fundamental theorem of calculus or complex analysis, I don't know it.
A: This doesn't really answer the question, but, if you're still interested in evaluating
$\displaystyle\lim_{k\to\infty} 2\sum_{n=1}^{\infty}\frac{k}{k^2+n^2},$
I think this method might work.
Choose $t>0$, and consider the Fourier series $\sum_{-\infty}^{\infty}c_ne^{inx}$ of $e^{tx}$, where
$c_n=\displaystyle\frac{1}{2\pi}\int_0^{2\pi}e^{(t-in)x}\,dx=\frac{(e^{2\pi t}-1)}{2\pi(t-in)}.$
Parseval's Theorem gives
$\displaystyle\frac{e^{4\pi t}-1}{4\pi t}=\frac{1}{2\pi}\int_0^{2\pi}e^{2tx}\,dx=\sum_{-\infty}^{\infty}\frac{(e^{2\pi t}-1)^2}{4\pi^2(t^2+n^2)}=\frac{(e^{2\pi t}-1)^2}{4\pi^2}\left(\frac{1}{t^2}+2\sum_{n=1}^{\infty}\frac{1}{t^2+n^2}\right).$
If I'm not mistaken above,
$\displaystyle\pi\frac{(e^{4\pi t}-1)}{(e^{2\pi t}-1)^2}-\frac{1}{t}=2\sum_{n=1}^{\infty}\frac{t}{t^2+n^2}.$
Now let $t\to\infty$, you get $\pi$.
A: The Lebesgue integral on the line and the Riemann integral coincide when the positive and negative parts of the function are integrable.  To wit, suppose $f$ is a measurable function.  Define $f^+(x) = f(x)$ if $f(x)\ge 0$. and 0 otherwise.  Likewise, define $f^-(x) = -f(x)$ if $f(x) \lt 0$ and 0 otherwise.  Then we know that $f = f^+ - f^-$ and $|f| = f^+ + f^-$.
The Lebesgue integral 
$$\int_{\infty}^\infty f(x)\, dx$$
for a measurable function $f$ exists provided that at least one of 
$\int f^-(x)\, dx$ 
or 
$\int f^+(x)\, dx$ is finite.  In this case we have
$$\int_{\infty}^\infty f(x)\, dx = \int_{\infty}^\infty f^+(x)\, dx - \int_{\infty}^\infty f^-(x)\, dx.$$
We should view this difference as being a difference between extended reals; it makes sense if $f$ is integrable. 
The nub of the difference arises for an integral such as $$\int_0^\infty {\sin(x)\over x}\, dx.$$
This Riemann integral is defined as 
$$\lim_{T\to\infty} \int_0^T {\sin(x)\over x}\, dx.$$
and it converges in this sense to $\pi/2$.
Here we allow an ``unwarranted'' cancellation to occur.  Both
$\int \sin^+(x)/x\, dx$ and $\int \sin^-(x)/x\, dx$ are infinite, so the Lebesgue integral
does not exist.    
A bounded function on a bounded interval is Riemann integrable iff it is continuous almost everywhere in Lebesgue Measure (cf. Royden's Real Analysis).
The problem comes from cancellation, not from the irregularity of the integrand.  Lebesgue integration, intrinsically, makes minimal smoothness demands on its integrands.  These can be discontinuous everywhere.
