Deriving the variance of the Bernoulli distribution For a Bernoulli distribution, $\mu_X = p$. I can easily derive this from the general equation for mean of a discrete random variable:
$$
\mu_X=\sum_{i=1}^kx_iPr(X=x)
$$
$$
\mu_X=1(p)+0(1-p)=p
$$
I know that the variance of the Bernoulli distribution is supposed to be $\sigma_x^2=p(1-p)$. But I can not seem to derive that properly from the general equation for variance of a discrete random variable:
$$
\sigma_x^2=\sum_{i=1}^k(x_i-\mu_X)Pr(X=x_i)
$$
$$
\sigma_x^2=(x_0-p)(1-p)+(x_1-p)(p)
$$
$$
\sigma_x^2=(0-p)(1-p)+(1-p)(p)
$$
$$
\sigma_x^2=-p(1-p)+(1-p)(p)
$$
$$
\sigma_x^2=-p+p^2+p-p^2
$$
$$
\sigma_x^2=0
$$
This is obviously incorrect; what am I doing incorrectly in my derivation?

Let $X\sim Ber(p)$. You've rightly shown that $E(X) = p$.  
Now compute $E(X^2)$. That is, 
$$\sum_{\ x\in R_x}x^2p_X(x) = 1^2\cdot p_X(1) + 0^2\cdot p_X(0) = p + 0 = p$$ 
Therefore, 
$$Var(X) = E(X^2) - E(X)^2 = p - p^2 = p(1-p) $$
