ThisCalculator

Statistics

Binomial Distribution Calculator Plot

Updated · Standard formula, shown below

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.

Binomial Distribution Calculator Plot

This calculator computes the probability of exactly k successes in n independent trials, each with success probability p, and plots the probability mass function. You enter the number of trials (n), the success probability (p), and the number of successes (k) you want to evaluate; the calculator returns P(X = k), the cumulative probability P(X ≤ k), and a bar chart of the distribution. The plot updates automatically as you adjust the inputs, giving you a visual sense of how the distribution shape changes with n and p.

Formula

The binomial probability mass function (PMF) gives the probability of getting exactly k successes in n independent Bernoulli trials, each with success probability p:

P(X = k) = C(n, k) · pk · (1 − p)n − k

Where:

  • n – number of trials (a positive integer)
  • k – number of successes (integer from 0 to n)
  • p – probability of success on a single trial (0 ≤ p ≤ 1)
  • C(n, k) – binomial coefficient, the number of ways to choose k successes from n trials, calculated as n! / (k! · (n − k)!)

The cumulative distribution function (CDF) is the sum of PMF values from 0 up to k:

P(X ≤ k) = Σi=0k C(n, i) · pi · (1 − p)n − i

The mean and standard deviation of a binomial distribution are:

  • Mean μ = n·p
  • Standard deviation σ = √(n·p·(1−p))

Worked Example

Using the default values: n = 10, p = 0.5, k = 5.

Step 1: Compute the binomial coefficient C(10, 5) = 10! / (5! · 5!) = 252.

Step 2: Compute pk = 0.55 = 0.03125.

Step 3: Compute (1−p)n−k = 0.55 = 0.03125.

Step 4: Multiply: 252 × 0.03125 × 0.03125 = 0.24609375, which rounds to 0.2461.

The calculator shows P(X = 5) = 0.2461, matching the formula. The cumulative probability P(X ≤ 5) is the sum of P(X = 0) through P(X = 5), which equals 0.6230. The mean is 10 × 0.5 = 5.0, and the standard deviation is √(10 × 0.5 × 0.5) = √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 two possible outcomes (success/failure), and the probability of success is constant across trials. Common real-world examples include:

  • Flipping a coin 20 times and counting heads (p = 0.5)
  • Testing 30 light bulbs from a batch where each has a 2% chance of being defective
  • Surveying 100 people, each with a 60% chance of preferring a certain brand

If any of these conditions are violated—for instance, if trials are not independent or p changes—the binomial model may not be appropriate. In that case, consider the hypergeometric distribution (sampling without replacement) or the Poisson distribution (for rare events over a continuous interval).

How to Read the Plot

The plot displays the probability of each possible number of successes (0 to n) as vertical bars. The height of each bar is the PMF value. The peak of the distribution occurs near the mean np. As n increases, the distribution becomes more symmetric and approaches a normal curve, especially when np ≥ 5 and n(1−p) ≥ 5. If p is close to 0 or 1, the distribution is skewed. The cumulative probability P(X ≤ k) is the sum of the heights of all bars up to and including k.

Common Mistakes and Misconceptions

A frequent error is confusing the probability of exactly k successes with the probability of at least k successes. The calculator gives both P(X = k) and P(X ≤ k); to get P(X ≥ k), you can compute 1 − P(X ≤ k−1). Another common mistake is using the binomial distribution when trials are not independent—for example, drawing cards without replacement from a deck. That situation calls for the hypergeometric distribution. Also, ensure that p is entered as a decimal (0.2) not as a percentage (20). Finally, rounding too early in manual calculations can change the final probability noticeably; keep several decimal places until the end.

Limitations of the Binomial Model

The binomial distribution assumes a fixed number of trials, independence, and constant p. In practice, these assumptions may not hold exactly. For instance, if you are sampling from a finite population without replacement, the hypergeometric distribution is more accurate. Also, if n is very large (say, over 1,000) and p is very small, the Poisson distribution with λ = np provides a good approximation and is easier to compute. The binomial distribution is discrete, so probabilities are only defined for integer k; the plot shows bars, not a smooth curve. For large n, the normal approximation can be used, but the binomial itself remains exact.

Frequently Asked Questions

What is the difference between binomial and normal distribution?

The binomial distribution is discrete and counts successes in a fixed number of trials. The normal distribution is continuous and symmetric. For large n, the binomial distribution can be approximated by a normal distribution with mean np and variance np(1−p), but the approximation is only good when np and n(1−p) are both at least 5.

How do I calculate cumulative probability P(X ≤ k) on this calculator?

Enter your n and p, then set k to the desired cutoff. The calculator outputs P(X ≤ k) directly. For example, with n=10, p=0.5, k=5, the cumulative probability is 0.6230, meaning there is a 62.3% chance of getting 5 or fewer heads.

Can I use the binomial distribution for percentages?

Yes, if the percentage represents a probability of success per trial. For example, if a manufacturing process produces 3% defective items, then p = 0.03. Enter 0.03 in the probability field. Do not enter 3 as the probability; the calculator expects a decimal between 0 and 1.

What if k is greater than n?

If k > n, the probability is 0 because you cannot have more successes than trials. The calculator will return 0 for both PMF and CDF (since P(X ≤ k) equals 1 when k ≥ n, but the PMF is 0). In practice, you should keep k between 0 and n.

Why is the plot not symmetric?

The binomial distribution is symmetric only when p = 0.5. If p is less than 0.5, the distribution is skewed to the right (more mass on lower k values). If p is greater than 0.5, it is skewed to the left. The skewness decreases as n increases.

How do I find the probability of at least k successes?

Use the complement rule: P(X ≥ k) = 1 − P(X ≤ k−1). For example, with n=10, p=0.5, to find P(X ≥ 6), compute 1 − P(X ≤ 5) = 1 − 0.6230 = 0.3770.

Related

Formula used
in n | Number of trials (n) | trials | 10 | 1
in p | Success probability (p) | - | 0.5 | 0
in k | Number of successes (k) | successes | 5 | 0
out pmf | P(X = k) | - | ncr(n,k) * p^k * (1-p)^(n-k) | 4
out cdf | 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)) | 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.