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.
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!)