Edit Problem


B expectation of a continuous random variable
|
Easy


Suppose random variable $X$ has the following pdf: $$f(x) = \begin{cases} x, &0 \le x \le 1\\ 2-x, & 1 < x \le 2\\ 0, &otherwise\end{cases}$$. Compute $E[X]$.

Solution:

We write down the definition of expectation and then break down the integral into segments:

$E[X] = \int_{-\infty}^\infty xf(x) dx = \int_{-\infty}^0 x \cdot 0 dx + \int_0^1 x \cdot x dx + \int_1^2 x(2-x)dx + \int_0^{\infty} x \cdot 0 dx= 0 + \frac{1}{3} + \frac{2}{3} + 0 = 1$