Is it OK to evaluate improper integrals this way? Today in class we learned that when you have an improper integral like this one:
$$\int_{-\infty}^\infty {f(x)} \: dx$$
you must split it before you do the limits (like so):
$$\lim_{a \to \infty} \int_{-a}^n {f(x)} \: dx + \lim_{a \to \infty} \int_{n}^a {f(x)} \: dx$$
I asked if this would work:
$$\lim_{a \to \infty} \int_{-a}^a {f(x)} \: dx$$
And my teacher said it wouldn't work, but he wouldn't explain why. Why wouldn't that work? An example of a function that doesn't work would be especially nice.
 A: The problem is that limiting to both infinities at the same time can overlook divergence.
However, the value: $\lim\limits_{a \to \infty} \int_{-a}^a f(x)\,dx$ (if it exists) is important enough to have a name: the principal value. 
So why can't you just do the limit like this? Consider $\int_{-\infty}^\infty x\,dx$
Notice that $\int_0^\infty x\,dx$ diverges to $\infty$ and $\int_{-\infty}^0 x\,dx$ diverges to $-\infty$. So we get (from either side) that our integral diverges.
However, $\lim\limits_{a \to \infty} \int_{-a}^a x\,dx = \lim\limits_{a \to\infty} a^2/2 - (-a)^2/2 = \lim\limits_{a \to \infty} 0 = 0$. 
So the principal value of $\int_{-\infty}^\infty x\,dx$ is zero while the integral itself diverges. 
In general, IF an improper integral converges, you can be very sloppy and get the right answer. On the other hand, if it actually diverges, sloppiness can miss this!
As I tell my students: You must approach ONE side of EACH bad spot by itself. Then put your answer together.
Addendum: Suppose $\int_{-\infty}^c f(x)\,dx$ and $\int_c^\infty f(x)\,dx$ exist.
Then $\int_{-\infty}^\infty f(x)\,dx = \lim\limits_{a \to -\infty} \int_a^c f(x)\,dx + \lim\limits_{b \to \infty} \int_c^b f(x)\,dx = \lim\limits_{b \to \infty} \int_{-b}^c f(x)\,dx + \lim\limits_{b \to \infty} \int_c^b f(x)\,dx$
Now because those two limits exist, we can combine them. So we get...
$=\lim\limits_{b \to \infty} \int_{-b}^c f(x)\,dx + \int_c^b f(x)\,dx 
=\lim\limits_{b \to \infty} \int_{-b}^b f(x)\,dx$
...which is the principal value. So the improper integral and principal value match when the integral actually converges.  
A: The only case in which you can not define the integral that way is when $f$ is not integrable. In terms of the Lebesgue integral you can check this for positive functions. 
Wikipedia mentions
$$f(x) = \left\{ \begin{array}  \;1 \; \; x > 0 \\ -1 \;\;x < 0 \end{array} \right. .$$
You can check that this has $0$ at each term in the sequence $\lim\limits_{a \rightarrow \infty} \int\limits_{-a}^a f(x) dx$, but is clearly not integrable by the definition of the Riemann integral or the Lebesgue integral.
A: (There is already a good answer, but I thought I'd add something.)
We say that a limit exists, if no matter how we approach it approaches the same. For example
$$-1 = \lim_{x\to0^-}\frac{|x|}{x}\neq\lim_{x\to 0^+}\frac{|x|}{x} = 1 $$
and hence the limit $\lim_{x\to0}|x|/x$ does not exist. In a similar way, we have to consider any way the interval of integration $[a,b]$ grows, where $a\to-\infty$ and $b\to\infty$.
Consider for example
\begin{align}
&\int_{-n}^{2n} x\,\mathrm{d}x =\frac{3}{2}n^2 &\text{and }\quad &\int_{-n}^n x\,\mathrm{d}x
 = 0.\end{align}
As $n$ approaches $\infty$ the interval is $[-\infty,\infty]$ for both integrals, but approaching in different ways. In this example we have that the first integral goes to infinity, however the second integral seems to converge? As I said, a limit has to be the same no matter how we approach it, so the integral
$$\int_{-\infty}^\infty x\,\mathrm{d}x$$
actually diverges (which it does not using "your" method). I hope this helps you see why it is important to consider the end-points of the interval independently.
A: If there is a " discontinuity " at the point "n" , then combining the two integrals ,  will not (may not) give the correct result.
