So i know that the sample variance generic formula is :
$$ S_n^2=\frac{1}{n-1}\sum_{i=1}^n(X_i-\overline{X}_n)^2. $$
And i have this question :
$Y$ takes values of $0$ and $1$.
$\operatorname{Pr}(Y=1)=p=0.78$
$\operatorname{Pr}(Y=0)=1-p=0.22$
I do not understand why , in order to calculate the variance, i can and should use the formula:
$\operatorname{Var}(Y)= E(Y-E(Y))^2$ which is the same as $p(1-p)$.
What are these formulas? How come one is equal to another? How to we get to them ?
Can somebody give me a simple explanation on why the variance on this problem is $p(1-p$) ?
The answer i get is $0.78 \times (1-0.78)= 0.1716$.