Variance of a discrete random variables that takes on 2 values. 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.

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]$).
