I'm trying to find the mean (expected value) and variance for the following distribution function:
$F(x)=\begin{cases}
0 & \text{for } x \lt 0\\
x/4 & \text{for } 0 \le x \lt 1\\
x^2/4 & \text{for } 1 \le x \lt 2\\
1 & \text{for } x \ge 2\\
\end{cases}$
First I got the probability density function by differentiating
$f(x)=\begin{cases}
0 & \text{for } x \lt 0\\
1/4 & \text{for } 0 \le x \lt 1\\
x/2 & \text{for } 1 \le x \lt 2\\
0 & \text{for } x \ge 2\\
\end{cases}$
Which I simplified as
$f(x)=\begin{cases}
1/4 & \text{for } 0 \le x \lt 1\\
x/2 & \text{for } 1 \le x \lt 2\\
0 & \text{elsewhere}\\
\end{cases}$
Now I need to find the mean (expected value) and variance. I know that
$E(X)=\int xf(x)\,dx.$
Except I am not sure how I would calculate this as one value due to the function being in multiple parts. Any help is appreciated – Thank You!
Best Answer
You are on the right track, use the integral as follows:
$$\mathbb{E}(X) = \int x f(x) dx = \int_0^1 \frac{1}{4}x dx + \int_1^2 \frac{x^2}{2}dx = \frac{1}{8} + \frac{7}{6} = \frac{31}{24}.$$
Calculating the variance can be done using $Var(X) = \mathbb{E}(X^2)-\mathbb{E}(X)^2$.
$$\mathbb{E}(X^2) = \int x^2 f(x) dx = \frac{47}{24}$$ So the variance is equal to: $$Var(X) = \frac{47}{24} - \left(\frac{31}{24}\right)^2 \approx 0.29. $$