What is the intuition behind why the integration of $f(x) = x$ for closed interval of negative to positive infinity diverges, rather than being zero?

This is because a choice was made in defining improper integrals, namely, we say an improper integral $$ \int_{-\infty}^\infty f(x)\mathrm dx $$ exists if the following limit $$ \lim_{m\to \infty}\int_{-m}^0f(x)\mathrm dx+\lim_{M\to \infty}\int_0^{M}f(x)\mathrm dx $$ exists.

Note that here we have two different limiting variables, meaning that $m$ and $M$ may be going to infinity at different speeds, potentially failing to perfectly cancel each other for each finite $m,M$ in the case of integrating an odd function like yours.

The definition you propose as intuitive is also a useful one, and is called the Cauchy Principal value integral. In this integral, the two limiting variables are the same.


By the same argument, we would have$$(\forall a\in\mathbb{R}):\int_{-\infty}^{+\infty}x+a\,\mathrm dx=0.$$But then$$0=\int_{-\infty}^{+\infty}x+a\,\mathrm dx=\int_{-\infty}^{+\infty}x\,\mathrm dx+\int_{-\infty}^{+\infty}a\,\mathrm dx=\int_{-\infty}^{+\infty}a\,\mathrm dx.$$I suppose that you see that there is a problem here.

And, as far as I know, nobody says that $\displaystyle\int_{-\infty}^{+\infty}x\,\mathrm dx=\infty$. People just say that the integral diverges.


The trouble is that depending on how we try to calculate the integral, we can get different answers. We know how to calculate the integral on any finite interval, so we might try using bigger and bigger intervals and integrating on each one to get an idea of what the integral on all of $\mathbb R$ might be. If we do this in the obvious, symmetrical way, we get zero:

$$\forall t, \int_{-t}^t x\ dx = 0$$

And therefore the limit as $t\to\infty$ is again zero. But what if we went about it differently? What if I used the intervals $[-bt, at]$ where $a$ is different to $b$, essentially growing my interval to the right at a different speed than how it grows to the left?

$$\int_{-bt}^{at} x\ dx = \frac 1 2t^2(a^2-b^2)$$

So we would get either $+\infty$ or $-\infty$ depending on which side grows faster. If we allow ourselves to grow the left and right sides according to arbitrary increasing positive functions $f$ and $g$:

$$\int_{-g(t)}^{f(t)} x\ dx = \frac 1 2 (f(t)^2 - g(t)^2)$$

So that by finding functions with $f(t)^2-g(t)^2=c$, you could make the limit into any constant number you like, making it seem as if the area under the curve is whatever you want it to be, so that your intuition that the area should be zero is based essentially on the aesthetic, not mathematical, fact that you happen to quite like symmetry.

Something similar happens in the simpler context of infinite sums. If I ask you to add up an infinite set of numbers like $\{a_1, a_2, a_3, ...\}$, you should want to ask me in what "order" you should add them up. Notice that the only reason you don't feel the need to do that with a finite set only is because addition is commutative, imagine how confused you'd be if I asked you to "divide the numbers $1, 2, 4$ and $7$". So if I asked you to add up $\{...a_{-2}, a_{-1}, a_0, a_1, a_2, a_3...\}$, what does that even mean? Do you do all the positive indices first, then all the negative ones? Do you skip back and forth like $a_0 + a_1 + a_{-1} + a_2 + a_{-2}+ ...$? Again, without conditions on the $a_i$, these different "orders" of summation can yield different answers.