# 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.
$\newcommand{\angles}{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}{\displaystyle{#1}} \newcommand{\dsc}{\displaystyle{\color{red}{#1}}} \newcommand{\expo}{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}{\,{\rm Li}_{#1}} \newcommand{\norm}{\left\vert\left\vert\, #1\,\right\vert\right\vert} \newcommand{\pars}{\left(\, #1 \,\right)} \newcommand{\partiald}[]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}{\underline{#1}} \newcommand{\verts}{\left\vert\, #1 \,\right\vert}$ If we do not want 'to split' the integral, it's easier to use some properties related to the Dirac Delta Function $\ds{\delta}$ such as $$\quad\totald{\verts{x}}{x} = \sgn\pars{x}\,,\quad \totald{\sgn\pars{x}}{x} = 2\delta\pars{x}\quad\mbox{and}\quad \delta\pars{\fermi\pars{x}}=\sum_{i}{\delta\pars{x - x_{i}} \over \verts{\fermi'\pars{x_{i}}}}$$ where $\ds{\fermi\pars{x_{i}} = 0}$. We recommend to any reader to check carefully the above link.