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.

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.
