MathsStatistics & Probability

Binomial Distribution
calculator.

Binomial probability gives the chance of a set number of successes in a fixed run of trials.

How it's worked out

A count is binomial when each trial has exactly two outcomes and the chance of success stays fixed across n trials. The trials must also not affect each other, and n must be set in advance. Defective parts in a batch, heads in a run of flips and free throws made all fit this.

P(X=k)\displaystyle P(X = k)=(nk)pk(1−p)n−k\displaystyle {}= \binom{n}{k} p^k (1 - p)^{n - k}
(nk)\displaystyle \binom{n}{k}=n!k!(n−k)!\displaystyle {}= \frac{n!}{k!\,(n - k)!}

Here n is the number of trials, k the number of successes and p the chance of success on one trial. The first part counts the ways to choose which k trials succeed. A question such as "at most 3" adds these terms, and the tool sums whichever side is shorter, so very small tails keep their digits. It works in logarithms of factorials, which lets it reach 100,000 trials.

mean\displaystyle \text{mean}=np\displaystyle {}= np
variance\displaystyle \text{variance}=np(1−p)\displaystyle {}= np(1 - p)

The most likely count is the whole part of (n+1)p(n + 1)p. When (n+1)p(n + 1)p is itself a whole number there are two, that number and the one below it.

Worked examples

Testing 18 water samples for a pollutant

Each sample has a 10% chance of containing the pollutant, and 18 are tested independently. You should expect 1.8 contaminated samples. The chance of exactly 2 is 0.2835, the chance of at least 4 is 0.0982, and the chance of 3 to 6 is 0.265.

Tails react strongly to p. If the true rate were 8% in place of 10%, the chance of at least 4 falls to 0.0506. At 12% it rises to 0.1618. So a rate you only roughly know gives a rough tail.

Open this example in the tool

The Chevalier de Méré's two dice bets

The story goes that de Méré did well betting on at least one six in four rolls of a die, then lost on at least one double six in 24 rolls of two dice. The first chance is 0.5177, which is above even. The second is 0.4914, which is just below it.

He took the problem to Pascal, who worked on it with Fermat. The second bet needs 25 rolls to pass even odds, and the tool's trials finder gives that directly. You can type a chance as a fraction, a decimal or a percentage.

Open this example in the tool

At most 2 defects in a batch of 100

A process makes 2% defects, and a batch has 100 parts. The chance of at most 2 defects is 0.6767. The normal curve gives 0.6024, so the shortcut is off by a visible amount, because np is only 2.

Compare 100 fair coin flips, where np is 50. The exact chance of 45 to 55 heads is 0.7287, and the normal curve gives 0.7287, the same to four places. Rare events are where the exact sum earns its keep.

Open this example in the tool

Reading your result

Match the words to the inequality. "At least 3" means 3 or more, "more than 3" means 4 or more, "at most 3" means 3 or fewer and "fewer than 3" means 2 or fewer. On a count these are different numbers, so pick the matching option and do not adjust k by hand. As a check, the chance of at least k is 1 minus the chance of at most k − 1.

Use the mean and standard deviation for a quick sense of scale. For 100 fair flips they are 50 and 5, so 45 to 55 heads is within about one standard deviation either way.

Trust the normal shortcut only when it fits. A common rule of thumb asks for both np and n(1 − p) to be at least 5, and closer to 10 is better. It needs a continuity correction of 0.5 at the edges. Outside that range, or far into a tail, use the exact value.

Spot when the model does not apply. Sampling without replacement changes p from draw to draw. A common rule is that the binomial is close enough when the sample is at most 5% of the population. Beyond that, use the hypergeometric distribution. Counts with no fixed number of trials, such as calls per hour, suit the Poisson distribution. NIST notes that Poisson also approximates the binomial well when n is at least 100 and np is at most 10.

Ten fair coin flips
HeadsP(X = k)P(X ≤ k)
00.0009770.000977
10.0097660.010742
20.0439450.054688
30.1171880.171875
40.2050780.376953
50.2460940.623047
60.2050780.828125
70.1171880.945313
80.0439450.989258
90.0097660.999023
100.0009771

Common mistakes

  • Multiplying instead of using the complement. The chance of at least one success is not n times p. Four rolls at one in six would then give two thirds, when the real figure is 0.52.
  • Mixing up "at least" and "more than". They differ by one whole count, and that count can hold much of the probability.
  • Using it when trials influence each other. Parts from one bad machine fail together. Real counts then spread wider than the formula predicts.
  • Using a p from a small sample as if it were exact. Any error in p carries through, and it grows in the tails.

Questions people ask

Find the chance of no successes and take it from 1. That chance is (1 − p) multiplied by itself n times. With a 10% chance per trial and 10 trials, that leaves 65.1% for at least one.

Sources