Geometric Distribution Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Introduction: What does the geometric distribution measure?

The geometric distribution models how many independent, identical trials you must perform until the first success occurs. Each trial has only two possible outcomes (success or failure) and the probability of success is the same on every trial. The random variable typically counts either:

This calculator uses the first convention: X is the trial number of the first success, so X takes values 1, 2, 3, and so on.

Typical examples include:

Key formulas for the geometric distribution

Let X be the trial on which the first success occurs, and let p be the probability of success on each trial (with 0 < p ≤ 1). The probability that the first success happens exactly on trial k (for k = 1, 2, 3, ...) is given by the probability mass function (PMF):

P(X = k) = (1 - p)^{k - 1} p.

This expression reflects the idea that you must see k - 1 failures in a row, followed by one success.

The cumulative distribution function (CDF) gives the probability that the first success occurs on or before trial k:

P(X ≤ k) = 1 - (1 - p)^{k}.

This is one minus the probability that all of the first k trials are failures.

The geometric distribution also has simple expressions for the mean (expected value) and variance:

E [ X ] = 1 p , Var ( X ) = 1 p 2 - 1 p .

As p decreases, both the expected number of trials and the variance increase. When successes are rare, you typically wait longer and see more variability in the waiting time.

The memoryless property

The geometric distribution is memoryless. Formally, for all integers s, t ≥ 0,

P(X > s + t ∣ X > s) = P(X > t).

This means that, if you still have not seen a success after s trials, the conditional distribution of the additional waiting time does not depend on how long you have already waited. In practice, each new trial behaves as if you were starting the process again.

How to use the geometric distribution calculator

The calculator is designed around the parameterization where X counts the trial of the first success. You provide two inputs:

  • Success probability p: the probability of success on each individual trial. This must satisfy 0 < p ≤ 1. For example, a 30% chance of success corresponds to p = 0.3.
  • Number of trials k: a positive integer (k ≥ 1) representing the trial number you are interested in (for example, the 3rd or 10th trial).

After entering p and k and selecting “Compute”, the calculator typically returns three core quantities:

  • P(X = k) – the probability that the first success occurs exactly on trial k.
  • P(X ≤ k) – the cumulative probability that the first success occurs on or before trial k.
  • Summary statistics such as the mean 1 / p and variance 1 / p2 - 1 / p for the geometric distribution defined by your chosen p.

You can use these outputs to answer questions like:

  • “What is the probability that I need at least k trials before I succeed?” (This is 1 - P(X ≤ k - 1).)
  • “How many trials do I expect to need on average?” (This is the mean 1 / p.)
  • “How variable is the number of trials?” (This is captured by the variance, and by the square root of the variance, the standard deviation.)

Worked example

Suppose you are flipping a biased coin that lands on heads with probability p = 0.3 on each flip. You want to know the probability that you get the first heads on the 4th flip or earlier.

  1. Set p = 0.3 in the calculator.
  2. Set k = 4, because you are interested in the first success occurring on or before the fourth trial.
  3. Select “Compute” to evaluate the following quantities.

Exact probability P(X = 4)

First, compute the probability that the first heads occurs exactly on flip 4:

P(X = 4) = (1 - p)^{4 - 1} p = (0.7)^{3} × 0.3.

Numerically, this is:

(0.7)^{3} = 0.343,

so

P(X = 4) ≈ 0.343 × 0.3 = 0.1029.

In other words, there is about a 10.29% chance that the first heads appears exactly on the fourth flip.

Cumulative probability P(X ≤ 4)

Next, compute the probability that the first heads occurs on or before the fourth flip:

P(X ≤ 4) = 1 - (1 - p)^{4} = 1 - (0.7)^{4}.

We have

(0.7)^{4} = 0.2401,

so

P(X ≤ 4) = 1 - 0.2401 = 0.7599.

Thus, there is about a 75.99% chance that you see at least one heads within the first four flips.

Mean and variance

The calculator will also report the mean and variance for X when p = 0.3:

  • Mean: E[X] = 1 / p = 1 / 0.3 ≈ 3.33 trials.
  • Variance: Var(X) = 1 / p2 - 1 / p = 1 / 0.09 - 3.33 ≈ 11.11 - 3.33 = 7.78.

The mean says you should expect, on average, a little more than 3 flips to get the first heads. The relatively large variance (7.78) confirms that outcomes can vary quite a bit around this typical value, especially because p is noticeably less than 0.5.

Comparison with related distributions and parameterizations

The geometric distribution sits alongside several closely related discrete distributions. The table below summarizes the main differences that matter when you choose a model or compare software outputs.

Distribution / parameterization What it counts Support (possible values) Typical use
Geometric (this calculator: X) Trial number of the first success 1, 2, 3, ... Waiting time until first event, counted in trials.
Geometric (alternative: Y) Number of failures before the first success 0, 1, 2, ... Same situations as above, but counting failures instead of trials. Related to X via X = Y + 1.
Negative binomial Number of trials needed for the r-th success (or number of failures before r-th success) r, r + 1, r + 2, ... (or 0, 1, 2, ... depending on convention) Waiting time until more than one success; geometric is the special case r = 1.
Binomial Number of successes in a fixed number of n trials 0, 1, ..., n Fixed trial count with interest in how many successes occur, not when the first appears.

Many software packages offer both geometric parameterizations. For example, some functions return the probability that there are y failures before the first success, while others return the probability that the first success occurs on trial k. When checking documentation, look carefully at whether the support starts at 0 or 1, and apply the conversion X = Y + 1 if you need to translate between them.

Interpreting the calculator outputs

Once the calculator has produced values for P(X = k), P(X ≤ k), and the mean and variance, you can interpret them as follows:

  • P(X = k) is ideal for questions framed as “exactly on trial k.” If this probability is very small, then observing the first success exactly at k would be a rare event under your model.
  • P(X ≤ k) answers questions like “by trial k” or “within the first k attempts.” If this value is close to 1, your process is very likely to have succeeded by then.
  • Mean 1 / p represents a typical waiting time. If your observed average waiting time is very different from 1 / p for many independent sequences, it may indicate that the geometric assumptions are not appropriate.
  • Variance 1 / p2 - 1 / p reflects how spread out the waiting times are. A large variance relative to the squared mean suggests a wide range of possible waiting times.

In quality control or reliability settings, you can compare empirical data (for example, observed numbers of tests until the first failure in many components) with the geometric mean and variance to see whether the assumption of a constant per-trial failure probability is plausible.

Assumptions and limitations of the geometric model

To use the geometric distribution and this calculator correctly, several assumptions must hold. They are often reasonable but are not automatic in real data.

Core assumptions

  • Independent trials: The outcome of each trial must not affect the outcome of any other trial. For example, repeated coin flips are usually modeled as independent.
  • Constant success probability p: The probability of success must stay the same from trial to trial. If p changes over time (for example, because a learning process improves your success rate), the geometric model is not appropriate.
  • Binary outcomes: Each trial must have a clear success/failure outcome. Situations with multiple outcome categories need different models or a recoding into success vs. not-success.
  • Stopping at the first success: The process of interest ends when the first success occurs. If you are interested in the total number of successes over a fixed set of trials, a binomial model is more suitable.

When the geometric model is inappropriate

  • Changing probabilities: If the success probability improves or declines over time (for example, due to fatigue, practice, or changing environmental conditions), the memoryless property breaks and the geometric distribution no longer fits.
  • Dependence between trials: If the result of one trial affects the next (such as drawing cards without replacement from a small deck), then trials are not independent. In such cases, the hypergeometric or other distributions may be more accurate.
  • Over-dispersion from heterogeneity: If there is unmodeled variation in p between subjects, days, or environments, the observed waiting times may be more variable than a single geometric distribution predicts. Mixture models or negative binomial models may be better choices.
  • Multiple successes of interest: If you care about the time until the second, third, or r-th success, the negative binomial distribution is usually more appropriate; the geometric distribution is only the special case r = 1.

Being explicit about these assumptions helps avoid misinterpretation. If you find that the geometric distribution does not capture the variability or patterns in your data, consider whether any of the assumptions above are violated and whether an alternative model might be more suitable.

Arcade Mini-Game: Geometric Distribution Calculator Calibration Run

Use this quick arcade run to practice separating useful scenario inputs from common planning mistakes before you rely on the calculator output.

Score: 0 Timer: 30s Best: 0

Start the game, then use your pointer or arrow keys to catch useful inputs and avoid bad assumptions.

Status messages will appear here.