Math calculator

Geometric Distribution Calculator

Waiting for the first success — and why the failures behind you do not count.

Waiting for the first success

k counts TRIALS including the successful one. The failures-before-success convention is one lower, and both are shown below.

p = 0.2000, k = 5

0.081920

P(exactly 5). On average the first success arrives on trial 5.000, which is 4.000 failures first.

1/p1.0015.0

Probability

0.081920

exactly 5

Mean trials

5.0000

1 ÷ p

Mean failures first

4.0000

(1−p) ÷ p — the other convention

Standard deviation

4.4721

sqrt((1−p)/p²)

You have already failed this many times

Does that change how much longer you have to wait? Compute it both ways.

The chance of waiting at least 5 more trials, computed two ways.
QuestionProbability
Given 10 failures already, at least 5 more0.32768000
Starting fresh, at least 50.32768000

Identical, to the last digit. Those 10 failures bought you nothing — the process has no memory of them, and you are not "due". This is the gambler's fallacy written as arithmetic.

What this tool shows

The panel at the bottom computes your remaining wait two ways — given the failures you have already had, and starting fresh. They come out identical to the last digit. That is memorylessness, and it is the gambler’s fallacy written as arithmetic.

  • Exactly k, at most k, at least k trials
  • Both conventions: trials, and failures before success
  • A live memorylessness demonstration
  • The distribution drawn, with outcomes shaded
  • Mean and standard deviation for both conventions
  • Where the distribution genuinely applies
Memorylessness shown Both conventions Exact arithmetic The fallacy named

Requires independent trials with a constant p — which is exactly what a losing streak does not change.

Updated 8 September 2026 · Works in any browser, no installation

P(X = k) = (1−p)ᵏ⁻¹ · p. Fail k−1 times, then succeed. The mean wait is 1/p, so a one-in-twenty event takes twenty trials on average — and the distribution is so skewed that most waits are shorter than that while a few are far longer.

At a glance

Formula shown
P(X = k) = (1−p)^(k−1)·p for the number of trials up to and including the first success, with mean 1/p and variance (1−p)/p². The failures-before-success convention shifts everything down by one, giving mean (1−p)/p. The survival function is simply (1−p)^k.
Scenario support
How many attempts until something works; how many rolls until a six; how many applications until an offer; how many packets until one gets through; the number of items inspected before the first defect.
Educational estimate
Planning support from the values you enter — not professional advice.

Why the failures behind you do not count

The geometric distribution is memoryless, and it is one of very few that are. The property has an exact statement:

P(X > m + n | X > m) = P(X > n), for every m.

In words: given that you have already failed m times, the chance of waiting at least n more is the same as the chance of waiting at least n from a standing start. The past contributes nothing.

The panel in the tool computes both sides on your own numbers. At p = 0.2 with n = 5, the answer is 0.3276800000 whether you have failed zero times or two hundred. Identical to the last digit, because it is an identity rather than an approximation: the survival function is (1−p)ᵏ, and (1−p)ᵐ⁺ⁿ divided by (1−p)ᵐ is (1−p)ⁿ exactly.

This is the gambler’s fallacy, formalised. “Red has come up eight times, so black is due” is precisely the belief that memorylessness denies. The wheel has no record of the previous eight spins, and neither does the arithmetic.

Worth being careful about what it does not say. It does not say long streaks are common — they are rare, which is why they feel meaningful. It says that having had one changes nothing about what comes next. Rare beforehand, irrelevant afterwards.

And it only holds when the trials really are independent with a constant p. If your applications are improving, or the machine is wearing, the model does not apply and the intuition that the past matters is correct — just not for this distribution.

Two definitions share the name

This is the commonest source of wrong answers with the geometric distribution, and it is not a subtlety — it is two different random variables.

Number of trials, including the success. Starts at 1. P(X = k) = (1−p)ᵏ⁻¹p. Mean 1/p. This is what the tool takes as its input, and what “how many attempts until it works” usually means.

Number of failures before the success. Starts at 0. P(X = k) = (1−p)ᵏp. Mean (1−p)/p. This is R’s dgeom and the convention most textbooks use when they generalise to the negative binomial.

The means differ by exactly 1, which is the tell. At p = 0.2 the mean is 5 trials or 4 failures. Both are correct; quoting one while computing the other is not.

The variance is the same for both, (1−p)/p², because shifting a distribution does not change its spread. That is a useful check: if two sources agree on the variance and differ by 1 in the mean, this is why.

The tool prints both means side by side on every calculation, so the convention is never inferred.

The most likely wait is always one trial

A property that surprises people and is worth sitting with, because it says something real about waiting times.

The mode is always 1, whatever p is. P(X = 1) = p is the largest single probability, and every subsequent trial is strictly less likely than the one before, because each requires an extra failure first.

So the single most likely outcome is succeeding immediately — even when p is small. At p = 0.05 the chance of success on the first attempt is 5%, and that is still higher than the chance on any other specific attempt.

Meanwhile the mean is 1/p = 20. Mode 1, mean 20: an enormous gap, and the mark of a heavily right-skewed distribution. The gap between centres is doing exactly what that page describes.

The median is smaller than the mean too — roughly ln(2)/p, about 0.69/p. At p = 0.05 the median wait is about 14 trials while the mean is 20, so more than half of all waits are shorter than average.

The practical reading: most waits are shorter than the average, and a few are much longer. Planning around the mean will leave you surprised by the tail, and the tail is where the cost is.

How long until you are probably done

A more useful question than the mean, and one the survival function answers in a line.

P(X > k) = (1−p)ᵏ. The chance of still waiting after k trials, with no sum required.

So the number of trials needed to be 95% confident of at least one success is ln(0.05)/ln(1−p). At p = 0.1 that is 29 trials; at p = 0.01 it is 299; at p = 0.001, 2,995.

Notice the pattern: roughly 3/p. Three times the mean gets you to about 95%, for any p. That is a genuinely useful planning heuristic, and it is the same constant behind the rule of three, arriving from the other direction.

It also quantifies how bad the mean is as a plan. If you budget 1/p attempts, your chance of having succeeded is 1 − (1−p)^(1/p), which converges to about 63% as p gets small. Budgeting the mean leaves you failing more than a third of the time.

For anything where running out of attempts is expensive — retries, test batches, drilling programmes — plan on 3/p, not 1/p.

What it becomes when you change one thing

The geometric sits at the corner of a family, and each neighbour relaxes exactly one of its assumptions.

Waiting for the r-th success: negative binomial. The direct generalisation — the geometric is the case r = 1. Its other use is as the fix for overdispersed counts, which is a different face of the same distribution.

Fixed number of trials instead: binomial. The mirror image. Binomial fixes n and lets the successes vary; geometric fixes the successes at one and lets n vary. Same trials, opposite question.

Continuous time instead of discrete trials: exponential. The exponential is the geometric’s continuous analogue, and it is the only continuous distribution that is memoryless — just as the geometric is the only discrete one. That uniqueness is not a coincidence; memorylessness forces the functional form.

Without replacement: negative hypergeometric. Drawing from a finite pool changes p as you go, which breaks the constant-probability assumption, exactly as it does for the binomial.

Where it applies, and where it quietly does not

Anywhere you repeat an independent attempt at constant odds until it works.

Retries and reliability. Packets until one gets through, attempts until a lock acquires, restarts until a flaky test passes. The memorylessness here is real and is why exponential backoff exists — if retries were memoryless in the useful sense, backoff would be pointless.

Quality inspection. Items examined before the first defect, when the batch is large enough that removing one does not change the rate.

Games of chance. Rolls until a six, spins until a number comes up. The canonical teaching case, and the one where the fallacy is most tempting.

And two where it looks right and is not.

Job applications. Tempting, and wrong if you are learning. Each application changes your CV, your interview technique and your network, so p is not constant. The model assumes you are no better on attempt fifty than on attempt one.

Anything with wear or fatigue. A machine that degrades has a rising failure probability, so the trials are not exchangeable. Reliability engineering uses the Weibull distribution precisely because it allows the hazard rate to change, which memorylessness forbids.

The fallacy, and its mirror image

Memorylessness is denied in two opposite directions, and both are common.

The gambler’s fallacy says a long run of failures makes success more likely — you are “due”. The arithmetic above refutes it directly: the conditional and unconditional probabilities are identical.

The hot-hand fallacy says the opposite — that a run predicts more of the same. Under a genuinely geometric process that is equally wrong, and for the same reason.

What makes this genuinely hard is that both can be correct outside the model. If a factory is drifting out of calibration, a run of defects really does predict more defects. If a player is warmed up, a run of hits may really predict more hits. The mistake is not believing the past matters — it is believing it matters in a process where p is constant, or believing it does not in a process where p is drifting.

So the useful question is never “am I due?” but “is p actually constant here?”. If it is, the streak is information about nothing. If it is not, the geometric distribution was the wrong model from the start and its probabilities were never the ones to use.

Sources and methodology

References for the distribution and the memoryless property.

Method. The memorylessness panel computes both sides of P(X > m+n | X > m) = P(X > n) from the survival function rather than displaying a rearranged formula, so the identity is demonstrated on the reader’s own numbers instead of asserted. The suite checks it holds to within 1e-12 across a grid of p values and prior-failure counts including m = 200, where a naive implementation that accumulated error would visibly drift. Both conventions are computed and printed on every result, and the suite asserts that their means differ by exactly 1 while their variances are identical — which is the property that lets a reader tell which convention a source is using. That engine is verified on every change against 0 assertions, including that the geometric PMF sums to 1 over four thousand terms at p = 0.02. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Exponential DistributionTime-until-event probabilities from a rate or a mean, always showing both — with a panel proving elapsed time changes nothing, which is a constant hazard rate and false for anything that wears out.
Binomial DistributionExact binomial probabilities at any n — including thousands, where a factorial overflows — with the normal approximation beside them and its error measured, which is 0.6% at the centre and 261% in the tail.
Poisson DistributionPoisson probabilities with a dispersion test against your own variance — because a Poisson forces variance to equal the mean, and real count data usually does not, which is exactly where the tail goes wrong.
Hypergeometric DistributionExact probabilities for drawing without replacement, with the binomial answer beside them and the 10% rule evaluated — at a 40% sampling fraction the binomial is 22% wrong, at 0.2% it is 0.06% wrong.
Normal DistributionProbabilities under a normal curve in all four directions with the region shaded — and the empirical rule given exactly, because two standard deviations is 95.45% and the 95% everyone quotes sits at 1.96σ.
Mean, Median and ModeAll three centres marked on your own data, every mode rather than just the first, and the mean-median gap read as a direct measure of skew.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. The geometric distribution assumes independent trials with a constant probability of success; learning, wear, or drawing from a small pool all break that, and the memoryless property does not hold for those processes.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

  • Formula and examples verified on 8 September 2026
  • Self-reviewed — written and checked by the same person, with no independent reviewer
  • Educational estimate only
  • How calculators are verified
What's changed (3 updates)

Published 8 September 2026

  1. Published a geometric distribution calculator whose central panel computes the remaining wait two ways — given the failures already seen, and starting fresh — and shows them identical to the last digit even after 200 failures. That is the gambler's fallacy written as arithmetic rather than described.
  2. Prints both conventions on every result, because 'geometric' means either trials-including-the-success or failures-before-it, the means differ by exactly one, and mixing them is the commonest error with this distribution.
  3. States the planning consequence the mean hides: budgeting 1/p attempts succeeds only about 63% of the time, and roughly 3/p is needed for 95% confidence.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.