# Integrating functions with absolute values

1. Jul 16, 2014

### Mogarrr

To find $E |X|$ of a cauchy random variable, I need to integrate
$\int_{-\infty}^{\infty}\frac1{\pi}\frac{|x|}{1+x^2}dx$.

From the definition of absolute value, we have
$\int_{-\infty}^0\frac1{\pi}\frac{-x}{1+x^2}dx + \int_0^{\infty}\frac1{\pi}\frac{x}{1+x^2}dx$ (I think).

But, the very next step in the textbook, which I'm trying to follow along, is
$\frac2{\pi}\int_0^{\infty}\frac{x}{1+x^2}dx$.

Unless I made some mistake, the reasoning here is that
$\int_{-\infty}^0\frac1{\pi}\frac{-x}{1+x^2}dx = \int_0^{\infty}\frac1{\pi}\frac{x}{1+x^2}dx$.

If this is true, why is this?

2. Jul 16, 2014

### Saitama

What happens if you do the substitution $-x=t$?

3. Jul 17, 2014

### Pond Dragon

Same idea behind $$\int_{a}^{b}\omega=-\int_{b}^{a}\omega.$$

4. Jul 17, 2014

### Mogarrr

Thanks for your help guys. Understanding accomplished.

Let $t=-x$, then $-dx=dt$, $\frac{-x}{1+x^2}=\frac{t}{1+t^2}$, and the bottom limit of integration changes from -∞ to ∞. Thus

$\int_{-\infty}^0\frac1{\pi}\frac{-x}{1+x^2}dx=(-1)\cdot \int_{\infty}^0\frac1{\pi}\frac{t}{1+t^2}dt = \int_0^{\infty}\frac1{\pi}\frac{t}{1+t^2}dt$.

Since t is a dummy variable, the integrand can be rewritten with x=t.