Deriving the variance of the Bernoulli distribution

$\begingroup$

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?

$\endgroup$ 3

4 Answers

$\begingroup$

$$ \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) $$

$\endgroup$ $\begingroup$

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)$$

$\endgroup$ $\begingroup$

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*}$$

$\endgroup$ 2 $\begingroup$

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) $$

$\endgroup$ 1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like