\underline{1}

Example For f(x) = \{ \begin{matrix}1 − |x| & (−1 ≤ x ≤ 1) \\ 0 & (else) \end{matrix} ,

find the expectation and the variance. Answer We find the expectation

E(X) = ∫_{−∞}^{∞} xf(x)dx
= ∫_{−∞}^{−1} 0dx + ∫_{−1}^{0} x(1 + x)dx + ∫_{0}^{1} x(1 − x)dx + ∫_{1}^{∞} 0dx
= [\frac{x^{2}}{2} + \frac{x^{3}}{3} ]_{−1}^{0} + [\frac{x^{2}}{2} − \frac{x^{3}}{3} ]_{0}^{1} = 0
E(X^{2}) = ∫_{−∞}^{∞} x^{2}f(x)dx
= ∫_{−∞}^{−1} 0dx + ∫_{−1}^{0} x^{2}(1 + x)dx + ∫_{0}^{1} x^{2}(1 − x)dx + ∫_{1}^{∞} 0dx
= [\frac{x^{3}}{3} + \frac{x^{4}}{4} ]_{−1}^{0} + [\frac{x^{3}}{3} − \frac{x^{4}}{4} ]_{0}^{1}
= −(−\frac{1}{3} + \frac{1}{4}) + \frac{1}{3} − \frac{1}{4} = \frac{2}{3} − \frac{1}{2} = \frac{1}{6}

Thus, the variance is give by

V (X) = E(X^{2}) − E(X)^{2} = \frac{1}{6}