E ( X ) = ∫ − ∞ ∞ x f ( x ) d x = ∫ − 1 / 2 0 x d x + ∫ 0 1 / 4 2 x d x = [ x 2 2 ] | − 1 / 2 0 + [ x 2 ] | 0 1 / 4 = 0 − 1 8 + 1 16 − 0 = − 1 16 . {\displaystyle {\begin{aligned}\mathbb {E} (X)&=\int _{-\infty }^{\infty }xf(x)\;\mathrm {d} x=\int _{-1/2}^{0}x\;\mathrm {d} x+\int _{0}^{1/4}2x\;\mathrm {d} x\\&=\left.\left[{\frac {x^{2}}{2}}\right]\right|_{-1/2}^{0}+\left.\left[x^{2}\right]\right|_{0}^{1/4}=0-{\frac {1}{8}}+{\frac {1}{16}}-0=-{\frac {1}{16}}.\end{aligned}}}