Why $ \int^{+\infty}_{-\infty} x \, dx \neq 0 $ We are going over improper integrals and tests for convergence in my Calc II course. During a lecture, my professor warned us to take caution when taking integrals from negative infinity to infinity.
His specific example was:
$$ \int^{+\infty}_{-\infty} x \, dx $$
I understand that the function is definitely not convergent, but my current intuition would be that the integral from $-\infty \rightarrow 0$ would be equal to $-\infty$, and likewise the part from $0 \rightarrow \infty$ would be $+\infty$, so one could think that the negative and positive parts would cancel out, rendering the integral to equal $0$.
But, the prof made it very clear that this is not the case, and that we will learn how to deal with "nasty" integrals like this in future courses on real analysis. I have been trying to find a fairly simple explanation that a first year undergrad like myself would actually understand, but no luck this far.
I still kind of do not accept this as being not equal to zero, as both of the parts grow as $O(x^{-1})$, so I can't understand why they do not cancel out.
Any insight on this would be appreciated.
NB: I understand that if one blindly follows the rule that both must converge for the overall integral to converge. But, I am the kind of person that always wonders why something is.
 A: Is your stance that $\infty+(-\infty)=0$? That kind of thinking would be problematic. Presumably, $1+\infty=\infty$. So then you would have $1+\infty+(-\infty)=0$, which I guess would make $1=0$.
A: Remember, $\infty$ is not a number. So it makes no sense to have something that is not a number in the upper and lower limits of the integral. So how do we avoid this issue? Well, that's the entire idea of Calculus (making infinitesimals something we can work with)
So what is the idea of Calculus? Well, we look at limits. So though $\infty$ is not a number, we can look at what happens when this integral has upper and lower limits that approach infinity. So what we want is this
$$
\lim_{b \to \infty} \int_{-b}^b x \; dx
$$
Well, the integral is easy to calculate, it's $x^2/2+C$, now we evaluate it using the upper and lower limits,
$$
\frac{b^2}{2}-\frac{(-b)^2}{2}=0
$$
then we have
$$
\lim_{b \to \infty} 0=0
$$
So in that sense the integral is $0$ (what we have done above is called the improper integral). However, one still needs to be careful when talking about infinities. Why? Well, isn't original integral the same as...
$$
\int_{-\infty}^\infty x\;dx= \int_{-\infty}^bx\;dx + \int_{b}^\infty x\;dx
$$
where $b$ is any real number. Notice neither of those integrals on the right converge, so neither can the integral on the left converge! Because on the right we have infinities. If we 'forced' those to converge, many of the properties of the reals could be forced to break down. So we just contradicted the fact that the integral converges!
What's the lesson here? It's that one can just throw around infinities without being clear what is mean. Infinity is not a number, it's a limit. When we treat it like a number, 'bad' things happen. As you can see, it's not enough to say that the 'areas' cancel out. That's an intuitive way to think about things. But remember, the integral is a concept independent of areas. It's something much bigger. So the interpretation may work in one direction, that is an integral can represent an area, but not the other way around. Especially not when dealing with infinite areas, because what would that even mean!? This is what makes talking about anything involving infinities difficult and why we often use limits instead, where one can be very clear about what one means when one says things like 'infinity' (often referring to a limit of some sort, and limits have a rigorous definition). This may be tedious, but it makes things clear and is why Mathematics can be so interesting. All of this you will cover in a Real Analysis course, as your professor said. This gives you something to look forward to!
A: This is a good question. My answers differ from the other answers because this deals very closely with convergence issues from higher mathematics.
It boils down to what it means for an improper integral to converge, in a sense. It is (almost always) the case that we say
$$ \int_{-\infty}^\infty f(x) \mathrm{d}x$$
converges iff 
$$\lim_{a \to -\infty}\lim_{b \to \infty}\int_a^bf(x)\mathrm{d}x$$
converges, which is what Frank Lu says in his answer. You seem to want it to be defined as $$\lim_{a \to \infty}\int_{-a}^a f(x)\mathrm{d}x,$$
which happens to converge in the Cauchy Principal Value sense (in fact, that is the Cauchy Principal Value of this integral). Cauchy Principal Values are common in higher math, especially in complex analysis and residue calculus..
You might ask Why don't we define improper integration to align with Cauchy Principal Values? That is also a good question, and I think it depends on what you one wants from their integrals. A big problem with Cauchy Principal Values is that they are very dependent on coordinates. If you "shifted the center" to be $1$ instead of $0$, you would get a different answer for the integral (it would diverge), i.e. 
$$\lim_{a \to \infty} \int_{1-a}^{1+a}f(x)\mathrm{d}x \neq \lim_{a \to \infty}\int_{-a}^a f(x)\mathrm{d}x,$$
which violates our intuitive understanding of integrals and our desire to have well-defined answers. Cauchy Principal Values depart from Riemann sums - so getting this "extra convergence" has a price. Conversely, we demand stricter convergence from Riemann (or Lebesgue) integrals to have them better line up with our intuition. (Usually! Sometimes, CPVs are very useful!)
A: Note that the improper integral
$$\int_{-\infty}^{\infty}f(x)dx$$
converges if and only if both
$$\int_0^{\infty}f(x)dx,\quad \int_{-\infty}^0f(x)dx$$
converge
A: In general $\int_{-\infty}^{\infty}f(x)\,dx$ is defined by
$$\int_{-\infty}^{\infty}f(x)\,dx =\lim_{a\to\infty}\int_{-a}^{0}f(x)\,dx + \lim_{b\to\infty}\int_{0}^{b}f(x)\,dx$$
and not by
$$\int_{-\infty}^{\infty}f(x)\,dx = \lim_{a\to\infty}\int_{-a}^{a}f(x)\,dx $$
If you would use the second one as definition, then the integral would be $0$
A: By definition, an integral $\int_a^b f(x) dx$ is convergent ( here: $f$ is continuous from $(a,b)$to $\Bbb R$) if $$L_1=\lim\limits_a F$$ and $$L_2=\lim\limits_b F$$ exists,  where $F$  is a primitive of $f$ (ie: $F'=f$). Then we have:   $$\int_a^b f(x) dx=L_2-L_1$$
In our case $$f(x)=x$$ so $$F(x)=\frac{x^2}{2}$$  and  $$\lim\limits_{-\infty} F=+\infty$$ is not a real number. This suffices ta say that the integral  diverges.
A: Arithmetic with infinite quantities is seriously problematic, for a number of reasons. For example, what "should" $\infty-\infty$ be? It seems sensible to say that it should be $0$, but then associativity breaks down, as we see (for example) that $$1+(\infty-\infty)=1+0=1,$$ but we "should" have $1+\infty=\infty,$ and so $$(1+\infty)-\infty=\infty-\infty=0,$$ which is a problem, since $1\ne0.$ In a similar fashion, we can show that there is no natural value (finite or infinite) for $\infty-\infty$.
Even if we are just considering "infinite arithmetic" as limiting behavior for finite arithmetic, we run into problems. For example, $\lim_{x\to\infty}(1+x)=\lim_{x\to\infty} x=\infty,$ but we can't simply substitute and pull the limit back out, for then $$1=\lim_{x\to\infty}1=\lim_{x\to\infty}(1+x-x)\overset{*}{=}\lim_{x\to\infty}(1+x)-\lim_{x\to\infty}x=\infty-\infty,$$ and on the other hand $$0=\lim_{x\to\infty}0=\lim_{x\to\infty}(x-x)\overset{*}{=}\lim_{x\to\infty}x-\lim_{x\to\infty}x=\infty-\infty,$$ so we've got problems. (The * marks the problematic steps that we can't actually take.)
We run into a similar problem when we're looking at this doubly improper integral. It is certainly true that $$\lim_{t\to\infty}\int_{-t}^t x\,dx=0,$$ but on the other hand, we have $$\lim_{s\to\infty}\lim_{t\to\infty}\int_{-s}^tx\,dx=\infty,\\\lim_{t\to\infty}\lim_{s\to\infty}\int_{-s}^tx\,dx=-\infty.$$ More generally, for any real $a,$ we can say that $$\lim_{t\to\infty}\int_{-\sqrt{t-a}}^{\sqrt{t+a}}x\,dx=a,$$ so once again, there's not really a natural choice. We can make the improper integral seem to converge to anything, simply by taking an appropriate approach to the infinite limits of integration, and so the improper integral fails to converge at all.
