Why is the variance of a binomial distribution n*p*(1-p)? [duplicate]
I don’t understand why this is the formula for variance for binomial distribution. The 1-p especially confuses me. The variance in the square of the standard deviation which I don’t get how this gives us a deviation.
$\endgroup$ 21 Answer
$\begingroup$The expectation is given by
$$E(k)=\sum_{k=0}^n k\frac{n!}{k!(n-k)!} p^kq^{n-k}=np\sum_{k=1}^n \frac{(n-1)!}{(k-1)!(n-k)!} p^{k-1}q^{n-k}=np(p+q)^{n-1}=np$$ (the term $k=0$ vanishes).
Then the expectation of the square is
$$E(k^2)=\sum_{k=0}^n k^2\frac{n!}{k!(n-k)!} p^kq^{n-k}=\sum_{k=0}^n (k(k-1)+k)\frac{n!}{k!(n-k)!} p^kq^{n-k}\\ =n(n-1)p^2\sum_{k=2}^n \frac{(n-2)!}{(k-2)!(n-k)!} p^{k-2}q^{n-k}+np=n(n-1)p^2(p+q)^{n-2}+np$$ (the terms $k=0,1$ vanish).
Finally,
$$\text{Var}(k)=E(k^2)-E^2(k)=n(n-1)p^2+np-n^2p^2=npq.$$
$\endgroup$