# Expected Value of a Probability Density Function with Absolute Value

I'm given a probability density function $f(x) = c |(x^2 - 1)|$ for $-2 \leq x \leq 3.$ I found $c$ by by integrating from -2 to 3 and setting this equal to 1 and got $c = \frac{3}{28}$, so $f(x) = \frac{3}{28} |(x^2 - 1)|$. However, this was tedious because I couldn't think of any other way to do it besides splitting the function into three parts (two positive chunks and one negative chunk), due to the absolute value.

Now I'm asked to find E(X), the expected value. (I did what my textbook told me and simply multiplied each by $x$.) I split it into three integrals again.

$$E(X) = \int\limits_{-2}^{-1}{x\frac{3}{28}(x^2 - 1)}\,dx + \int\limits_{-1}^{1}{x\frac{-3}{28}(x^2 - 1)}\,dx + \int\limits_{1}^{3}{x\frac{3}{28}(x^2 - 1)}\,dx$$

Now it seems like I'm finding the expected value of three separate components, so I thought I might have to average them. But my calculator says

$$\int\limits_{-2}^{3}{x\frac{3}{28}|{(x^2 - 1)}|}\,dx = \frac{165}{112}$$

which is what I got when I did the addition out above.

But I think this must be wrong, since the function $\frac{3}{28}|(x^2 - 1)|$ doesn't even attain that value over the interval, and my understanding is that expected value is like the average of the probability density function.

Is my methodology wrong?

• Expected value (of $X$) is not like the average of the density. It's the (density-weighted) average of $X$. You should disabuse yourself of this misconception. – MPW Feb 10 '14 at 3:34

You're finding the average value (not the average probability), and the value ranges from $-2$ to $3$, so $165/112$ looks like a possible average value (especially since the pdf is weighted toward the high numbers).
The function $\frac{3}{28}|x^2-1|$ gives the probability of getting the value $x$. The mean $E[X]=\frac{165}{112}$ gives the mean value of the value X gave (which is between -2 and 3).
A much easier way to compute the expected value is to observe that for $-2 \le x \le 2$, $f_X(x) = f_X(-x)$; that is, the density is symmetric about $0$ over this subset of the support. Therefore, $$\int_{x=-2}^0 x f_X(x) \, dx + \int_{x=0}^2 x f_X(x) \, dx = 0,$$ and it immediately follows that $$\operatorname{E}[X] = \int_{x=2}^3 x \cdot \frac{3}{28} (x^2-1) \, dx = \frac{3}{28} \left[ \frac{x^4}{4} - \frac{x^2}{2} \right]_{x=2}^3 = \frac{165}{112},$$ as originally calculated.