Count the variance of n Bernoulli trials with each probability of success is p.
Let random variable $X_i$ be
$1$ if trial is success, or
$0$ if trial fails.
Then expected value $E(X_i) = 1 \times p + 0 \times (1 - p) = p$.
By linearity of expectation $E(X) = p_1 + p_2 + ... + p_n = np$.
To count the variance, I use this formula $V(X) = E(X^2) - E(X)^2$.
where $E(X_i^2) = 1^2 \times p + 0^2 \times (1 - p) = p$
then, $E(X^2) = p_1 + p_2 + ... + p_n = np$.
So, I got variance $V(X) = np - (np)^2 = np(1 - np)$.
But in wiki, it says that the correct variance is $np(1 - p)$.
Where did I do wrong?
Thanks a lot for the help.