# 3.3: Geometric Distribution (Special Topic)

How long should we expect to flip a coin until it turns up heads? Or how many times should we expect to roll a die until we get a 1? These questions can be answered using the geometric distribution. We first formalize each trial - such as a single coin flip or die toss - using the Bernoulli distribution, and then we combine these with our tools from probability (Chapter 2) to construct the geometric distribution.

### Bernoulli Distribution

Stanley Milgram began a series of experiments in 1963 to estimate what proportion of people would willingly obey an authority and give severe shocks to a stranger. Milgram found that about 65% of people would obey the authority and give such shocks. Over the years, additional research suggested this number is approximately consistent across communities and time. (Find further information on Milgram's experiment at www.cnr.berkeley.edu/ucce50/ag-labor/7article/article35.htm.)

Each person in Milgram's experiment can be thought of as a **trial**. We label a person a **success** if she refuses to administer the worst shock. A person is labeled a failure if she administers the worst shock. Because only 35% of individuals refused to administer the most severe shock, we denote the **probability of a success **with p = 0:35. The probability of a failure is sometimes denoted with q = 1 - p.

Thus, success or failure is recorded for each person in the study. When an individual trial only has two possible outcomes, it is called a **Bernoulli random variable**.

Bernoulli random variable, descriptive

A Bernoulli random variable has exactly two possible outcomes. We typically label one of these outcomes a "success" and the other outcome a "failure". We may also denote a success by 1 and a failure by 0.

TIP: "success" need not be something positive

We chose to label a person who refuses to administer the worst shock a "success" and all others as "failures". However, we could just as easily have reversed these labels. The mathematical framework we will build does not depend on which outcome is labeled a success and which a failure, as long as we are consistent.

Bernoulli random variables are often denoted as 1 for a success and 0 for a failure. In addition to being convenient in entering data, it is also mathematically handy. Suppose we observe ten trials:

\[0 1 1 1 1 0 1 1 0 0\]

Then the **sample proportion**, \( \hat {p}\), is the sample mean of these observations:

\[ \hat {p} = \frac {\text {# of successes}}{\text {# of trials}} = \frac {0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0}{10} = 0.6\]

This mathematical inquiry of Bernoulli random variables can be extended even further. Because 0 and 1 are numerical outcomes, we can define the mean and standard deviation of a Bernoulli random variable:

p is the true probability of a success, then the mean of a Bernoulli random variable X is given by

\[\mu = E[X] = P(X = 0) 0 + P(X = 1) 1\]

\[= (1 - p) X 0 + p X 1 = 0 + p = p\]

Similarly, the variance of \(X\) can be computed:

\[ \sigma^2 = P(X = 0)(0 - p)^2 + P(X = 1)(1 - p)^2\]

\[= (1 - p)p^2 + p(1- p)^2 = p(1- p)\]

The standard deviation is \(\sigma = \sqrt {p(1 - p)}\)

Bernoulli random variable, mathematical

If X is a random variable that takes value 1 with probability of success p and 0 with probability 1 - p, then X is a Bernoulli random variable with mean and standard deviation

\[ \mu = p \sigma = \sqrt {p(1-p)}\]

In general, it is useful to think about a Bernoulli random variable as a random process with only two outcomes: a success or failure. Then we build our mathematical framework using the numerical labels 1 and 0 for successes and failures, respectively.

### Geometric Distribution

Example \(\PageIndex{1}\)

Dr. Smith wants to repeat Milgram's experiments, but she only wants to sample people until she finds someone who will not inflict the worst shock. (This is hypothetical since, in reality, this sort of study probably would not be permitted any longer under current ethical standards). If the probability a person will not give the most severe shock is still 0.35 and the subjects are independent, what are the chances that she will stop the study after the first person? The second person? The third? What about if it takes her n - 1 individuals who will administer the worst shock before finding her first success, i.e. the first success is on the n^{th} person? (If the first success is the fifth person, then we say n = 5.)

The probability of stopping after the first person is just the chance the first person will not administer the worst shock: 1 - 0:65 = 0:35. The probability it will be the second person is

\[ P(\text{second person is the first to not administer the worst shock})\]

\[= P(\text{the first will, the second won't}) = (0:65)(0:35) = 0:228\]

Likewise, the probability it will be the third person is (0:65)(0:65)(0:35) = 0:148.

If the first success is on the nth person, then there are \(n - 1\) failures and finally 1 success, which corresponds to the probability \((0.65)^{n-1}(0:35)\). This is the same as \((1 - 0:35)^{n-1}(0:35)\).

*Figure 3.16 The geometric distribution when the probability of success is p = 0:35.*

Example 3.29 illustrates what is called the geometric distribution, which describes the waiting time until a success for **independent and identically distributed (iid) **Bernoulli random variables. In this case, the independence aspect just means the individuals in the example don't affect each other, and identical means they each have the same probability of success.

The geometric distribution from Example 3.29 is shown in Figure 3.16. In general, the probabilities for a geometric distribution decrease **exponentially** fast.

While this text will not derive the formulas for the mean (expected) number of trials needed to find the first success or the standard deviation or variance of this distribution, we present general formulas for each.

Geometric Distribution

If the probability of a success in one trial is \(p\) and the probability of a failure is \(1 - p\), then the probability of finding the first success in the n^{th} trial is given by

\[(1 - p)_{n-1}p \label{3.30}\]

The mean (i.e. expected value), variance, and standard deviation of this wait time are given by

\[ \mu = \frac {1}{7} {\sigma}^2 = \frac {1 - p}{p^2} \sigma = \sqrt {1 - p}{p^2} \label {3.31}\]

It is no accident that we use the symbol \(\mu\) for both the mean and expected value. The mean and the expected value are one and the same.

The left side of Equation \ref{3.31} says that, on average, it takes \(\frac {1}{p}\) trials to get a success. This mathematical result is consistent with what we would expect intuitively. If the probability of a success is high (e.g. 0.8), then we don't usually wait very long for a success: \(\frac {1}{0.8} = 1.25\) trials on average. If the probability of a success is low (e.g. 0.1), then we would expect to view many trials before we see a success: \( \frac {1}{0.1} = 10\) trials.

Exercise \(\PageIndex{1}\)

The probability that an individual would refuse to administer the worst shock is said to be about 0.35. If we were to examine individuals until we found one that did not administer the shock, how many people should we expect to check? The first expression in Equation \ref{3.31} may be useful.

**Solution**

We would expect to see about 1=0:35 = 2:86 individuals to find the first success.

Example \(\PageIndex{1}\)

What is the chance that Dr. Smith will find the first success within the first 4 people?

This is the chance it is the first (n = 1), second (n = 2), third (n = 3), or fourth (n = 4) person as the first success, which are four disjoint outcomes. Because the individuals in the sample are randomly sampled from a large population, they are independent. We compute the probability of each case and add the separate results:

\[P(n = 1, 2, 3, or 4)\]

\[= P(n = 1) + P(n = 2) + P(n = 3) + P(n = 4)\]

\[= (0:65)^{1-1}(0:35) + (0:65)^{2-1}(0:35) + (0:65)^{3-1}(0:35) + (0:65)^{4-1}(0:35)\]

\[= 0:82\]

There is an 82% chance that she will end the study within 4 people.

Exercise \(\PageIndex{1}\)

Determine a more clever way to solve Example 3.33. Show that you get the same result.

**Solution**

First find the probability of the complement: P(no success in first 4 trials) = \(0.65^4\) = 0.18. Next, compute one minus this probability: 1 - P(no success in 4 trials) = 1 - 0.18 = 0.82.

Example \(\PageIndex{1}\)

Suppose in one region it was found that the proportion of people who would administer the worst shock was "only" 55%. If people were randomly selected from this region, what is the expected number of people who must be checked before one was found that would be deemed a success? What is the standard deviation of this waiting time?

**Solution**

A success is when someone will **not** inflict the worst shock, which has probability p = 1 - 0.55 = 0.45 for this region. The expected number of people to be checked is \(\frac {1}{p} = \frac {1}{0.45} = 2.22\) and the standard deviation is \( \sqrt {\frac {(1 - p)}{p^2}} = 1.65\).

Exercise \(\PageIndex{1}\)

Using the results from Example 3.35, \( \mu \) = 2.22 and \( \mu \) = 1.65, would it be appropriate to use the normal model to find what proportion of experiments would end in 3 or fewer trials?

**Solution**

No. The geometric distribution is always right skewed and can never be well-approximated by the normal model.

The independence assumption is crucial to the geometric distribution's accurate description of a scenario. Mathematically, we can see that to construct the probability of the success on the nth trial, we had to use the Multiplication Rule for Independent Processes. It is no simple task to generalize the geometric model for dependent trials.

### Contributors

- David M Diez (Google/YouTube)
- Christopher D Barr (Harvard School of Public Health)
- Mine Çetinkaya-Rundel (Duke University)