dgeom() — Geometric probability

The chance your first win comes after exactly x misses.

dgeom(x, prob)

Key idea

See the pattern (each try wins with p = 0.2)

  1. Win right away — x = 0 misses: ✓ → P = 0.2
  2. x = 1 miss: ✗ ✓ → 0.8 × 0.2 = 0.16
  3. x = 2 misses: ✗ ✗ ✓ → 0.8 × 0.8 × 0.2 = 0.128
  4. x = 3 misses: ✗ ✗ ✗ ✓ → 0.8 × 0.8 × 0.8 × 0.2 ≈ 0.102
  5. The number of ✗ marks is x, and there is always exactly one ✓ at the end — so P(X = x) = 0.8ˣ × 0.2.

Definition

number of misses before the first win
chance of success each try
1 − p, the chance of a miss
the try the first win lands on (T = x + 1)
x misses in a row

In plain words

Picture Chad playing a game and stopping the instant he wins. If he wins on the 3rd try, the only possible story is lose → lose → win: the two earlier tries MUST be losses, because winning sooner would have ended the game. So x just counts those losses before the one win. Quick check: if his first win is on the 5th try, the run is ✗ ✗ ✗ ✗ ✓ — and 0.8⁴ × 0.2 is simply that picture written short, not a scary new thing.

Where you'd use it

Worked example 7

A fair coin (prob = 0.5). The chance of 2 misses before your first heads is 0.125.

Frequently asked questions

What does dgeom count?
The number of failures before the first success (starting at 0) — one less than the trial number used in many textbooks.