HomeStatistics & Probability › Geometric Distribution Calculator

Geometric Distribution Calculator

Computes, for independent trials with success probability p, the probability that the first success occurs exactly on trial k, within the first k trials or later than trial k, plus the mean, variance, standard deviation and expected number of failures before the first success.

When to use

You repeat independent attempts with the same success chance and ask how many attempts it takes until the first success (first six on a die, first defective item, first sale).

Do not use when: The number of trials is fixed and you count successes (use binomial-distribution), or the waiting time is continuous (use exponential-distribution).

Formula

P(X = k) = (1 − p)^(k − 1) · p; P(X ≤ k) = 1 − (1 − p)^k; mean = 1/p; variance = (1 − p)/p²

Uses the 'number of trials' convention (support k = 1, 2, …). The alternative convention counts failures before the first success (support 0, 1, …); its mean is (1 − p)/p, reported as expected_failures.

Inputs

ParameterTypeUnitRequiredDescription
probability_of_successnumberyesSuccess probability on each trial, as a fraction between 0 and 1 (not a percentage). Range: > 0, ≤ 1
trialintegeryesThe trial on which the first success is of interest (k = 1 is the first attempt). Range: ≥ 1, ≤ 1000000

Outputs

OutputTypeUnitDescription
probability_exactnumberFirst success exactly on trial k: (1 − p)^(k−1) · p.
probability_at_mostnumberFirst success within the first k trials: 1 − (1 − p)^k.
probability_more_thannumberNo success in the first k trials: (1 − p)^k.
meannumberExpected trials until the first success: 1/p.
variancenumber(1 − p)/p².
std_devnumber√(1 − p) / p.
expected_failuresnumber(1 − p)/p: mean of the alternative 'number of failures' form of the distribution.

Example

First six on the 3rd roll of a die (p = 1/6): {"probability_of_success":0.1666667,"trial":3}{"probability_exact":0.115741,"probability_at_most":0.421296,"probability_more_than":0.578704,"mean":6,"variance":30,"std_dev":5.4772,"expected_failures":5}

p = 0.2, first success on trial 5: {"probability_of_success":0.2,"trial":5}{"probability_exact":0.08192,"probability_at_most":0.67232,"probability_more_than":0.32768,"mean":5,"variance":20,"std_dev":4.4721}

GET https://tttkmbb.com/api/v1/calculate/geometric-distribution?probability_of_success=0.1666667&trial=3

Machine access

Sources

FAQ

Which convention does this calculator use?

k counts the trial of the first success (k ≥ 1). If your textbook counts failures before the first success, subtract 1 from k and use expected_failures for the mean.

Is the geometric distribution memoryless?

Yes: after any number of failures, the distribution of the remaining number of trials until success is unchanged. Past failures do not make a success 'due'.

Related calculators