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?
2026-03-29 17:26:57.1774805217
On
On
Deriving the variance of the Bernoulli distribution
5.1k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
4
There are 4 best solutions below
0
On
You forgot to square: $$ \sigma_X^2 = \sum_{i=1}^2 (x_i-p)^2P(X=x_i) = p^2(1-p)+(1-p)^2p =p(1-p)$$
2
On
By definition,
$$Var(X)=E(X^2)-E(X)^2%$$
Consider a success being a $1$ and a failure being a $0$.
Then we have
$$\begin{align*} Var(X) &=\sum_{x=0}^1(x^2)Pr(X=x)-\left(\sum_{x=0}^1(x)Pr(X=x)\right)^2\\\\ &=\left(1^2\cdot p + 0^2 (1-p)\right)-\left(1 \cdot p + 0 (1-p)\right)^2\\\\ &=p-p^2\\\\ &=p(1-p) \end{align*}$$
$$ \sigma_x^2=\sum_{i=1}^k(x_i-\mu_X)^\color{red}2Pr(X=x_i) $$ $$ \sigma_x^2=(x_0-p)^\color{red}2(1-p)+(x_1-p)^\color{red}2(p) $$ $$ \sigma_x^2=(0-p)^\color{red}2(1-p)+(1-p)^\color{red}2(p) $$ $$ \sigma_x^2=p^\color{red}2(1-p)+(1-p)^\color{red}2(p) $$ $$ \sigma_x^2=p(1-p)(p+1-p)=p(1-p) $$