Bernoulli and Binomial Distributions
Model one binary trial with a Bernoulli variable and count successes across repeated trials with a binomial variable. Derive exact and cumulative probabilities, moments, and sample-proportion behavior, then check the assumptions behind the count model.
Bernoulli and binomial distributions describe binary trials. A Bernoulli variable records one success or failure. A binomial variable counts successes across a fixed number of independent Bernoulli trials with the same success probability.
One Binary Trial
A Bernoulli random variable takes two numerical values:
We write , where . Calling the outcomes “success” and “failure” is conventional; success need not be desirable. It is simply the event encoded by .
The probability mass function can be written compactly as:
“The mass at is raised to , times one minus raised to one minus .” Substituting the only two allowed values recovers and .
Substituting leaves ; substituting leaves . Examples include whether a component fails, whether a user clicks, or whether one prediction is correct—provided the outcome is genuinely binary.
Exercise: Read a Bernoulli parameter
If , what is ?
Compute it first, then check your number.
HintUse the complementary outcome
The masses at zero and one must sum to one.
SolutionAssign the remaining probability to zero
Since ,
The parameter always refers to the outcome encoded as one.
Mean and Variance of a Bernoulli Variable
Because is either zero or one,
Also , so:
The variance is zero at and , where the outcome is certain. It is largest at , where uncertainty between the two outcomes is greatest.
Exercise: Compute Bernoulli variance
What is the variance of ?
Compute it first, then check your number.
HintUse p times one minus p
Calculate .
SolutionMeasure binary uncertainty
The variance is:
It is smaller than the maximum because one outcome is considerably more likely than the other.
Count Successes across Repeated Trials
Let be independent Bernoulli variables with the same parameter . Their sum:
counts the number of successes. We write:
For ,
“The probability of exactly successes in trials equals choose , times to the , times one minus to the .”
One particular sequence with successes has probability . The coefficient:
counts the positions in which those successes can occur.
For three fair trials, exactly two successes can appear as , , or . Each sequence has probability , so the total is .
Exercise: Compute a binomial probability
Three independent trials each succeed with probability . What is the probability of exactly two successes?
Compute it first, then check your number.
HintCount the possible success positions
There are sequences with two successes.
SolutionCount and weight all matching sequences
Apply the binomial formula:
Omitting the coefficient would count only one of the three valid sequences.
Binomial Mean and Variance
Since is a sum of Bernoulli variables, linearity of expectation gives:
Independence makes the covariance terms zero, so variances add:
For and , the expected count is and the variance is . An expectation of does not say every batch contains six successes; it is the probability-weighted center of the count distribution.
Holding fixed while increasing moves the distribution toward larger success counts. Holding fixed while increasing also moves the expected count, , to the right and usually spreads the count over more integer values. In contrast, the sample proportion becomes more concentrated around because its variance is .
Exercise: Calculate a binomial mean and variance
If , what is ?
Compute it first, then check your number.
HintMultiply trial count by success probability
Use .
SolutionAdd the expected contributions of ten trials
The expected count is:
Each trial contributes expected value , and expectation adds even before independence is used.
Exactly, At Most, and At Least
The mass function gives for one exact count. Questions about ranges of counts require adding disjoint masses. For example:
Complements can shorten an “at least” calculation:
For four independent trials with , the probability of at least one success is:
The expression includes counts and ; it is not the same as the exact-count probability .
Exercise: Calculate an at-least-one probability
Five independent trials each succeed with probability . What is the probability of at least one success?
Compute it first, then check your number.
HintUse the complementary zero-success event
Calculate .
SolutionSubtract the probability of no successes
The only way to avoid at least one success is to have five failures:
Counts and Sample Proportions
The sample success proportion is:
Scaling the binomial moments gives:
Thus the sample proportion is centered at the trial probability, and its variance decreases as the number of trials grows. This does not mean every large sample gives exactly ; it means the distribution of becomes more concentrated around .
Exercise: Find the spread of a sample proportion
For independent Bernoulli trials with , what is ?
Compute it first, then check your number.
HintDivide Bernoulli variance by the sample size
Use .
SolutionScale count variance by the square of n
The variance is:
Equivalently, divide by because .
Check the Modeling Assumptions
A binomial model requires:
- a fixed number of trials;
- two outcomes per trial;
- the same success probability for every trial;
- independence between trials.
Sampling ten items with replacement from a large stable population may fit these assumptions. Drawing ten cards without replacement does not: earlier draws change later probabilities. Trials collected over time may also have a changing . A count between zero and is not enough by itself to justify a binomial model.
Exercise: Reject an invalid binomial model
Five cards are drawn from one deck without replacement, and counts the aces. Is exactly binomial with one fixed success probability?
Select one choice, then check.
HintInspect what changes after one draw
The deck composition depends on which card was removed.
SolutionThe repeated trials are not identical and independent
No. After each draw, both the number of remaining cards and possibly the number of remaining aces change. A hypergeometric model, introduced when needed, describes this without-replacement count.
Plot Exact Mass and Simulated Counts
Compare a binomial PMF with simulated counts
Change n, p, or the number of repetitions. Compare exact binomial probabilities with empirical frequencies.
Ready to run.
The simulation approaches the exact mass function as repetitions increase, but finite samples still fluctuate around it.
Before Choosing a Binary Distribution
Use Bernoulli for one binary outcome and binomial for the count across a fixed number of independent, equal-probability Bernoulli trials. State which outcome is encoded as one, distinguish a count from a proportion, and verify the repeated-trial assumptions rather than relying only on the observed range.
The next lesson extends the same one-trial-versus-count distinction from two outcomes to any finite number of categories.