Geometric Distribution Calculator Formula

Understand the math behind the geometric distribution calculator. Each variable explained with a worked example.

Formulas Used

P(X = k)

probability = pow(1 - p, k - 1) * p

P(X <= k)

cdf = 1 - pow(1 - p, k)

Expected Value (1/p)

expected = 1 / p

Variance

variance_val = (1 - p) / pow(p, 2)

Variables

VariableDescriptionDefault
pSuccess Probability (p)0.2
kTrial Number (k)5

How It Works

How to Calculate Geometric Distribution Probability

Formula

P(X = k) = (1-p)^(k-1) * p

The geometric distribution models the number of trials needed to get the first success. Each trial is independent with success probability p. The probability of needing exactly k trials means k-1 failures followed by 1 success. The expected number of trials is 1/p.

Worked Example

A basketball player has a 20% free-throw rate. What is the probability the first basket is made on the 5th attempt?

p = 0.2k = 5
  1. 01P(X=5) = (1-0.2)^(5-1) * 0.2
  2. 02= 0.8^4 * 0.2
  3. 03= 0.4096 * 0.2
  4. 04= 0.08192
  5. 05Expected trials until first success = 1/0.2 = 5