Binomial Distribution Calculator

Compute binomial probabilities, cumulative probabilities, and summary statistics for any Bin(n, p) distribution, with an interactive bar chart.

Binomial parameters

Positive integer, typically ≤ 1000.

Between 0 and 1 (inclusive).

Integer between 0 and n.

Results

Probability

P(X = 3) = 0.1172

11.72%

Summary statistics

Mean (μ)
5
Variance (σ²)
2.5
Std. dev. (σ)
1.5811
Mode
5

Distribution chart

PMF: P(X = k)

Bars are highlighted for the selected probability event (exact, tail, or interval).

What is the binomial distribution?

The binomial distribution models the number of successes in a fixed number of independent trials, where each trial has only two outcomes (success or failure) and the probability of success is the same on every trial.

We write this as \(X \sim \text{Bin}(n, p)\), where:

  • n = number of trials
  • p = probability of success on each trial
  • X = number of successes in those n trials

Binomial probability formula

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

where \( \binom{n}{k} = \dfrac{n!}{k!(n-k)!} \) is the binomial coefficient, \(k = 0, 1, \dots, n\).

Cumulative probabilities

The calculator also supports:

  • Left tail: \(P(X \le k) = \sum_{i=0}^{k} P(X=i)\)
  • Right tail: \(P(X \ge k) = \sum_{i=k}^{n} P(X=i)\)
  • Interval: \(P(k_1 \le X \le k_2) = \sum_{i=k_1}^{k_2} P(X=i)\)

Mean, variance, and standard deviation

Mean: \( \mu = E[X] = np \)

Variance: \( \sigma^2 = \text{Var}(X) = np(1-p) \)

Standard deviation: \( \sigma = \sqrt{np(1-p)} \)

When to use the binomial distribution

The binomial model is appropriate when all of the following hold:

  • There is a fixed number of trials \(n\).
  • Each trial has only two outcomes (success / failure).
  • Trials are independent.
  • The success probability \(p\) is constant across trials.

Typical examples:

  • Number of heads in 20 coin flips.
  • Number of defective items in a batch of 100, given a defect rate \(p\).
  • Number of customers who buy, out of 50 who see an ad.

Normal approximation to the binomial

For large \(n\), the binomial distribution becomes approximately normal with mean \(np\) and variance \(np(1-p)\). A common rule of thumb is:

  • \(np \ge 5\) and \(n(1-p) \ge 5\).

In that case, you can approximate \(X \sim \text{Bin}(n,p)\) by \(X \approx \mathcal{N}(np, np(1-p))\), often with a continuity correction.

Worked example

Suppose you flip a fair coin \(n = 10\) times (\(p = 0.5\)). What is the probability of getting exactly \(k = 3\) heads?

  1. Compute the binomial coefficient: \(\binom{10}{3} = 120\).
  2. Compute \(p^k = 0.5^3 = 0.125\).
  3. Compute \((1-p)^{n-k} = 0.5^{7} = 0.0078125\).
  4. Multiply: \(P(X=3) = 120 \times 0.125 \times 0.0078125 \approx 0.1172\).

The calculator reproduces this result and shows it as both a decimal and a percentage, with the bar for \(k = 3\) highlighted in the chart.

FAQ

What is the difference between PMF and CDF?

The probability mass function (PMF) gives \(P(X = k)\) for each integer \(k\). The cumulative distribution function (CDF) gives \(P(X \le k)\), the probability that \(X\) is less than or equal to \(k\).

Can n be very large?

Mathematically, yes, but exact computation can overflow for very large \(n\). This calculator uses a numerically stable log-space algorithm and supports up to \(n = 1000\) for practical reliability in the browser.