Geometric Distribution Calculator

This geometric distribution calculator needs the success probability p and a trial number k. Example: with p = 0.2, the first success comes exactly on trial 3 with probability 0.128.

Example: Success probability p 0.2 · Count k 3 · Count: Trials up to and including the first success (k ≥ 1) → Result: P(X = 3) = 0.128 (p = 0.2, first success on trial 3). Source: Wikipedia – Geometric distribution. Updated: .

A number between 0 and 1, e.g. 0.2 for 20%.
Whole number: trial number (from 1) or number of failures (from 0).
My ToolboxYour inputs are saved in this browser only.

Result

Result
P(X = 3) = 0.128 (p = 0.2, first success on trial 3)
All values
QuantityValue
Exactly k: P(X = k)0.128
At most k: P(X ≤ k)0.488
More than k: P(X > k)0.512
Mean5
Variance (1 − p) / p²20
Standard deviation4.47214
Calculation steps
  • P(X = k) = (1 − p)^(k − 1) · p = 0.8^2 · 0.2 = 0.128.
  • P(X ≤ k) = 1 − (1 − p)^k = 1 − 0.8^3 = 0.488.
  • Mean: 1 / 0.2 = 5; variance (1 − p) / p² = 0.8 / 0.04 = 20.
The mean is the average over many repetitions; any single run can differ widely from it.

How it is calculated

The geometric distribution tells you how many independent trials with the same success probability p are needed until the first success occurs.

Formulas

If you count the trials including the successful one, P(X = k) = (1 − p)^(k − 1) · p for k = 1, 2, 3, …; the probability of succeeding by trial k at the latest is P(X ≤ k) = 1 − (1 − p)^k. The mean is 1/p and the variance (1 − p) / p². If you count only the failures before the success (k = 0, 1, 2, …), P(Y = k) = (1 − p)^k · p and the mean is (1 − p) / p.

Worked example

Each trial succeeds with p = 0.2. A first success on trial 3 means two misses and then a hit: 0.8² · 0.2 = 0.128. Succeeding by trial 3 at the latest has probability 1 − 0.8³ = 0.488, so more than three trials are needed with probability 0.512. On average 1/0.2 = 5 trials are needed, and the variance is 0.8 / 0.04 = 20. Counting only failures, three failures before the success have probability 0.8³ · 0.2 = 0.1024, with a mean of 4.

Frequently asked questions

How do you calculate the geometric distribution?

With P(X = k) = (1 − p)^(k − 1) · p. For p = 0.2 and k = 3 that is 0.8² · 0.2 = 0.128.

What is the difference between trials and failures?

Counting trials includes the successful one (k ≥ 1, mean 1/p); counting failures does not (k ≥ 0, mean (1 − p)/p). The probabilities are the same, just shifted by one.

How many trials are needed on average?

On average 1/p trials. With a 20% hit rate, that is 5 trials until the first hit.

Sources and legal basis

As of: · Editorial policy

Related tools