> Home > Statistics Notes > Probability > Complementary Events

## The Geometric Distribution

Suppose once again we are looking at a sequence of independent Bernoulli trials. Each trial has success probability p. Recall that if we did N trials, the probability of r successes on the N trials was given by the binomial distribution. The binomial distribution has two parameters, N and p, and the range of possible values goes from 0 to N.
But suppose we want to know how long we will have to wait for the first success. More precisely, we want to know what the chance is the first success will occur on the first trial, on the second trial, etc. In other words, we could let T be the random time at which the first success happens, and we could try to find the probability that T would be 1, or 2, or 3, or anything else. The range of possible values is 1, 2, 3, and on up without limit.
The probability that a success will occur on any given trial is p. So p is the probability that the first success will occur on the very first trial, and the probability that the first trial will be a failure is 1-p. The only way for the first success to be on the second trial is for the first trial to be a failure and the second to be a success; this happens with probability (1-p)p. In fact, the only way for the first success to be on the nth trial is for all the preceeding n-1 trials to be failures and the nth to be a success; this happens with probability (1-p)n-1. So this is in fact the probability that T equals any particular value n. This probability distribution is called the geometric distribution.
The mean of the geometric distribution with success probability is 1/p. If you have a ten percent chance of success on each trial, on average it will take ten trials before the first success is seen.
Computer exercise The command dgeom(x,prob=p) gives you the probability that there will be x failures before the first success; the success probability is p. Having x failures before the first success means that the first success would happen on the x+1st trial.
What is the chance that the success happens on the very first trial, if p is 0.5?
> dgeom(0,prob=0.5)
What is the chance that the success happens on the third trial, when the success probability is 1/6?
> dgeom(2,prob=1/6)
You can use rgeom to do a random experiment. Suppose the success probability is 0.1. Simulate 1000 experiments: > z <- rgeom(1000,prob=0.1)
> mean(z)

On to transformed random variables.