Variance of a discrete random variables that takes on 2 values.

726 Views Asked by At

Suppose I have a random variable that takes on a value of 10 with p(x=10)=.7 and a value of 20 with p(x=20) = .3.

The E(X) = .7(10)+.3(20) = 13.

The variance would be the expected value of the differences from the mean for each x.

Var(X) = .7(13-10)^2 + .3(20-13)^2 = 21.

The posted solution has (.7)(.3)(10)^2 which I've identified as (.7)(.3)(20-10)^2. This also equals 21. I just can't see how that identity works.

In general it would look like this:

E(X) = p*(1-p)*(b-a)^2 where P(x=b) = p and P(x=a) = 1-p.

I'm just not seeing it for some reason, but it appears to always work. I've tried expanding all the expressions out and comparing, but I can't get them to match up.

3

There are 3 best solutions below

0
On

Suppose that $X$ only takes two values $a$ and $b$ with probabilities of $P(X=a)=p$ and $P(x=b)=1-p$. $E[X]=pa+(1-p)b$. \begin{align*} V(X)&=p(a-E[X])^2+(1-p)(b-E[X])^2\\ ={}&p[a-pa-(1-p)b]^2+(1-p)[b-pa-(1-p)b]^2\\ ={}&p(1-p)^2 (a-b)^2+(1-p)p^2(a-b)^2\\ ={}&p(1-p)(a-b)^2 \end{align*}

2
On

Consider a Bernoulli random variable $Y$ with parameter $p=0.3$: i.e., $\Pr[Y=1]=p$, $\Pr[Y=0]=1-p$. It is known (and easy to verify) that $\operatorname{Var}[Y] = p(1-p)$.

Set $b=20$, $a=10$. Note that $X$ has the same distribution as $(b-a)Y+b$ (can you see why?). Therefore, $$ \operatorname{Var}[X] = \operatorname{Var}[(b-a)Y+b] = \operatorname{Var}[(b-a)Y] = (b-a)^2\operatorname{Var}[Y] = (b-a)^2\cdot p(1-p) $$ where the second and third equality are by properties of the variance (are you familiar with them? $\operatorname{Var}[\alpha X]=\alpha^2\operatorname{Var}[X]$ and $\operatorname{Var}[X+\beta]=\operatorname{Var}[X]$).

1
On

Here is an explicit computation which may be useful:

$$ Var\left(X\right) = p\left(x_{1}-\mu\right)^{2}+\left(1-p\right)\left(x_{2}-\mu\right)^{2} $$

$$ p\left[\left(x_{1}-\mu\right)^{2}-\left(x_{2}-\mu\right)^{2}\right]+\left(x_{2}-\mu\right)^{2} $$

$$ p\left(x_{1}^{2}-x_{2}^{2}-2x_{1}\mu+2x_{2}\mu\right)+\left(x_{2}-\mu\right)^{2} $$

Now $$ \mu=px_{1}+\left(1-p\right)x_{2} $$ $$ \mu=px_{1}+x_{2}-px_{2} $$

and we can substitute below (Noting that $\left(x_{2}-x_{1}\right)^{2}=\left(x_{1}-x_{2}\right)^{2}$ ):

$$ p\left(x_{1}^{2}-x_{2}^{2}-2x_{1}\mu+2x_{2}\mu\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$

$$ p\left(x_{1}^{2}-x_{2}^{2}-2\mu\left(x_{1}-x_{2}\right)\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$

$$ p\left(x_{1}^{2}-x_{2}^{2}-2\left(px_{1}+x_{2}-px_{2}\right)\left(x_{1}-x_{2}\right)\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$

$$ p\left(x_{1}^{2}-x_{2}^{2}-2\left(px_{1}^{2}-px_{1}x_{2}+x_{2}x_{1}-x_{2}^{2}-px_{2}x_{1}+px_{2}^{2}\right)\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$

$$ p\left(x_{1}^{2}-x_{2}^{2}-2px_{1}^{2}+2px_{1}x_{2}-2x_{2}x_{1}+2x_{2}^{2}+2px_{2}x_{1}-2px_{2}^{2}\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$ $$ p\left(x_{1}^{2}+x_{2}^{2}-2px_{1}^{2}+2px_{1}x_{2}-2x_{2}x_{1}+2px_{2}x_{1}-2px_{2}^{2}\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$ $$ p\left(\left(x_{1}-x_{2}\right)^{2}-2px_{1}^{2}+2px_{1}x_{2}+2px_{2}x_{1}-2px_{2}^{2}\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$ $$ p\left(\left(x_{1}-x_{2}\right)^{2}-2p\left(x_{1}^{2}-2x_{1}x_{2}+x_{2}^{2}\right)\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$ $$ p\left(\left(x_{1}-x_{2}\right)^{2}-2p\left(x_{1}-x_{2}\right)^{2}\right)+p^{2}\left(x_{1}-x_{2}\right)^{2} $$ $$ p\left(x_{1}-x_{2}\right)^{2}-p^{2}\left(x_{1}-x_{2}\right)^{2} $$ $$ p\left(x_{1}-x_{2}\right)^{2}\left(1-p\right) $$

I hope this helps.