Geometric Distribution

Modeling the number of trials needed to get the first success.

"How Long Until It Hits?"

The Geometric distribution answers the question: "How many times do I have to try until I get my first success?" It models the number of independent Bernoulli trials required to achieve the first success.

In finance, this could model the number of trades you need to make until you have your first profitable one, or how many quarters it will take for a startup in your portfolio to finally turn a profit. It's always right-skewed, because a small number of trials is always more likely than a large number.

Interactive Geometric Distribution
Adjust the probability of success (pp) to see how it affects the likelihood of achieving the first success on a given trial.
Mean (μ\mu): 4.00
Variance (σ2\sigma^2): 12.00

Core Concepts

Probability Mass Function (PMF)
The PMF gives the probability that the first success occurs on exactly the k-th trial.
P(X=k)=(1p)k1pP(X=k) = (1-p)^{k-1}p

This formula is very intuitive. For the first success to occur on trial kk, two things must happen:

  • You must have exactly k1k-1 failures in a row first. The probability of one failure is 1p1-p, so the probability of k1k-1 independent failures is (1p)k1(1-p)^{k-1}.
  • The kk-th trial itself must be a success, which has a probability of pp.

Multiplying these probabilities together gives the formula.

Mean (μ\mu): 4.00
Variance (σ2\sigma^2): 12.00
Cumulative Distribution Function (CDF)
The CDF gives the probability that the first success occurs on or before the k-th trial.
F(k)=P(Xk)=1(1p)kF(k) = P(X \le k) = 1 - (1-p)^k

The CDF can be derived from its complementary event: the probability of needing *more* than `k` trials for the first success. This only happens if the first `k` trials are all failures, an event with probability (1p)k(1-p)^k. Therefore, the probability of needing `k` or fewer trials is 1(1p)k1 - (1-p)^k.

Mean (μ\mu): 4.00
Variance (σ2\sigma^2): 12.00

Key Derivations

Deriving the Mean and Variance

Deriving the Expected Value (Mean)

Step 1: Set up the Infinite Series for E[X]

The expected value is the sum of each outcome kk multiplied by its probability P(X=k)P(X=k). Let q=1pq = 1-p.

E[X]=k=1kP(X=k)=k=1kqk1pE[X] = \sum_{k=1}^{\infty} k \cdot P(X=k) = \sum_{k=1}^{\infty} k \cdot q^{k-1}p

We can pull the constant pp out:

E[X]=pk=1kqk1=p(1+2q+3q2+4q3+)E[X] = p \sum_{k=1}^{\infty} k q^{k-1} = p(1 + 2q + 3q^2 + 4q^3 + \dots)

Step 2: Use the Geometric Series Derivative Trick

Recall the formula for an infinite geometric series: k=0qk=11q\sum_{k=0}^{\infty} q^k = \frac{1}{1-q}.

If we take the derivative of both sides with respect to qq, we get:

ddq(k=0qk)=k=1kqk1=ddq(11q)=1(1q)2\frac{d}{dq} \left( \sum_{k=0}^{\infty} q^k \right) = \sum_{k=1}^{\infty} k q^{k-1} = \frac{d}{dq} \left( \frac{1}{1-q} \right) = \frac{1}{(1-q)^2}

This gives us the value of the summation from Step 1.

Step 3: Substitute and Solve

Substitute this result back into the equation for E[X]E[X]:

E[X]=p1(1q)2E[X] = p \cdot \frac{1}{(1-q)^2}

Since q=1pq = 1-p, we have 1q=p1-q = p.

E[X]=p1p2E[X] = p \cdot \frac{1}{p^2}
Final Mean Formula
E[X]=1pE[X] = \frac{1}{p}

Deriving the Variance

We use Var(X)=E[X2](E[X])2Var(X) = E[X^2] - (E[X])^2. A common trick is to first find E[X(X1)]E[X(X-1)] and then use it to find E[X2]E[X^2].

Step 1: Calculate E[X(X-1)]

We set up another series:

E[X(X1)]=k=1k(k1)qk1p=pk=2k(k1)qk1E[X(X-1)] = \sum_{k=1}^{\infty} k(k-1)q^{k-1}p = p \sum_{k=2}^{\infty} k(k-1)q^{k-1}

This sum is the second derivative of the geometric series formula with respect to qq, multiplied by qq.

d2dq2(k=0qk)=k=2k(k1)qk2=2(1q)3\frac{d^2}{dq^2} \left( \sum_{k=0}^{\infty} q^k \right) = \sum_{k=2}^{\infty} k(k-1)q^{k-2} = \frac{2}{(1-q)^3}

Therefore, the summation part is k=2k(k1)qk1=2q(1q)3\sum_{k=2}^{\infty} k(k-1)q^{k-1} = \frac{2q}{(1-q)^3}.

E[X(X1)]=p2q(1q)3=p2qp3=2qp2E[X(X-1)] = p \cdot \frac{2q}{(1-q)^3} = p \cdot \frac{2q}{p^3} = \frac{2q}{p^2}

Step 2: Find E[X²]

Using the property E[X(X1)]=E[X2X]=E[X2]E[X]E[X(X-1)] = E[X^2 - X] = E[X^2] - E[X], we can rearrange to solve for E[X2]E[X^2].

E[X2]=E[X(X1)]+E[X]=2qp2+1pE[X^2] = E[X(X-1)] + E[X] = \frac{2q}{p^2} + \frac{1}{p}

Step 3: Calculate the Variance

Var(X)=E[X2](E[X])2=(2qp2+1p)(1p)2Var(X) = E[X^2] - (E[X])^2 = \left(\frac{2q}{p^2} + \frac{1}{p}\right) - \left(\frac{1}{p}\right)^2
=2qp2+pp21p2=2q+p1p2= \frac{2q}{p^2} + \frac{p}{p^2} - \frac{1}{p^2} = \frac{2q + p - 1}{p^2}

Substitute p1=qp-1 = -q:

=2qqp2=qp2= \frac{2q - q}{p^2} = \frac{q}{p^2}
Final Variance Formula
Var(X)=1pp2Var(X) = \frac{1-p}{p^2}

Applications