Binomial Distribution Calculator Graph: How It Works
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 calculator computes binomial probabilities and displays the corresponding probability mass function (PMF) graph. You enter the number of trials (n), the probability of success on each trial (p), and the number of successes (k) you want to evaluate; the calculator returns the exact probability P(X = k), the cumulative probability P(X ≤ k), and a bar chart of the distribution. The graph updates instantly as you change the inputs, making it easy to visualize how the shape of the distribution shifts with n and p.
Formula
The binomial probability formula gives the probability of getting exactly k successes in n independent trials, each with the same probability p of success:
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) – binomial coefficient, “n choose k�, equal to n! / (k! (n − k)!)
The cumulative probability P(X ≤ k) is the sum of P(X = i) for i = 0, 1, …, k. The mean of a binomial distribution is np and the standard deviation is √(np(1 − p)).
Worked Example
Using the default values from the calculator: n = 10 trials, p = 0.5, and k = 3 successes.
- Calculate 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 output. The cumulative probability P(X ≤ 3) = P(0) + P(1) + P(2) + P(3) = 0.00098 + 0.00977 + 0.04395 + 0.11719 = 0.1719. The mean is 10 × 0.5 = 5, and the standard deviation is √(10 × 0.5 × 0.5) = √2.5 ≈ 1.5811.
How the Graph Is Generated
The graph is a bar chart (or stem plot) where the x‑axis shows the possible number of successes (0, 1, 2, …, n) and the y‑axis shows the probability of each outcome. Each bar’s height equals P(X = k) for that k. The calculator draws all bars for k = 0 to n, even if you only ask for one specific k, so you can see the whole distribution. The shape changes in predictable ways:
- When p = 0.5, the distribution is symmetric around np.
- When p < 0.5, the distribution is skewed right (long tail toward higher k).
- When p > 0.5, the distribution is skewed left.
- As n increases, the distribution becomes more bell‑shaped and narrower relative to its mean.
The graph is a probability mass function (PMF) because the variable is discrete – only whole numbers of successes are possible. This is different from a continuous distribution like the normal curve.
When to Use the Binomial Distribution
The binomial distribution applies when all of these conditions hold:
- There are a fixed number of trials (n).
- Each trial has exactly two outcomes: success or failure.
- The probability of success (p) is the same for every trial.
- The trials are independent – the outcome of one trial does not affect another.
Real‑world examples include: counting the number of heads in 10 coin flips, the number of defective items in a batch of 50 from a production line with a known defect rate, or the number of patients who respond to a treatment out of 20, assuming each patient responds independently with the same probability.
If the trials are not independent (e.g., sampling without replacement from a small population), the hypergeometric distribution is more appropriate. If n is very large and p is very small, the Poisson distribution can be a good approximation.
How to Read the Results
The calculator gives you three key outputs:
- P(X = k) – the probability of exactly k successes. This is the height of the bar at k on the graph.
- P(X ≤ k) – the probability of k or fewer successes. This is the sum of the bar heights from 0 to k.
- Mean and standard deviation – these summarize the center and spread of the distribution. The mean is the long‑run average number of successes if you repeated the experiment many times.
For example, with n = 10 and p = 0.5, P(X = 3) = 0.1172 means that if you flip a fair coin 10 times, you have about an 11.7% chance of getting exactly 3 heads. P(X ≤ 3) = 0.1719 means about a 17.2% chance of getting 3 or fewer heads.
A common mistake is to confuse P(X = k) with P(X ≤ k). If a question asks “what is the probability of at most 3 successes?�, you need the cumulative probability, not the individual one.
Common Mistakes and Pitfalls
- Using the wrong p – p must be the probability of the event you are counting as a success. If you are counting failures instead, use 1 − p.
- Entering k > n – the calculator will give an error or zero because you cannot have more successes than trials. Always check that 0 ≤ k ≤ n.
- Forgetting independence – if trials are not independent (e.g., drawing cards without replacement), the binomial formula is not valid.
- Rounding too early – when computing cumulative probabilities, keep several decimal places in intermediate steps to avoid rounding errors.
- Misreading the graph – the graph shows individual probabilities, not cumulative ones. To see the cumulative probability, look at the number output, not the bar height.
Limits and Approximations
The binomial distribution is exact for discrete, independent trials. However, for very large n, calculating factorials directly can be computationally heavy, so the calculator uses efficient algorithms internally. For practical purposes, when n is large (say n > 50) and p is not too close to 0 or 1, the normal approximation to the binomial can be used: the distribution is approximately normal with mean np and standard deviation √(np(1−p)). A continuity correction (adjusting by 0.5) improves the approximation.
When n is large and p is small (typically n ≥ 20 and p ≤ 0.05), the Poisson distribution with λ = np provides a good approximation. The calculator does not apply these approximations automatically – it always computes the exact binomial probability – but you can use them for quick mental estimates.
Frequently Asked Questions
What does the graph show exactly?
The graph shows the probability of each possible number of successes (from 0 to n) as vertical bars. Each bar’s height is the exact probability P(X = k) for that k. It is a discrete distribution, so the bars are not connected by a smooth curve; the shape helps you see where the most likely outcomes are and how spread out the distribution is.
How do I find the probability of “at least� a certain number?
Use the complement rule: P(X ≥ k) = 1 − P(X ≤ k − 1). For example, with n = 10, p = 0.5, the probability of at least 3 successes is 1 − P(X ≤ 2) = 1 − 0.0547 = 0.9453. Many calculators have a “cumulative� option that can directly compute P(X ≥ k) if you select the right tail.
Can I use the binomial distribution for non‑integer p or n?
No. n must be a positive integer (the number of trials), and p must be between 0 and 1. If you enter a non‑integer n, the calculator will treat it as an integer by rounding or will show an error. The binomial distribution is defined only for whole numbers of trials.
Why does my graph look different from a normal curve?
The binomial is discrete, so the graph consists of separate bars, not a continuous curve. It looks like a normal curve only when n is large and p is around 0.5. For small n or extreme p, the distribution is skewed and the bars are clearly distinct. That is normal – the binomial is not a continuous distribution.
What is the difference between binomial and hypergeometric?
The binomial assumes independent trials with replacement (or effectively infinite population), so p stays constant. The hypergeometric applies when you sample without replacement from a finite population, so the probability changes after each draw. Use the hypergeometric when the population size is small relative to the sample and you do not replace items.
How do I choose the right n and p for my problem?
n is the number of trials or observations in your experiment – it is fixed by the situation. p is the probability of success on a single trial, which you must know or estimate from prior data or theory. For example, if you flip a fair coin, p = 0.5; if a machine produces defects at a 2% rate, p = 0.02. The calculator does not choose these – you must supply them based on your problem.
Related
Formula used
in n | Number of trials (n) | - | 10 | 0 in p | Probability of success (p) | - | 0.5 | 0 in k | Number of successes (k) | - | 3 | 0 out prob | P(X = k) | - | ncr(n,k) * p^k * (1-p)^(n-k) | 4 out cum | P(X ≤ k) | - | sum(ncr(n,i) * p^i * (1-p)^(n-i), i, 0, k) | 4 out mean | Mean (np) | - | n * p | 2 out sd | Standard deviation | - | sqrt(n * p * (1-p)) | 2
Each 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.