Bernoulli random variables: mean, variance, and standard deviation

A yes-or-no result can become a numerical random variable when we code the two outcomes as zero and one. That is a Bernoulli random variable. We’ll use a peanut-butter survey to see what its mean and spread tell us.

Code one trial as zero or one

A Bernoulli variable X describes one trial: X=1 for success and X=0 for failure. The word success labels the outcome we choose to count. If its probability is p, then

P(X=1)=pP(X=0)=1-p

The parameter satisfies 0≤p≤1. A Bernoulli variable is a binomial variable with one trial. A general binomial variable counts successes across several trials and can take values beyond just zero and one.

Example: Model a student’s survey answer

Suppose 75% of the students in my class like peanut butter. Choose one student from that class at random. Code liking peanut butter as 1 and disliking it as 0. Then p=0.75, and the probability of 0 is 0.25.

Bernoulli probabilities for disliking or liking peanut butterThe probability at zero is one quarter. The probability at one is three quarters. These are the only two possible values.Probability00.250.50.7510.250.7501X
X = 0 means dislike; X = 1 means like. The two probabilities add to 1.

Find the mean as a probability-weighted average

μ=(1-p)(0)+p(1)μ=p

For the class example, μ=0.25(0)+0.75(1)=0.75. Each individual outcome is still either 0 or 1. The mean describes the long-run average of the numerical codes, which is the proportion of successes.

Find the variance

Weight each squared distance from the mean by the probability of that outcome.

σ2=(1-p)(0-p)2+p(1-p)2=(1-p)p2+p(1-p)2=p(1-p)(p+1-p)=p(1-p)

Using p=0.75 gives

σ2=0.75(0.25)=0.1875

The same result comes from 0.25(0-0.75)2+0.75(1-0.75)2.

Take the square root for standard deviation

σ=p(1-p)
σ=0.1875≈0.4330