To compute
, we will compute the integral
, where
is the probability density function of
.
Since
for all
and
.
Since
for
and
for
,
![{\displaystyle {\begin{aligned}E(X)&=\int _{-1}^{0}\left({\frac {x}{4}}-{\frac {x^{2}}{2}}\right)\,dx+\int _{0}^{1}\left({\frac {x}{4}}+{\frac {x^{2}}{2}}\right)\,dx\\&=\left.\left({\frac {x^{2}}{8}}-{\frac {x^{3}}{6}}\right)\right|_{-1}^{0}+\left.\left({\frac {x^{2}}{8}}+{\frac {x^{3}}{6}}\right)\right|_{0}^{1}\\&=-\left({\frac {1}{8}}+{\frac {1}{6}}\right)+\left({\frac {1}{8}}+{\frac {1}{6}}\right)\\&=0.\end{aligned}}}](https://wiki.ubc.ca/api/rest_v1/media/math/render/svg/9dd8254d79d9225c3ac19c27e8e987a6d6aaaf87)
Hence
.
Note that we could have also obtained this result by simply noting that the integrand
is an odd function, and if
is an odd function,
for any
.