Geometric Distribution Calculator
Find the probability that the first success comes on a given trial, by a given trial, or after one — counting either trials up to the first success or failures before it, as your textbook or R does. The calculator shows the formula, the mean and variance, the matching R call, a probability table and a bar chart. Free, no sign-up.
Adds the probability of a value from k up to this number.
Results
| Probability | Meaning | Value |
|---|---|---|
| P(X = 5) | first success on trial 5 | 0.0819 |
| P(X ≤ 5) | first success on trial 5 or earlier | 0.6723 |
| P(X < 5) | first success before trial 5 | 0.5904 |
| P(X ≥ 5) | first success on trial 5 or later | 0.4096 |
| P(X > 5) | first success after trial 5 | 0.3277 |
5
Mean (1/p)
20
Variance ((1 − p)/p²)
4.4721
Standard deviation
4
Median
How this was calculated
P(X = k) = (1 − p)^(k − 1) × p = (1 − 0.2)^(5 − 1) × 0.2 = 0.0819
P(X ≤ k) = 1 − (1 − p)^k = 1 − (1 − 0.2)^5 = 0.6723
In R: dgeom(4, 0.2) = 0.0819 and pgeom(4, 0.2) = 0.6723. R counts failures before the first success, so a first success on trial 5 is 4 failures.
Counting failures instead (Y = X − 1), the mean is 4 and the variance is the same, 20. P(X = 5) equals P(Y = 4).
Probability distribution
| k | P(X = k) | P(X ≤ k) | P(X ≥ k) |
|---|---|---|---|
| 1 | 0.2000 | 0.2000 | 1.0000 |
| 2 | 0.1600 | 0.3600 | 0.8000 |
| 3 | 0.1280 | 0.4880 | 0.6400 |
| 4 | 0.1024 | 0.5904 | 0.5120 |
| 5 | 0.0819 | 0.6723 | 0.4096 |
| 6 | 0.0655 | 0.7379 | 0.3277 |
| 7 | 0.0524 | 0.7903 | 0.2621 |
| 8 | 0.0419 | 0.8322 | 0.2097 |
| 9 | 0.0336 | 0.8658 | 0.1678 |
| 10 | 0.0268 | 0.8926 | 0.1342 |
| 11 | 0.0215 | 0.9141 | 0.1074 |
| 12 | 0.0172 | 0.9313 | 0.0859 |
| 13 | 0.0137 | 0.9450 | 0.0687 |
| 14 | 0.0110 | 0.9560 | 0.0550 |
| 15 | 0.0088 | 0.9648 | 0.0440 |
| 16 | 0.0070 | 0.9719 | 0.0352 |
| 17 | 0.0056 | 0.9775 | 0.0281 |
| 18 | 0.0045 | 0.9820 | 0.0225 |
| 19 | 0.0036 | 0.9856 | 0.0180 |
| 20 | 0.0029 | 0.9885 | 0.0144 |
| 21 | 0.0023 | 0.9908 | 0.0115 |
| 22 | 0.0018 | 0.9926 | 0.0092 |
| 23 | 0.0015 | 0.9941 | 0.0074 |
| 24 | 0.0012 | 0.9953 | 0.0059 |
| 25 | 0.0009 | 0.9962 | 0.0047 |
| 26 | 0.0008 | 0.9970 | 0.0038 |
| 27 | 0.0006 | 0.9976 | 0.0030 |
| 28 | 0.0005 | 0.9981 | 0.0024 |
| 29 | 0.0004 | 0.9985 | 0.0019 |
| 30 | 0.0003 | 0.9988 | 0.0015 |
| 31 | 0.0002 | 0.9990 | 0.0012 |
| 32 | 0.0002 | 0.9992 | 0.0010 |
| 33 | 0.0002 | 0.9994 | 0.0008 |
| 34 | 0.0001 | 0.9995 | 0.0006 |
How to Use the Geometric Distribution Calculator
- 1. Choose what you count. Trials up to and including the first success (X = 1, 2, 3, …) or failures before the first success (Y = 0, 1, 2, …). Introductory courses most often use the first; R, and some statistics books, use the second.
- 2. Enter p. The probability of success on each independent trial, such as 0.2 for a one-in-five chance.
- 3. Enter k. The trial on which you want the first success (or the number of failures), and optionally an upper end for a range.
- 4. Read the results. Equal, at most, fewer than, at least and more than, with the formula filled in, the mean, variance and median, the equivalent R call, and a table and bar chart.
Two Definitions of the Geometric Distribution
The geometric distribution describes repeating independent trials, each with the same success probability p, until the first success. Textbooks count the outcome in two different ways, and the two give different formulas, different means and different software calls for the very same experiment.
| Property | Trials: X | Failures: Y |
|---|---|---|
| What it counts | Trials up to and including the first success | Failures before the first success |
| Possible values | 1, 2, 3, … | 0, 1, 2, … |
| Probability of a value k | (1 − p)k−1 p | (1 − p)k p |
| P(≤ k) | 1 − (1 − p)k | 1 − (1 − p)k+1 |
| P(≥ k) | (1 − p)k−1 | (1 − p)k |
| Mean | 1/p | (1 − p)/p |
| Variance | (1 − p)/p² | (1 − p)/p² |
| Software | SciPy's geom | R's dgeom, pgeom, qgeom |
To move between them, remember X = Y + 1. A first success on trial 5 is 4 failures, so P(X = 5) = P(Y = 4) and the mean differs by exactly 1; the variance is identical. The calculator prints this conversion with your numbers, including the R function call that gives the same probability: R's dgeom(4, 0.2) answers "first success on trial 5".
Worked Example: Sales Calls
A caller closes a sale on 20% of calls, independently, so p = 0.2. Counting trials, the chance that the first sale comes on the fifth call is 0.8⁴ × 0.2 = 0.0819. The chance it comes by the fifth call is 1 − 0.8⁵ = 0.6723, on the fifth or later 0.8⁴ = 0.4096, and after the fifth 0.8⁵ = 0.3277.
The mean is 1/p = 5 calls and the variance is 0.8 / 0.2² = 20, so the standard deviation is 4.4721 — large relative to the mean, which is typical: waiting times for rare successes vary a lot. The median is 4: half of all callers close their first sale within four calls. Counting failures instead, the mean is 4, and R's dgeom(4, 0.2) returns the same 0.0819.
A memoryless distribution
After five failures in a row, the chance of success on the next trial is still p. The geometric is the discrete memoryless distribution, the counterpart of the continuous exponential distribution: past failures do not make success "due", which is the point the gambler's fallacy misses.
Frequently Asked Questions
- Which definition of the geometric distribution should I use?
- Use the one your textbook, instructor or software uses. If trials are counted, X starts at 1 and the mean is 1/p; if failures are counted, Y starts at 0 and the mean is (1 − p)/p. An exam answer in the wrong convention is wrong by one, so check which one the question defines.
- How do I find the probability that the first success is on trial k?
- Multiply k − 1 failures and one success: (1 − p)k−1 × p. With p = 0.2 and k = 5 that is 0.8⁴ × 0.2 = 0.0819. The probability of a success by trial k is the complement of k straight failures, 1 − (1 − p)k.
- How do I use R's dgeom for the number of trials?
- R's dgeom(x, prob) counts failures before the first success, so subtract 1 from the trial number: the probability that the first success is on trial 5 is dgeom(4, 0.2) = 0.0819, and pgeom(4, 0.2) = 0.6723 is the probability it comes by trial 5. The calculator shows these calls for your inputs.
- What is the expected number of trials until the first success?
- 1/p when counting trials. If each attempt succeeds with probability 0.2, you expect 5 attempts on average. Counting failures the mean is (1 − p)/p = 4, one fewer, because the successful trial itself is not counted.
- How is the geometric distribution related to the binomial and negative binomial?
- The binomial fixes the number of trials and counts successes. The geometric fixes the number of successes at one and counts trials. The negative binomial generalises it to the r-th success, and the geometric is its special case r = 1.
- Does the geometric distribution assume independent trials?
- Yes, and a constant p. Drawing cards without replacement, or a player who improves with practice, breaks the assumptions. Sampling without replacement from a small population calls for the hypergeometric distribution instead.