Mean of a Cauchy Distribution

Why is the mean of a Cauchy distribution undefined? Surely, it should be $0$ by symmetry? $$\int_{-\infty}^{\infty} {\frac{x}{\pi (1+x^2)}} dx =0?$$

Solutions Collecting From Web of "Mean of a Cauchy Distribution"

The problem is that
$$
\int_0^\infty \frac{x\,dx}{1+x^2}=+\infty \text{ and }\int_{-\infty}^0 \frac{x\,dx}{1+x^2}=-\infty,
$$
and one consequence of the positive and negative parts both being infinite is that
$$
\lim_{a\to\infty,\ b\to\infty} \int_{-a}^b \frac{x\,dx}{1+x^2}
$$
actually depends on the way in which $a$ and $b$ are related. For example, if $a=b$, then you have
$$
\int_{-b}^b \frac{x\,dx}{1+x^2}=0,
$$
but if $a=2b$ then you have
\begin{align}
\int_{-2b}^b \frac{x\,dx}{1+x^2} & = \int_0^b \frac{x\,dx}{1+x^2} + \int_{-2b}^0 \frac{x\,dx}{1+x^2} \\[10pt]
& = \int_1^{1+b^2} \frac{du/2} u + \int_{1+4b^2}^1 \frac{du/2} u \\[10pt]
& = \frac 1 2 \log(1+b^2) – \frac 1 2 \log(1+4b^2) \\[10pt]
& = \frac 1 2 \log\frac{1+b^2}{1+4b^2} \\[10pt]
& \to -\frac 1 2 \log 4 \ne 0 \text{ as }b\to\infty.
\end{align}
This sort of thing can happen only when the positive and negative parts are both infinite.

Another consequence is that things like the law of large numbers do not apply. Neither does the central limit theorem.

Do not mix improper integral with its Cauchy principal value. In the former, in particular, every integral of the form
$$
\int_{a}^{\infty} {\frac{x}{\pi (1+x^2)}}\, dx
$$
must exist. But the integral behaves as that of $1/x$, hence is divergent.