GARETH GRANTTECHNOLOGY · DATA · INNOVATION
Explore

06 / Distributions

Binomial distribution: successes in a fixed number of trials

The binomial distribution models a count of yes/no outcomes across a specified number of comparable trials. It connects an assumed event rate to the chances of individual batch results.

FoundationLive exploration + Python

The business question

How variable can the number of defects or conversions be in a fixed batch?

  • Estimate the chance that defects exceed an inspection threshold in a batch.
  • Translate a sales-conversion assumption into the likely count from a fixed group of leads.
  • Plan review or rework capacity while recognising that a stable average rate still produces variation.

How the method works

Fix the number of trials before counting the outcome of interest. A trial might be one inspected item, one eligible booking or one independently reached lead. Label one of the two outcomes a success for the mathematics, even when it represents an undesirable event such as a defect. Use the same classification rule for every trial.

The probability of exactly k successes accounts for two things: the probability of any one arrangement with k successes, and the number of possible arrangements. The combination term counts those arrangements. Summing the exact probabilities gives a cumulative probability; the complementary tail answers a threshold question such as more than three defects. Tail boundaries matter because the count is discrete.

The expected count is n × p, but individual batches need not equal it. Its variance is n × p × (1 − p). The model assumes the event probability stays constant and trials are independent. Shared machine faults, household-level marketing effects or a changing shift can create dependence or different probabilities. In those circumstances a simple binomial calculation can understate the extremes.

The calculation

P(X = k) = C(n,k)pᵏ(1 − p)ⁿ⁻ᵏ; E[X] = np; Var(X) = np(1 − p)
Read the symbols
SymbolMeaning
nFixed number of trials.
pProbability of the counted outcome on each trial.
kWhole-number successes from 0 to n.
C(n,k)Number of ways k successes can be placed among n trials.

A worked business example

ILLUSTRATIVE SCENARIO

Illustrative packaging operation inspects batches of 100 items. Historical evidence motivates a scenario with a stable 2% defect probability per item. The supervisor asks how often a batch needs space for more than three reworks.

Inputs

  • n = 100 items per batch.
  • p = 0.02 defect probability, treated as known for this planning example.
  • Threshold: more than 3 defects, meaning 4 or more.

Work through the numbers

  1. Calculate the expected defect count: 100 × 0.02 = 2 defects.
  2. Calculate the variance: 100 × 0.02 × 0.98 = 1.96; the standard deviation is 1.40 defects.
  3. Exactly two defects has probability C(100,2) × 0.02² × 0.98⁹⁸ = 0.2734139.
  4. For more than three defects, sum k = 4 through 100, or use the survival probability P(X > 3) = 0.1410384.
Mean 2 defects per batch; probability of exactly 2 is 27.34%; probability of more than 3 is 14.10%.

A stable average of two defects does not mean that three rework places cover almost every batch. This scenario predicts that the threshold is exceeded in roughly 14% of comparable batches.

Explore the decision

Count successes in fixed trials. The live explorer has its own example inputs; it is separate from the worked calculation above.

Enable JavaScript to use this calculator. The worked example and executable Python remain available.

Apply it at work

  1. Define a trial, its two outcomes, the batch size and the threshold before calculating.
  2. Estimate p from relevant labelled records and assess differences between product types or shifts.
  3. Calculate the count distribution and the exact tail needed by the capacity decision.
  4. Compare predictions with later batches and revise the model if clustering, drift or estimation uncertainty matters.

Check these assumptions

  • The number of trials n is fixed rather than stopping after a target number of successes.
  • Every trial has the same event probability in the stated scenario.
  • Outcomes are independent, conditional on the model and its parameters.
  • Sampling without replacement is approximated only when depletion is negligible; otherwise use a finite-population model.

Common mistakes and how to avoid them

  • A 2% historical rate is an estimate, so treating it as perfectly known can understate planning uncertainty.
  • Counting defects rather than defective units can allow several events per item and break the yes/no trial definition.
  • Using P(X ≥ 3) when the question is P(X > 3) includes the boundary and gives a different answer.

How this can help the business

  • Threshold-based staffing or rework decisions can be tied to an explicit exceedance probability.
  • Sales or quality targets can be interpreted with their expected sampling variation instead of treating every fluctuation as a performance change.
A decision rule to adapt

Choose a count threshold that meets the stated coverage objective under a validated trial model, then monitor whether observed batches behave similarly.

When to use another approach

Use hypergeometric sampling for a known finite lot, negative binomial for appropriate overdispersed counts, or a beta-binomial predictive model when p is uncertain.

Reproduce the worked example in Python

The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.

Show executable code and recorded output
from scipy.stats import binom
n, p = 100, 0.02
print(f'Expected defects: {n*p:.2f}')
print(f'Count standard deviation: {(n*p*(1-p))**0.5:.2f}')
print(f'Exactly two defects: {binom.pmf(2,n,p):.2%}')
print(f'More than three defects: {binom.sf(3,n,p):.2%}')

Recorded output

Expected defects: 2.00
Count standard deviation: 1.40
Exactly two defects: 27.34%
More than three defects: 14.10%
Download all worked examples

Sources and further reading

Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.