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. It is defined by two parameters: n (number of trials) and p (probability of success on a single trial). The probability mass function (PMF) gives the probability of exactly k successes:
where C(n, k) is the binomial coefficient, also written as "n choose k".
PMF vs CDF
The PMF (probability mass function) gives the probability of a single exact value: P(X = k). The CDF (cumulative distribution function) gives the probability that the random variable is less than or equal to a value: P(X ≤ k). The CDF is the sum of PMF values from 0 to k:
Understanding the Inputs
- Number of trials (n): The total number of independent experiments. Must be a non-negative integer.
- Probability of success (p): The chance of success on a single trial. Must be between 0 and 1 inclusive.
- Number of successes (k): The threshold value for the cumulative probability. Must be an integer between 0 and n.
Probability Conditions Explained
- P(X ≤ k): Probability of at most k successes.
- P(X < k): Probability of fewer than k successes (same as P(X ≤ k−1)).
- P(X ≥ k): Probability of at least k successes (1 − P(X ≤ k−1)).
- P(X > k): Probability of more than k successes (1 − P(X ≤ k)).
- P(X = k): Probability of exactly k successes (the PMF).
Worked Example
Suppose you flip a fair coin 20 times (n = 20, p = 0.5). What is the probability of getting at most 10 heads?
n = 20, p = 0.5, k = 10
P(X ≤ 10) = Σx=010 C(20, x) · 0.520
= 0.520 · Σ C(20, x) for x = 0 to 10
= 0.520 · (1 + 20 + 190 + 1140 + 4845 + 15504 + 38760 + 77520 + 125970 + 167960 + 184756)
= 0.520 · 616666
= 0.5881 (approximately 58.81%)
Numerical Stability
For large n, directly computing factorials can overflow. This calculator uses logarithms and the natural log of the gamma function to compute binomial coefficients in a stable way. It also normalizes the probabilities to avoid underflow where possible.
Frequently Asked Questions
What is the binomial CDF? ▼
The binomial CDF gives the probability that the number of successes is less than or equal to a given value k. It is the cumulative sum of binomial PMF values.
What is the difference between PMF and CDF? ▼
PMF gives the probability of exactly k successes, while CDF gives the probability of k or fewer successes. CDF is the cumulative sum of PMF.
Can I use this calculator for large n? ▼
Yes, the calculator uses log-gamma functions for numerical stability. For very large n and extreme p, normal approximation may be needed, but our algorithm handles typical ranges well.
What does p represent? ▼
p is the probability of success on a single trial. It must be between 0 and 1.
How do I interpret P(X ≥ k)? ▼
P(X ≥ k) is the probability of getting at least k successes. It equals 1 − P(X ≤ k−1).
Can k be greater than n? ▼
No, k must be between 0 and n. If you enter k > n, the calculator will show an error.
Is the binomial distribution discrete or continuous? ▼
Discrete. The number of successes can only be an integer (0, 1, 2, ..., n).
Does this calculator handle p = 0 or p = 1? ▼
Yes. If p = 0, P(X = 0) = 1 and all other probabilities are 0. If p = 1, P(X = n) = 1 and all others are 0. The calculator handles these edge cases.