# Expected value with piecewise probability density function (PDF)

I am continuing the prepare for an exam by reviewing handouts from an old statistics course I took. The handout came with a set of solutions prepared by the instructor, but I suspect that one of the answers is wrong. If the answer the instructor provided isn't wrong, then I must be missing something, so I'd like to ask the CV community to help where I've gone wrong. Here is the question:

Suppose that $X$ is a continuous random variable with pdf given by:

$f(x) = \left\{ \begin{array}{lr} x & 0 < x < 1\\ (2x-1)/12 & 1< x < 3 \end{array} \right.$

if $g(x) = x$ for $x>2$ and $g(x)=0$ for $x \le 2$, find the expected value $Eg(x)$.

The instructor put the solution as $10/9$. However, I've reworked my solution several times and continue to arrive at the answer $Eg(x)=61/72$. Here is how I approached this problem:

By definition, we know:

$$Eg(X) = \int_{-\infty}^{\infty}g(x)f(x)dx\tag{1}$$ Since $f(x)$ and $g(x)$ are $0$ everywhere, except from $2<x<3$, I only need to integrate (1) over these values of $x$. Doing so yields: $$Eg(X) = \int_{2}^{3}g(x)f(x)dx=\int_{2}^{3}{x(2x-1)\over{12}}dx=\int_{2}^{3}{2x^2-x\over{12}}dx$$ $$={1\over{12}}\left({{2x^3}\over{3}}-{x^2\over{2}}\right)\bigg\rvert_{x=2}^{x=3}={1\over{12}}\left[\left({{54}\over{3}}-{9\over{2}}\right)-\left({{16}\over{3}}-{4\over{2}}\right)\right]\bigg\rvert_{x=2}^{x=3}=61/72$$

I think the instructor accidentally integrated over $1<x<2$ instead of over $2<x<3$, but as I said earlier, I'm just hoping someone can verify if I'm correct, or perhaps I'm just not understanding something here. Thanks.

• I think you're right. If you can get correct answers for similar problems then you should have no reason to worry. – mark999 Apr 22 '17 at 6:53
• I agree with your answer. – Glen_b -Reinstate Monica Apr 22 '17 at 9:54
• Much appreciated, to you both! This makes me feel a lot better! – StatsStudent Apr 22 '17 at 15:49
• could you please add a tag-wiki for your new tag piecewise-pdf ? – kjetil b halvorsen Apr 23 '17 at 11:20