Let $f(x) = |x-1|, 0 \leq x \leq 2$ be the probability density function of a random variable $X$. Find $E(X^2+X)$.
The book gives a different answer from what I got, and I have no idea why.
$E(X) = \int_{0}^2x|x-1|dx = \int_0^1 x(1-x)dx + \int_1^2 x(x-1)dx = 1$, and similarly $E(X^2)= \int_0^2x^2|x-1|dx = \int_0^1x^2(1-x)dx + \int_1^2x^2(x-1)dx = 3/2$.
So, $E(X^2+X) = E(X^2) + E(X) = 3/2 + 1 = 5/2$ is what I got, but the answer in the book is given as $13/6$. What am I doing wrong here?