Geometric Distribution Calculator

Probability the first success happens on trial k — plus the CDF, the tail, and the mean 1/p. Full distribution chart and show/hide step-by-step working.

What is the geometric distribution?

The geometric distribution answers the question: "How many independent trials do I need until the first success?" Each trial has the same success probability p, and X — the trial number on which the first success occurs — is the random variable. It can take any whole value 1, 2, 3, … with no upper bound.

A classic example: flip a fair coin (p = 0.5) until the first heads appears. Then P(X = 1) = 0.5 (heads on the first flip), P(X = 2) = 0.5 · 0.5 = 0.25 (a tail then a head), P(X = 3) = 0.5² · 0.5 = 0.125, and so on — the probabilities halve every trial. On average you'll wait 1/0.5 = 2 flips for the first heads.

The geometric distribution, piece by piece

PMF — the trial of the first success

Each trial is independent with success probability p. The first success lands on trial k precisely when the first k − 1 trials fail and the k-th succeeds — an event with probability (1 − p)^(k − 1) · p.

P(X = k)
= (1 − p)k − 1 · p  (k = 1, 2, 3, …)
psuccess probability per trial (constant)·ktrial on which the first success occurs
12345678
Example
Given
p = 1/6
k = 3
Substitute
(5/6)² · (1/6) = 25/216
Answer
≈ 0.1157 (11.6%)

CDF — success by trial k

The CDF collapses to a simple closed form: the only way to have no success by trial k is for all k trials to fail, so P(X ≤ k) = 1 − (1 − p)^k.

P(X ≤ k) = 1 − (1 − p)k
1 − pfailure probability per trial·(1 − p)^kprobability of all k failures
k = 0, 1, 2, …1.0
Example
Given
p = 1/6
k = 6
Substitute
1 − (5/6)⁶ = 1 − 15625/46656
Answer
≈ 0.6651 (66.5%)

Tail — still waiting after k

The complement of the CDF: the probability that the first success has not yet arrived after k trials. This is the same as the probability of k straight failures, and it makes the memoryless property visible.

P(X > k) = (1 − p)k
P(X > k)no success in the first k trials
shaded: P(X > 4) = (1 − p)⁴
Example
Given
p = 1/6
k = 6
Substitute
(5/6)⁶ = 15625/46656
Answer
≈ 0.3349 (33.5%)

Answer — mean, variance, SD

The expected number of trials is simply 1/p — a small p means a long wait. Variance is (1 − p)/p², and the standard deviation is close to the mean for small p, which is why the geometric distribution has such a long right tail.

μ = 1/p  ·  σ²
= (1 − p)/p²  ·  σ
= √σ²
μexpected trial of first success·σ²variance of X
μ = 1/p = 5expected trial of first success
Example
Given
p = 1/6
Substitute
μ = 6, σ²
= (5/6)/(1/36)
= 30
Answer
μ = 6, σ ≈ 5.48

This calculator uses the "trials until first success" convention (k = 1, 2, 3, …). For the "failures before first success" form (k' = 0, 1, 2, …), just use k' = k − 1.

Geometric vs binomial distribution

These get mixed up constantly because both live on the same Bernoulli-trial setup, but they answer different questions:

Binomial(n, p)Geometric(p)
Random variableNumber of successesTrial of the first success
Number of trialsFixed (n)Random — keep going until success
Range0, 1, 2, …, n1, 2, 3, … (no upper limit)
Meann · p1/p
Typical question"In 10 flips, what's P(exactly 3 heads)?""How many flips until the first heads?"

Rule of thumb: if the problem gives you a fixed n and asks about the count of successes, it's binomial. If the problem stops as soon as the first success happens and asks about the trial number, it's geometric.

The memoryless property

The geometric distribution is the only discrete distribution that is memoryless: P(X > s + t | X > s) = P(X > t). If you've already made s trials without a success, the probability of needing more than t additional trials is exactly what it was at the start.

In plain terms: past failures do not make future success "due". If you've rolled the die 10 times without a 6, your expected wait for the first 6 is still 6 more rolls, not fewer. This is the gambler's-fallacy trap dressed in slightly different clothes.

Common mistakes

  • Confusing the two conventions. Some textbooks use X = failures before the first success (starts at 0), others use X = trial of the first success (starts at 1). This calculator uses the latter — subtract 1 from k if you need the other form.
  • Using the geometric formula when trials are fixed. If the problem fixes n and asks about the number of successes, that's binomial — not geometric.
  • Thinking the mean is 1 − p or p. Neither. The mean is 1/p — the smaller p is, the longer you wait, and the wait grows fast (p = 0.1 → mean 10, p = 0.01 → mean 100).
  • Believing past failures shorten the future wait. They don't. The memoryless property is real — the process resets its expectation on every trial.

Features of this calculator

  • Exact P(X = k), P(X ≤ k) and P(X > k) using the closed-form (1 − p)^(k−1) · p and 1 − (1 − p)^k.
  • Mean 1/p, variance (1 − p)/p² and standard deviation printed alongside every result.
  • Full geometric-distribution bar chart with your target k highlighted, auto-scaled to cover ≥ 99.5% of the mass.
  • Handles any p in (0, 1] and any k up to 100,000.
  • Show/hide step-by-step working with the formulas substituted using your own numbers.
  • Copy the summary as text or download the result panel as a PNG.

Frequently asked questions

+What is P(X = 1) for a geometric distribution?

Just p. The first trial is either a success (probability p) or a failure — no earlier trials to condition on.

+Why does P(X = k) shrink geometrically?

Each additional trial requires one more failure with probability (1 − p), so each step multiplies the probability by (1 − p). That's the "geometric" in the name — successive probabilities form a geometric sequence.

+Can k be 0?

Not in this convention. The first success has to happen on some trial, so k = 1, 2, 3, … If you're using the "failures before first success" version, k = 0 is allowed and corresponds to a success on trial 1 here.

+What happens if p = 1?

Every trial is a guaranteed success, so P(X = 1) = 1 and P(X = k) = 0 for k > 1. Mean = 1, variance = 0.

+How does this relate to the negative binomial distribution?

The geometric is the special case of the negative binomial where you're waiting for exactly r = 1 success. For r > 1 successes, use the negative binomial formula instead.

+Where does the geometric distribution show up in real problems?

Anywhere you retry until success: cold-calling until someone answers, quality-testing units off a line until a defect, spawning enemies in a game until the first rare drop, retrying a flaky API call until it succeeds. Also the discrete counterpart of the exponential distribution in reliability.

Related calculators