Analysis: Prove that this improper integral diverges but the limit as $t \rightarrow \infty=\pi$? Question:
Show that the improper integral $$\int_{-\infty}^{\infty}\frac{1+x}{1+x^2}dx$$ diverges but that $$\lim_{t\rightarrow\infty}\int_{-t}^{t}\frac{1+x}{1+x^2}dx=\pi.$$
 A: It is easy to check that $\frac{1 + x}{1 + x^2}$ is a bounded function on $\left (-\infty, \infty \right)$,  in particular it is bounded on every bounded, closed subinterval. This is 
an improper integral because the interval of integration $\left (-\infty, \infty \right)$ is infinite. 
We first need to write$\int_{-\infty}^{\infty}\frac{1+x}{1+x^2}dx$  as the sum of two improper integrals, for instance as 
$$\int_{-\infty}^{\infty}\frac{1+x}{1+x^2}dx= \int_{-\infty}^{0}\frac{1+x}{1+x^2}dx+\int_{0}^{\infty}\frac{1+x}{1+x^2}dx,$$
and then evaluate the two resulting improper integral separately. So,
$$\int_{0}^{\infty}\frac{1+x}{1+x^2}dx=\lim_{M\rightarrow\infty}\int_{0}^{M}\frac{1+x}{1+x^2}dx$$
$$=\lim_{M\rightarrow\infty} \left [ \int_{0}^{M}\frac{1}{1+x^2}dx+\int_{0}^{M}\frac{x}{1+x^2}dx \right ]$$
$$=\lim_{M\rightarrow\infty} \left [\left (\arctan(M) - \arctan(0)\right)+ \left ( \frac{1}{2}\ln \left (1+M^2 \right) \right) \right] = \bf{\infty},$$
since $\lim_{M\rightarrow\infty}\ln(1+M^2) = \infty$. Therefore the improper integral $\int_{0}^{\infty}\frac{1+x}{1+x^2}dx$ diverges, and hence the original improper integral $\int_{-\infty}^{\infty}\frac{1+x}{1+x^2}dx$ diverges.
However, when we evaluate $\lim_{t\rightarrow \infty}\int_{-t}^{t}\frac{1+x}{1+x^2}dx$ we get
$$\lim_{t \rightarrow \infty}\int_{-t}^{t} \frac{1+x}{1+x^2}dx=\lim_{t \rightarrow \infty} \left [\int_{-t}^{t} \frac{1}{1+x^2}dx+\int_{-t}^{t} \frac{x}{1+x^2}dx \right]$$
$$=\lim_{t \rightarrow \infty} \left [\left (\arctan(t) - \arctan(-t) \right ) + \frac{1}{2} \left ( \ln(1+t^2) -\ln(1+(-t)^2) \right ) \right ]$$
$$=\lim_{t \rightarrow \infty} 2 \space \arctan(t) = 2 \frac{\pi}{2} = \pi$$
and so $lim_{t \rightarrow \infty} \int_{-t}^{t} \frac{1+x}{1+x^2}dx$ converges. We have used the fact that inverse tangent is an odd function, that is $\arctan(-t) = -\arctan(t)$.
A: Hint:
$$\frac{1+x}{1+x^2} \operatorname*{\sim}_{x\to\infty} \frac{1}{x}$$
which is not integrable around $\infty$.
But
$$
\int_{-t}^{t}
\frac{1+x}{1+x^2}dx
= \int_{0}^{t}
\frac{1+x}{1+x^2}dx+\int_{0}^{t}
\frac{1-x}{1+x^2}dx = 2\cdot \int_{0}^{t}
\frac{1}{1+x^2}dx.
$$
A: $$\int\frac{1+x}{1+x^2}\space\text{d}x=\int\left(\frac{x}{x^2+1}+\frac{1}{x^2+1}\right)\space\text{d}x=$$
$$\int\frac{x}{x^2+1}\space\text{d}x+\int\frac{1}{x^2+1}\space\text{d}x=$$

Substitute $u=x^2+1$ and $\text{d}u=2x\space\text{d}x$:

$$\frac{1}{2}\int\frac{1}{u}\space\text{d}x+\int\frac{1}{x^2+1}\space\text{d}x=
\frac{\ln\left|u\right|}{2}+\int\frac{1}{x^2+1}\space\text{d}x=$$
$$\frac{\ln\left|u\right|}{2}+\arctan\left(x\right)+\text{C}=\frac{\ln\left|x^2+1\right|}{2}+\arctan\left(x\right)+\text{C}$$


Now set the boundaries:
$$\lim_{t\to\infty}\int_{-t}^{t}\frac{1+x}{1+x^2}\space\text{d}x=\lim_{t\to\infty}\left[\frac{\ln\left|x^2+1\right|}{2}+\arctan\left(x\right)\right]_{-t}^{t}=$$
$$\lim_{t\to\infty}\left(\left(\frac{\ln\left|t^2+1\right|}{2}+\arctan\left(t\right)\right)-\left(\frac{\ln\left|(-t)^2+1\right|}{2}+\arctan\left(-t\right)\right)\right)=$$
$$\lim_{t\to\infty}\left(2\arctan(t)\right)=2\lim_{t\to\infty}\arctan(t)=2\cdot\frac{\pi}{2}=\frac{2}{2}\cdot\pi=\pi$$
