Calculator

Binomial Distribution Calculator

Calculate point probability, cumulative probability and quantiles for binomial trials with parameters n and p.

Settings

Calculator focused on this distribution.

Result and visualization

Calculate PDF/PMF, CDF and percentiles instantly.

Result pending…

Explanation

The binomial distribution describes how many successes occur in a fixed number \( n \) of independent yes/no trials, where each trial has the same probability of success \( p \). The count \( X \) can only take integer values between 0 and \( n \). Its mean is \( np \) and its variance \( np(1-p) \); when \( np \geq 5 \) and \( n(1-p) \geq 5 \), the binomial distribution is well approximated by the normal with those same parameters. For large \( n \) and very small \( p \) (such that \( np \) is moderate), it approaches a Poisson with \( \lambda = np \).

Use it when the number of trials is fixed in advance, the trials are independent, each has only two possible outcomes, and the probability of success is the same across all of them. Typical examples: defective units in a quality control sample, conversions in a marketing campaign, patients responding to a treatment in a clinical trial, or coin flips. If the trials are not independent (sampling without replacement from a small population), use the hypergeometric distribution instead.

Formula

\( P(X=k)=\binom{n}{k}p^k(1-p)^{n-k} \)

Parameters

  • n: total number of trials.
  • p: probability of success on each trial.
  • k: number of observed successes.

Worked example

Situation: On a manufacturing line, each part has a probability of \(p = 0.3\) of having a minor defect. A batch of \(n = 20\) parts is inspected independently. Let \(X\) be the number of defective parts in the batch.

Question 1: What is the probability that exactly 4 parts are defective, \(P(X = 4)\)?

Solution: We apply the binomial probability mass function: \[ P(X = 4) = \binom{20}{4}(0.3)^4(0.7)^{16} \] Computing each factor: \(\binom{20}{4} = 4845\), \((0.3)^4 = 0.0081\), \((0.7)^{16} \approx 0.003323\): \[ P(X = 4) = 4845 \times 0.0081 \times 0.003323 \approx 0.1304 \] There is approximately a 13.04% probability of finding exactly 4 defective parts.

Question 2: What is the probability of finding 6 or fewer defective parts, \(P(X \leq 6)\)?

Solution: We sum the individual probabilities \(P(X = 0) + P(X = 1) + \cdots + P(X = 6)\). The binomial CDF with \(n = 20\), \(p = 0.3\) at \(k = 6\) gives: \[ P(X \leq 6) \approx 0.6080 \] There is a 60.80% probability that the batch has at most 6 defective parts.

Interpretation: The expected number of defects is \(np = 20 \times 0.3 = 6\) parts. That \(P(X \leq 6) \approx 0.608\) confirms that the mean value falls close to the 60th percentile, as is typical of a binomial with these parameters. If the batch rejection criterion were more than 6 defects, there would be approximately a 39% probability of rejecting the batch.

How to interpret the result

The calculator returns three types of output. The PMF mass function, \( P(X = k) \), gives the exact probability of obtaining exactly \( k \) successes in the \( n \) trials. For example, if \( P(X = 3) = 0.18 \), it means that 18% of the time you would expect exactly 3 successes under that model. In the chart, each vertical bar represents the probability of a specific value; the highlighted bar corresponds to the selected \( k \).

The CDF, \( P(X \leq k) \), accumulates all probabilities from 0 through \( k \) inclusive. If \( P(X \leq 4) = 0.82 \), it means that 82% of experiments of \( n \) trials produce 4 or fewer successes. The right tail \( P(X > k) = 1 - P(X \leq k) \) measures how unusual it is to obtain more than \( k \) successes. The green area in the chart visualizes the cumulative probability for the selected range; the horizontal axis shows the possible counts from 0 to \( n \).

The percentile or quantile result returns the smallest integer \( k \) such that \( P(X \leq k) \geq p \). If the 90th percentile is \( k = 7 \), there is at least a 90% probability of obtaining 7 or fewer successes. This is useful for setting acceptance thresholds in quality sampling, critical levels in statistical tests, or conversion targets in marketing.

Frequently asked questions

  • When should I use the binomial distribution? When you count the number of successes in n independent trials that share the same success probability p: defective items in a batch, clicks out of n impressions, correct answers on a test.
  • What is the difference between P(X = k) and P(X ≤ k)? P(X = k) is the probability of exactly k successes, while P(X ≤ k) adds up the probabilities of 0, 1, …, k successes. Questions phrased as “at most” or “at least” always require the cumulative version.
  • When can I approximate the binomial with the normal? As a rule of thumb, when np ≥ 5 and n(1 − p) ≥ 5 (some textbooks require 10). The approximation improves with the continuity correction, although this calculator gives you the exact value with no need to approximate.

Reference: Binomial distribution — Wikipedia