Binomial Distribution Function Calculator
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This binomial distribution calculator computes the probability of getting exactly k successes in n independent trials, where each trial has the same probability p of success. You enter the number of trials (n), the number of successes (k), and the success probability per trial (p), and the calculator returns the exact probability P(X = k), plus the cumulative probability P(X ≤ k) and the mean and standard deviation of the distribution.
Formula
The binomial probability mass function is:
P(X = k) = C(n, k) · pk · (1 − p)n − k
Where:
- n = number of trials (a positive integer)
- k = number of successes (an integer from 0 to n)
- p = probability of success on a single trial (a number between 0 and 1)
- C(n, k) = the binomial coefficient, equal to n! / (k! · (n − k)!)
The cumulative probability P(X ≤ k) is the sum of P(X = i) for i = 0 to k. The mean is np and the variance is np(1−p); the standard deviation is the square root of the variance.
Worked Example
Using the default values from the calculator: n = 10 trials, k = 3 successes, p = 0.5.
- Compute the binomial coefficient: C(10, 3) = 10! / (3! · 7!) = 120.
- Compute pk = 0.53 = 0.125.
- Compute (1 − p)n−k = 0.57 = 0.0078125.
- Multiply: 120 × 0.125 × 0.0078125 = 0.1171875.
So P(X = 3) = 0.1172 (rounded to 4 decimal places), which matches the calculator’s first output. The cumulative probability P(X ≤ 3) is the sum of P(X=0) through P(X=3), which equals 0.1719. The mean is 10 × 0.5 = 5, and the standard deviation is sqrt(10 × 0.5 × 0.5) = sqrt(2.5) ≈ 1.58.
When to Use the Binomial Distribution
The binomial distribution applies when you have a fixed number of independent trials, each with only two possible outcomes (success or failure), and the probability of success is the same for every trial. Common examples include:
- Flipping a coin 10 times and counting how many heads appear.
- Checking a random sample of 20 products from a production line, where each has a 2% defect rate, and counting the number of defective items.
- Surveying 100 voters and counting how many support a particular candidate, if each has a 55% chance of support.
If any of these conditions are violated—for instance, trials are not independent (like drawing without replacement from a small population) or the probability changes—the binomial model may not be appropriate. In those cases, the hypergeometric distribution or another model might be better.
How to Read the Results
The main output, P(X = k), is the probability of getting exactly k successes. For example, with n = 10 and p = 0.5, the probability of exactly 3 heads is about 11.7%. The cumulative probability P(X ≤ k) is the probability of getting k or fewer successes. In the same example, P(X ≤ 3) ≈ 17.2%, meaning there is about a 17% chance of getting 3 or fewer heads.
The mean (np) tells you the average number of successes you would expect over many repetitions of the experiment. The standard deviation gives a measure of how much the number of successes typically varies from the mean. For n = 10 and p = 0.5, the mean is 5 heads, and the standard deviation is about 1.58, so most results will fall between about 3.4 and 6.6 heads.
Common Mistakes and Misconceptions
- Using the wrong p: p must be the probability of success, not the probability of failure. If you want the probability of 3 failures, you would set p to the failure probability.
- Forgetting that k must be between 0 and n: The calculator will give an error or a zero probability if k is outside this range.
- Confusing “exactly� with “at least� or “at most�: The calculator gives P(X = k) and P(X ≤ k). To get P(X ≥ k), you would compute 1 − P(X ≤ k−1).
- Using the binomial for non-independent trials: If you sample without replacement from a small population, the trials are not independent; use the hypergeometric distribution instead.
- Rounding too early: In manual calculations, rounding intermediate steps can change the final result. Keep several decimal places until the end.
Limitations of the Binomial Distribution
The binomial distribution assumes a fixed number of trials. If you are counting the number of trials until a certain number of successes occurs, you would use the negative binomial distribution. If the number of trials is very large and p is very small, the Poisson distribution can be a good approximation. For large n with p not too close to 0 or 1, the normal distribution can approximate the binomial, but the exact binomial is always preferable when you can compute it.
The calculator uses the exact formula, so it is accurate for any n as long as the assumptions hold. However, for extremely large n (thousands or more), the binomial coefficient may become very large, and the calculator might have numerical limitations. In such cases, using a normal approximation is often sufficient.
Frequently Asked Questions
What is the difference between binomial and Bernoulli distribution?
A Bernoulli distribution is a single trial with two outcomes. The binomial distribution is the sum of n independent Bernoulli trials. So the binomial with n = 1 is exactly a Bernoulli distribution.
How do I calculate the probability of at least 3 successes?
To get P(X ≥ 3), you can compute 1 − P(X ≤ 2). Using the calculator, enter n and p, and then add the probabilities for k = 0, 1, and 2, or use the cumulative output to get P(X ≤ 2) and subtract from 1.
Can I use the binomial distribution for percentages?
Yes, as long as you convert the percentage to a decimal for p. For example, a 30% success rate means p = 0.30. The result will be a probability, which you can multiply by 100 to get a percentage.
What if p is greater than 1 or less than 0?
The calculator will return an error because p must be between 0 and 1 inclusive. If you enter p = 1.2, that is not a valid probability.
Why is my result so small for large n?
For large n, the probability of any single exact k becomes very small because the total probability is spread over many possible outcomes. For example, with n = 100 and p = 0.5, the probability of exactly 50 successes is about 0.08, but the probability of exactly 47 is only about 0.03. This is normal.
Is the binomial distribution symmetric?
The binomial distribution is symmetric only when p = 0.5. When p is not 0.5, the distribution is skewed. For instance, with p = 0.2, the distribution is skewed to the right, with a longer tail on the higher-success side.
Related
Formula used
in n | Number of trials (n) | - | 10 | 1
in k | Number of successes (k) | - | 3 | 0
in p | Success probability (p) | - | 0.5 | 0
out prob | P(X = k) | - | ncr(n,k) * p^k * (1-p)^(n-k) | 4
out cum | P(X ≤ k) | - | sum_{i=0}^{k} ncr(n,i) * p^i * (1-p)^(n-i) | 4
out mean | Mean (np) | - | n*p | 2
out sd | Standard deviation | - | sqrt(n*p*(1-p)) | 2Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.