The Mean and Variance of the Bernoulli Distribution
📂Probability DistributionThe Mean and Variance of the Bernoulli Distribution
Given X∼ when Bin(1,p), the mean and variance of X are as follows.
E(X)=p
Var(X)=p(1−p)=pq,q=1−p
Proof
For p∈[0,1], a discrete probability distribution with the following probability mass function is called a Bernoulli distribution.
f(x)=px(1−p)1−x,x=0,1
Direct Calculation
By the definition of expected value,
E(X)=x=0,1∑xf(x)=0⋅f(0)+1⋅f(1)=0⋅(1−p)+1⋅p=p
To obtain the variance, let’s calculate E(X2).
E(X2)=x=0,1∑x2f(x)=02⋅f(0)+12⋅f(1)=02⋅(1−p)+12⋅p=p
The variance is Var(X)=E(X2)−E(X)2, thus
Var(X)=p−p2=p(1−p)=pq
■
From the Moment Generating Function
The moment generating function of the Bernoulli distribution is as follows.
m(t)=1−p+pet=q+pet
The expected value is m′(0), therefore
E(X)=m′(0)=pet∣t=0=p
To find the variance, let’s calculate m′′(0).
m′′(t)=pet∣t=0=p
Thus, the variance is Var(X)=m′′(0)−m′(0)2, and consequently
Var(X)=p−p2=p(1−p)=pq
■