Geometric Distribution Calculator: 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 geometric distribution calculator computes the probability of achieving the first success on a given trial, along with the expected number of trials and the variance. You enter the success probability p for a single trial and the trial number k at which you want the first success; the calculator returns the exact probability P(X = k), the cumulative probability P(X ≤ k), the mean, and the variance. It uses the standard geometric distribution formula, so you can verify every result by hand.
Formula
The geometric distribution models the number of independent Bernoulli trials needed to get the first success. If each trial has success probability p (with 0 < p ≤ 1), the probability that the first success occurs on trial k is:
P(X = k) = (1 − p)k−1 · p
- p = probability of success on one trial (unitless, 0 to 1)
- k = trial number of the first success (positive integer, k ≥ 1)
- (1 − p) = probability of failure on one trial
The cumulative probability that the first success occurs by trial k is the sum of P(X = 1) through P(X = k), which simplifies to:
P(X ≤ k) = 1 − (1 − p)k
The mean (expected number of trials) is 1/p, and the variance is (1 − p)/p². These formulas assume each trial is independent and has the same probability of success.
Worked Example
Suppose you roll a fair six-sided die and want to know the probability that the first 6 appears on the 5th roll. Here p = 1/6 ≈ 0.1667, and k = 5.
- Calculate the failure probability: 1 − p = 1 − 0.1667 = 0.8333.
- Raise it to the power (k−1): 0.8333� = 0.4823.
- Multiply by p: 0.4823 × 0.1667 = 0.0804.
- So P(X = 5) ≈ 0.0804, or about 8.04%.
- Cumulative: 1 − (0.8333)� = 1 − 0.4019 = 0.5981, about 59.81%.
- Mean = 1/0.1667 = 6.00 rolls; variance = 0.8333 / (0.1667²) = 30.00.
The calculator with p = 0.2 and k = 5 gives P(X = 5) = 0.08192, mean = 5.00, variance = 20.00. For the die example, enter p = 0.1667 and k = 5 to get the same results as above.
When to Use the Geometric Distribution
Use the geometric distribution when you are counting the number of trials until the first success, and each trial is independent with the same success probability. Common real-world situations include:
- Number of coin flips until you get heads
- Number of free throws until you make one (if each shot has the same probability)
- Number of product inspections until you find a defective item
- Number of phone calls until you reach a live agent
The geometric distribution is memoryless: the probability of success on the next trial is always p, regardless of how many failures have already occurred. That means past failures do not make a success “more likely� on the next trial.
How to Choose the Right Parameters
To use the calculator correctly, you need to define what counts as a “success� and what a “trial� is. Then set p equal to the probability of that success on a single trial. For example:
- If you are drawing a card from a full deck and want a heart, p = 13/52 = 0.25.
- If a machine produces a defective part with probability 0.02, then p = 0.02.
- If you are shooting a basketball with a 70% free-throw percentage, p = 0.70.
The trial number k must be a positive integer (1, 2, 3, …). The probability p must be between 0 and 1, but not exactly 0 (otherwise you’ll never get a success). If p = 1, the first trial is always a success, so P(X = 1) = 1 and the distribution is trivial.
Common Mistakes and Misconceptions
One common mistake is confusing the geometric distribution with the negative binomial distribution. The geometric counts trials until the first success; the negative binomial counts trials until a fixed number of successes (e.g., the 3rd success). They are related but not the same.
Another mistake is using the formula for the “number of failures before the first success� instead of the “number of trials.� Some textbooks define the geometric distribution as the number of failures before the first success, in which case the probability is (1−p)k·p and the mean is (1−p)/p. This calculator uses the trial-count definition (k ≥ 1), so check which convention your course or software uses.
A third issue is rounding p too aggressively. If p = 1/6, using 0.17 instead of 0.1667 will change the result noticeably when k is large. Enter as many decimal places as you have.
Limits and Assumptions of the Formula
The geometric distribution assumes:
- Each trial has exactly two outcomes: success or failure.
- The probability of success p is constant across all trials.
- Trials are independent; the outcome of one trial does not affect another.
If these assumptions are violated, the geometric distribution may not be appropriate. For example, if you draw cards without replacement from a deck, the probability of drawing a heart changes after each draw, so the trials are not independent; the hypergeometric distribution would be more suitable. Similarly, if a process has a learning curve (success probability increases over time), the geometric model understates the chance of early success.
The formula also assumes an infinite number of potential trials. In practice, if there is a maximum number of trials (e.g., you only have 10 attempts), you would need to truncate the distribution and adjust the probabilities accordingly.
Frequently Asked Questions
What is the difference between geometric and binomial distribution?
The binomial distribution counts the number of successes in a fixed number of trials (e.g., 3 heads in 10 flips). The geometric distribution counts the number of trials needed to get the first success (e.g., the flip on which you first get heads). Both assume independent trials with constant probability p, but they answer different questions.
Can I use the geometric distribution for continuous data?
No. The geometric distribution is discrete and applies only to counts of trials (positive integers). For continuous waiting times (e.g., time until a radioactive decay), the exponential distribution is the continuous analogue.
What does the mean of 1/p mean in practice?
If p = 0.2, the mean is 1/0.2 = 5 trials. That does not mean the first success always happens on trial 5; it means that if you repeat the experiment many times, the average trial number of the first success will be about 5. The actual first success could occur on trial 1 or trial 20.
Why is the cumulative probability formula 1 − (1−p)^k?
The probability that the first success has not occurred by trial k is the probability that all first k trials are failures, which is (1−p)^k. Therefore, the probability that it has occurred by trial k is 1 minus that failure probability.
What if my probability p is given as a percentage, like 25%?
Convert the percentage to a decimal by dividing by 100. So 25% becomes 0.25. Enter 0.25 in the calculator. The calculator expects p as a number between 0 and 1, not a percentage.
Can the geometric distribution be used for sports streaks?
Yes, if you define a “success� as, say, winning a game, and each game is independent with the same win probability. Then the geometric distribution gives the probability that the first win occurs on a specific game number. However, in real sports, win probabilities often change due to home advantage, injuries, or opponent strength, so the independence assumption may not hold.
Related
Formula used
in p | Success probability per trial | - | 0.2 | 0 in k | Trial number of first success | - | 5 | 1 out prob | P(X = k) | - | (1-p)^(k-1)*p | 6 out cum | P(X ≤ k) | - | 1-(1-p)^k | 6 out mean | Expected trials | - | 1/p | 2 out var | Variance | - | (1-p)/p^2 | 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.