Bernoulli Distribution
The Bernoulli Distribution: One Trial, Two Outcomes
A Bernoulli random variable X describes the outcome of a single trial that can end in only two ways: success (X=1) with probability p, or failure (X=0) with probability 1−p.
It is the building block for many other discrete distributions, but on its own it always involves exactly one trial.
Which outcome is labelled 'success' is a modelling choice, not a value judgement: a spam filter may call a spam email a success simply because that is the event being counted.
Probability mass function of a Bernoulli random variable X, where X=1 if a customer clicks an ad and X=0 otherwise.
Variance of a Bernoulli random variable as a function of the success probability
Probability mass function
For x∈{0,1}:
which just means P(X=1)=p and P(X=0)=1−p. Nothing else is possible, there is no P(X=2) or P(X=0.5). A candidate PMF is only Bernoulli if it assigns probabilities to exactly the outcomes 0 and 1, keeps both in [0,1], and has them sum to 1.
Mean and variance
Because X takes only the values 0 and 1, its expectation collapses to the success probability itself:
The second line uses E[X2]=E[X], which holds because 02=0 and 12=1, a shortcut available only for indicator-type variables. Note that Var(X) is zero when p=0 or p=1, since the outcome is then certain, and it is largest in the middle of the range where the outcome is least predictable.
The variance is also symmetric: p and 1−p give the same value, so a trial with p=0.2 and one with p=0.8 are equally variable.
Linear functions of a Bernoulli variable
If Y=aX+b then E[Y]=ap+b and Var(Y)=a2p(1−p). Adding a constant shifts every outcome by the same amount and so cannot change the spread, while multiplying by a stretches every deviation by a and therefore scales the variance by a2. This is how a two-outcome cost or payout is analysed.
Worked example
A single manufactured bolt passes inspection with probability p=0.9. Let X=1 if it passes. Then E[X]=0.9 and Var(X)=0.9(0.1)=0.09, so σX=0.09=0.3. The standard deviation is in the same (unitless) scale as X itself, which is why it is reported instead of the variance when a spread is quoted alongside the mean.
Which of the following is a valid probability mass function for a Bernoulli random variable X?
The graph shows Var(X)=p(1−p) for a Bernoulli random variable X as a function of p. Two production lines each produce one item, defective with probability p=0.1 on the first line and p=0.3 on the second. Using the graph, approximately how many times larger is the variance of the second line's Bernoulli outcome than the first line's?
Probability mass function of a Bernoulli random variable X, where X=1 if a customer clicks an ad and X=0 otherwise.
Variance of a Bernoulli random variable as a function of the success probability