Geometric Distribution Calculator
The geometric distribution models which trial produces the first success in a sequence of independent trials with success probability p. This calculator uses the common textbook definition: X is the TOTAL NUMBER OF TRIALS carried out until the first success, so the support is 1, 2, 3, … and the successful trial itself is counted. Which roll of a die shows the first six, on which call a sales representative closes a first deal, and on which cycle a machine fails for the first time are all questions of this kind.
The calculator returns the exact probability P(X = k), the cumulative probability P(X ≤ k), the upper tail P(X > k) = (1 − p)^k, the probability of the interval [a, b] you choose, and the mean (1/p), variance ((1 − p)/p²), standard deviation, mode, and median together. The most striking feature of the geometric distribution is memorylessness: how many times you have already failed does not change the probabilities of the trials still to come.
Geometric Distribution Formulas (number-of-trials definition)
Mass function: P(X = k) = (1 − p)ᵏ⁻¹ · p, k = 1, 2, 3, … Cumulative: P(X ≤ k) = 1 − (1 − p)ᵏ Upper tail: P(X > k) = (1 − p)ᵏ At least k trials: P(X ≥ k) = (1 − p)ᵏ⁻¹ Interval: P(a ≤ X ≤ b) = (1 − p)ᵃ⁻¹ − (1 − p)ᵇ Mean: μ = 1 / p Variance: σ² = (1 − p) / p² Standard deviation: σ = √(1 − p) / p Mode: 1 (the highest probability is always on the first trial) Median: ⌈ln(0.5) / ln(1 − p)⌉ Memorylessness: P(X > m + n | X > m) = P(X > n)
Under the alternative definition, X is the number of failures before the first success (support 0, 1, 2, …) and the mean becomes (1 − p)/p. This calculator uses the number-of-trials definition; you move between the two with Y = X − 1, and the variance is (1 − p)/p² under both.
How to Calculate
- Enter the success probability of a single trial (p) between 0 and 1; write 0.2 for twenty percent.
- Enter the trial number (k) you want the first success to land on; the smallest value is 1.
- Set the interval bounds (a and b) if you wish; leaving the upper bound blank computes P(X ≥ a).
- Read the exact, cumulative, and upper-tail probabilities: P(X > k) is directly the probability that all of the first k trials fail.
- Assess the mean (1/p), the median, and the standard deviation together; because the distribution is right-skewed, the mean alone is not enough.
- In the mass chart, see how the probability falls off geometrically as k grows and how the tallest bar is always at k = 1.
Worked Examples
Success probability of 20%: first success on trial 5
With p = 0.2, the probability that the first success arrives exactly on trial 5 is P(X = 5) = 0.0819. The probability of a success within at most 5 trials is 0.6723, and the probability that all of the first 5 trials fail is (0.8)⁵ = 0.3277. On average 5 trials are needed, the standard deviation is 4.4721, the median is 4 trials, and P(3 ≤ X ≤ 8) = 0.4722.
First success exactly on trial 5 — P(X = 5): 0.0819 · At most 5 trials — P(X ≤ 5): 0.6723 · Fewer than 5 trials — P(X < 5): 0.5904
First six on a die: which roll brings it?
On a fair die the probability of rolling a six is p ≈ 0.1667. The probability that the first six appears exactly on the third roll is P(X = 3) = 0.1157. Since the probability of seeing no six in the first six rolls is 0.3349, the probability of at least one six in six rolls is P(1 ≤ X ≤ 6) = 0.6651. The expected number of rolls is 6 and the median is 4 rolls.
First success exactly on trial 3 — P(X = 3): 0.1157 · At most 3 trials — P(X ≤ 3): 0.4213 · Fewer than 3 trials — P(X < 3): 0.3056
High success probability: p = 0.6
With p = 0.6, the probability of succeeding on the first trial is P(X = 1) = 0.6000, which is also the mode of the distribution. The probability of a success within the first three trials is P(1 ≤ X ≤ 3) = 0.9360. The mean is 1.6667 trials, the standard deviation is 1.0541, and the median is 1 trial.
First success exactly on trial 1 — P(X = 1): 0.6000 · At most 1 trials — P(X ≤ 1): 0.6000 · Fewer than 1 trials — P(X < 1): 0