5
$\begingroup$

I am given a pdf $f(x) = |x-1|$ for $0 \leq x \leq 2,$ 0 otherwise, and asked to find expected value of $X^{2} + X.$ I simply integrated $(x^{2} + x)|x-1|$ from 0 to 2, checked with mathematica, and got $\frac{5}{2}.$ The answer in the back of the book, however, is $\frac{13}6.$ What am I doing wrong?

Thanks.

  • 0
    okay thanks, good to know I am not crazy!2011-11-18

1 Answers 1

2

Resolved in comments.

The textbook answer is wrong. The correct answer is what the OP got.

$ \begin{align*} \mathbf E [X^2 + X] &= \int_{-\infty}^{+\infty} f(x) (x^2+x) ~dx \\ &= \int_{0}^{2} |x-1| (x^2+x) ~dx \\ &= \int_{0}^{1} (1-x) (x^2+x) ~dx + \int_{1}^{2} (x-1) (x^2+x) ~dx \\ &= \int_{0}^{1} (x-x^3) ~dx + \int_{1}^{2} (x^3-x) ~dx \\ &= \left. \Big(\frac{x^2}{2}-\frac{x^4}{4} \Big)\right|_{0}^1 + \left. \Big(\frac{x^4}{4}-\frac{x^2}{2} \Big) \right|_{1}^2 \\ &= \Big( \frac{1}{2}-\frac{1}{4} \Big) + \Big(\frac{2^4}{4}-\frac{2^2}{2} \Big) - \Big( \frac{1}{4}-\frac{1}{2} \Big) \\ &= \frac52 . \end{align*} $