Bernoulli Model: Help calculating variance of asset price? I'm currently looking at the Bernoulli Model for an asset, with spot price $S_{0}$, which can rise to $uS_0$ with probability $p$ or drop to $dS_0$ with probability $q = 1-p$, over a time of $\delta t$. Hence I have
$$E(S_{\delta t}) = (pu + qd) S_0 $$
$$Var(S_{\delta t}) = E(S^2) - (E(S))^2$$
$$(E(S))^2 = (pu + qd)^2S_0^2$$
$$E(S^2) = pu^2S_0^2+qd^2S_0^2$$
Now the solution I have reads
$Var(S) = (pu^2 + qd^2 - p^2 u^2-2pqud - q^2 d^2)S_0^2 $
$= (p^2u^2 +pqu^2 + qpd^2 + q^2d^2 -p^2 u^2-2pqud - q^2 d^2)S_0^2$
Can someone help explain how we get to the last line? I.e. how does $pu^2 + qd^2$ become $p^2u^2 +pqu^2 + qpd^2 + q^2d^2$?
All help appreciated

Since $p + q = 1$, it follows that $$p^2 + pq = p(p + q) = p,$$ and similarly, $$qp + q^2 = q(p+q) = q.$$  Therefore,
$$pu^2 + qd^2 = p(p+q)u^2 + q(p+q)d^2 = p^2 u^2 + pq u^2 + qp d^2 + q^2 d^2$$ as claimed.
