Your Equation

Library / Probability distributions / PRD-46

Probability distributions

Failures before a target: expected number

Expected number of failures before the rth success: r times the odds of failing, (1 − p)/p.

Ref
PRD-46
Rev
v1
Field
Probability distributions
Result
E[X]

The expected number of failures before the rth success is r(1 − p)/p: r times the odds of failing on a single trial. Add r to get the expected total number of trials, r/p.

Expected number of failures before the rth success: r times the odds of failing, (1 − p)/p.

Calculator

Solve for
110
0.050.95
  • Expected total trials, r/p7.5
  • Odds of failing on one trial, (1 − p)/p1.5
  • Standard deviation of the failures3.354

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Expected failures () current value 4.5
pSuccess probability pKey driver
0.15857
rTarget number of successes r
1.515
  • At a 40 % success rate, reaching 3 successes takes about 4.5 failures first, 7.5 trials in all.
  • Halving the success probability roughly doubles the failures: the effect is steep when p is small.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing ()Local stepChange in result
p Success probability p0.05 to 0.95 0.15795756.84+10%−15.2 %
r Target number of successes r1 to 10 1.51513.5+1 +33.3 %

Sweep of Success probability p

Success probability pExpected failures
0.0557
0.162515.46
0.2757.909
0.38754.742
0.53
0.61251.898
0.7251.138
0.83750.5821
0.950.1579

Sweep one variable

Expected failures ()Hover, touch, or use the arrow keys on the chart
0102030405060 0.10.30.50.70.9 Success probability p now 4.5

Variables and how each one contributes

E[X]

Expected failures

Result ·

What the equation gives you. Everything else feeds it.

r

Target number of successes r

· typical 1 to 10

The target number of successes (a whole number, at least 1). A larger target needs more failures along the way on average. Raising it by 1 (to 4) moves the result by +33.3 %, from 4.5 to 6.

p

Success probability p

· typical 0.05 to 0.95

The probability of success on each trial (0 to 1). Trials are independent. A higher success probability cuts the number of failures sharply. Raising it by 0.05 (to 0.45) moves the result by −18.5 %, from 4.5 to 3.667.

Worked example with the values above

  1. Odds of failing: (1 − p)/p = 0.6 / 0.4 = 1.5.
  2. Multiply by r = 3.
  3. E[X] = 4.5 failures.

Assumptions and limits

  • Independent trials with the same success probability p, run until the rth success.
  • r is a whole number and 0 < p < 1.

Common mistakes

  • Forgetting that x counts failures only: the total number of trials is x + r.
  • Assuming a constant p when it drifts, for example when attempts improve with practice.
  • Using a Poisson model for counts that are more spread out than their mean.

Statistics and uncertainty

A mean, variance or percentile is calculated from fitted parameters, and the uncertainty in those parameters passes straight through. A distribution fitted to a small sample can have parameters that are far from the truth, especially in the tails and for the variance, so quote the result together with the sample size it rests on.

Where it is used

  • Counting failed attempts before a target number of passes in testing.
  • Overdispersed count data, where the variance exceeds the mean.

Maths you need

  • Combinations: ways of choosing items, C(n, k)
  • Independent trials: each outcome unaffected by the others

Related formulas

Practise this formula