Use this discrete probability distribution to find the probability that a Bernoulli event with probability `p` of success has occurred a given number of times after a given number of trials. The random variable `X` represents the number of trials to get the `r`'th success.

### Formulas

- Parameters
`r` (number of successes) is an integer where 1 <= `r`; the special case `r` = 1 creates the geometric distribution.
`p` (probability of success on any given trial) is a real number where 0 < `p` < 1.
- Support (domain where probability mass > 0)
- integers >=
`r`
- Probability mass function f(x) = P(
`X` = `x`) (probability that `r`th success occurs on trial `x`)
- ((
`x` - 1) choose (`r` - 1))`p`^{r}(1 - `p`)^{x - r}
- Cumulative distribution function F(x) = P(
`X` <= `x`) (probability that `r`th success occurs on or before trial `x`)
- No closed form solution; just use sum(f(
`j`), `j` = `r`..floor(`x`))
- Mean E[X]
`r`/`p`
- Variance σ
^{2}
- (
`r` - `r``p`)/`p`^{2}

*by Dr. Diane Evans (a math professor at Rose-Hulman Institute of Technology) and Damian Yerrick (one of her students)*
Johnny, a sixth grader at Honey Creek Middle School in Terre Haute, Indiana, is required to sell candy bars in his neighborhood to raise money for the 6th grade field trip. There are thirty homes in his neighborhood, and his father has told him not to return home until he has sold five candy bars. So the boy goes door to door, selling candy bars. At each home he visits, he has an 0.4 probability of selling one candy bar and an 0.6 probability of selling nothing.

#### What's the probability mass function for selling the last candy bar at the xth house?

f(x) = **.01024*((x - 1) choose 4)*.6^(x - 5)**

#### What's the probability that he finishes on the tenth house?

f(10) = **.100**

#### What's the probability that he finishes on before reaching the eighth house?

Answer: To finish on or before the eighth house, he must finish at the fifth, sixth, or seventh house. Sum those probabilities:

f(5) = 0.102; f(6) = .0307, f(7) = .0553; sum(f(j), j=5..7) = **0.963**

#### What's the probability that he exhausts all houses in the neighborhood, gives up, and then goes to live on the streets?

1 - sum(f(j), j=5..30) = 1 - .9985 = **.0015**

See also The Little Match Girl.

© 2001-2007 Damian Yerrick. Licensed under

GNU Free Documentation License 1.1 or later.