Binomial

X∼Bin⁡(n,p)X \sim \operatorname{Bin}(n, p)

The number of successes in n independent trials, each succeeding with the same probability p.

The story

Flip the same biased coin nn times and count the heads. Each flip is a Bernoulli(p)\text{Bernoulli}(p) trial, the flips do not influence one another, and the total can be anything from 0 to nn. The probability of exactly kk successes is (nk)pk(1−p)n−k\binom{n}{k} p^k (1 - p)^{n-k}: the chance of one particular arrangement, multiplied by the number of ways to arrange kk successes among nn slots.

On average you get npnp successes, with variance np(1−p)np(1 - p). When p=0.5p = 0.5 the distribution is perfectly symmetric; push pp towards 0 or 1 and it leans against the nearest wall. As nn grows the bars settle into a familiar bell shape, which is why the Normal approximation works so well for large nn.

Formulas

Support

k∈{0,1,…,n}k \in \{0, 1, \ldots, n\}

PMF

P(X=k)=(nk)pk(1−p)n−kP(X = k) = \binom{n}{k} p^k (1 - p)^{n-k}

CDF

F(k)=∑i=0k(ni)pi(1−p)n−iF(k) = \sum_{i=0}^{k} \binom{n}{i} p^i (1 - p)^{n-i}

Expectation

E[X]=np\mathbb{E}[X] = np

Variance

Var⁡(X)=np(1−p)\operatorname{Var}(X) = np(1 - p)

Mode

⌊(n+1)p⌋\lfloor (n + 1)p \rfloor

Parameters

ParameterWhat it controls
nnThe number of independent trials; XX can take any whole value from 0 to nn.
ppThe probability of success on each trial. It sets the centre (npnp) and, together with nn, the spread np(1−p)np(1 - p).

Where it shows up

  • The number of heads in 20 coin tosses.
  • How many of 50 surveyed people say they will vote for a given party.
  • The number of defective items in a batch of 30, if each is faulty independently with probability pp.
  • How many of nn emails in an A/B test are opened.

Try this

  1. Set n=50n = 50 and p=0.5p = 0.5, then slowly lower pp to 0.05. Watch the symmetric bell become a right-skewed pile squashed against zero.
  2. Compare n=50n = 50, p=0.06p = 0.06 with the Poisson page at λ=3\lambda = 3: the two sets of bars are almost identical, because np=3np = 3 in both.
  3. With n=50n = 50 and p=0.5p = 0.5, shade the interval from 22 to 28 (roughly the mean ±1σ\pm 1\sigma, since σ≈3.54\sigma \approx 3.54), then press Draw 1000 and check that about that share of the histogram falls inside it.

Related distributions

  • A Binomial with n=1n = 1 is the Bernoulli, and Binomial(n,p)\text{Binomial}(n, p) is the sum of nn independent Bernoulli(p)\text{Bernoulli}(p) variables.
  • The Poisson is the limit of the Binomial as n→∞n \to \infty and p→0p \to 0 with np=λnp = \lambda held fixed.
  • For large nn (a common rule of thumb is npnp and n(1−p)n(1 - p) both at least 10) it is well approximated by a Normal with mean npnp and variance np(1−p)np(1 - p).