I saw other similar posts where they do the integration from math stackexchange, but confused about this one since it is given in p. The following is my problem.
I was looking to find the mean from the following cumulative distribution function.
The function F(x) is
0 when z<o
p when o $\leq$ z<2
1 when z$\geq$ 2
The answer given in the solution is 2(1-p) but I couldn't follow the steps. I saw other similar posts where they do the integration from math stackexchange, but confused about this one since it is given in p.
appreciate your support. Thanks!
Your rv is discrete taking only the values $\{0;2\}$ with probability $\{p;(1-p)\}$, respectively, thus the expectation is
$$\mathbb{E}(X)=0\times p+2\times(1-p)=2(1-p)$$
To understand that your rv is discrete do a drawing of your CDF and observe that it has two "jumps" (two discontinuity points) in $x=0$ and $x=2$ and the sum of the two jumps is 1
The expectation is the area above the CDF: the area of a rectangle with base $2$ and height $(1-p)$