For exam preparation I try to solve the following question:
Does the expected value exist for the density function $\frac{1}{\pi} \int_{-\infty}^{\infty} \frac{1}{x^2+1} \; \mathrm{d}x$
As I understand it I need to show that $\int_{-\infty}^{\infty}xf(x)\;dx$ converges
$$ \text{finding antiderivative}\\ \\ \frac{1}{\pi} \int_{-\infty}^{\infty} \frac{x}{x^2+1} \; \mathrm{d}x\\ \\ \text{substitute}\;u = x^2+1, du = 2x\\ \\ \frac{1}{2\pi} \int_{-\infty}^{\infty} \frac{1}{u} \; \mathrm{d}u = \frac{ln(\lvert u \rvert)}{2\pi} \Big|_{-\infty}^{\infty}\\ \\ \text{back substitution I get}\\ \\ \frac{ln(x^2+1)}{2\pi} \Big|_{-\infty}^{\infty} = 0 $$
So the integral exist and converges. What I am doing wrong here?
Any comment is appreciated. Thank you.
Your assertion $$ \frac{1}{2\pi} \int_{-\infty}^{\infty} \frac{1}{u} \; \mathrm{d}u = \frac{ln(\lvert u \rvert)}{2\pi} \Big|_{-\infty}^{\infty}\\ $$ is not correct. In fact, these four integrals all diverge: $$ \frac{1}{2\pi} \int_0^1 \frac{1}{u}\;du = +\infty \\ \frac{1}{2\pi} \int_1^{+\infty} \frac{1}{u}\;du = +\infty \\ \frac{1}{2\pi} \int_{-\infty}^{-1} \frac{1}{u}\;du = -\infty \\ \frac{1}{2\pi} \int_{-1}^0 \frac{1}{u}\;du = -\infty $$ When we say $$ \frac{1}{2\pi} \int_{-\infty}^{\infty} \frac{1}{u} \; \mathrm{d}u $$ converges, we mean those four integrals all converge.