[1] 0.03125
Consider an experiment where each trial has two possible outcomes, say success (\(s\)) or failure (\(f\)) and the trials are independent. Moreover, suppose the probability of success for each trial is \(p\) (so the probability of failure is \(q = 1 - p\)).
Let \(X\) = number of trials needed until the first success is observed. We say that this random variable has a Geometric distribution with parameter \(p\), denoted by \(X\)~Geometric(p).
It’s clear that \(P(X = 1) = p\), \(P(X = 2) = qp\), \(P(X = 3) = q^2p\), …, and in general \(P(X = x) = q^{x-1}p\) for \(x = 1,2,3, ...\)
Thus, the pmf of a Geometric(p) random variable X is given by \(f(x) = P(X = x) = q^{x-1}p\).
This can be used to find the probability that the first success will occur on any given trial.
If a fair coin is tossed repeatedly, what is the probability that the first heads will occur on the 5th toss?
Solution:
Let X = number of tosses needed until the first heads occur. Then since the coin is fair, p = P(success) = P(heads occur) = 0.5 so X~Geometric(0.5).
P(first heads will occur on the 5th toss) = \(P(X = 5) = f(5) = .5^{5-1}.5 = .5^5 = 0.03125\)
A basketball player can make a free throw shot 60% of the time. What is the probability that he makes his first free throw shot on his 2nd attempt?
Solution:
Let X = the number of attempts until the player makes his first free throw shot. Then X~Geometric(0.60) since p = P(success) = P(he makes a free throw shot) = 0.60.
\(P(X = 2) = 0.4^{2-1}0.60 = (0.4)(.6) = 0.24\)
The cumulative distribution function or cdf \(F\) of a Geometric(p) random variable can be obtained as follows:
For \(x = 1, 2,3, ...\),
\[F(x) = P(X \le x ) = \sum_{k=1}^x f(k) = \sum_{k=1}^x q^{k-1}p = p \sum_{k=1}^x q^{k-1} \] \[= p (1 + q + q^2 + q^3 + ... q^{x-1}) = p \frac{1-q^x}{1-q} = 1- q^x\]
What is the probability that the first heads will occur after the 3rd toss when a fair coin is flipped repeatedly?
Solution:
Let X = the toss where the first heads occur. Then X~Geometric(.5).
P(first heads will occur after the 3rd toss)= \(P(X > 3)\) \[= 1- P(X \le 2)\] \[= 1- F(2) = 1 - (1 - .5^2) = .25\]
In manufacturing, acceptance sampling is done to evaluate the quality of a product. Several units of the product are inspected for defects. If the probability of a defective unit is .05, what is the probability that the first defective unit inspected will be the 4th, 5th or 6th unit?
Solution:
Let X = number of units inspected until the first defective item is found. Then X~Geometric(.05).
\[P(X = 4,5,6) = P(X \le 6) - P(X \le 3) = F(6)-F(3)\] \[= (1-.95^6)-(1-.95^3) = 0.1223\]
If X ~Geometric(p) then its mean is given by \(\mathbb{E}(X) = \mu_X = 1/p\)
Proof:
The sum of an infinite geometric series with first term \(a\) and common ratio \(r\) (where \(|r| \le 1\)) is given by \(a \sum_{k=0}^\infty r^k = \frac{a}{1-r}\).
Differentiating both sides with respect to r, we get
\(a \sum_{k=0}^\infty k r^{k-1} = \frac{a}{(1-r)^2}\) which implies
\(\sum_{k=1}^\infty k r^{k-1} = \frac{1}{(1-r)^2}\)
Now, \[\mathbb{E}(X) = \sum_{x=1}^\infty x f(x) = \sum_{x=1}^\infty x q^{x-1}p\]
\[= p\sum_{x=1}^\infty x q^{x-1} = p \frac{1}{(1-q)^2} = 1/p\]
If X~Geometric(p) then \(Var(X) = \sigma^2_X = \frac{q}{p^2}\)
Proof:
We’ll use the fact that \(Var(X) = \mathbb{E}(X^2)-(\mathbb{E}(X))^2\) and \(\mathbb{E}(X^2)= \mathbb{E}(X(X-1))+\mathbb{E}(X)\) and \(\mathbb{E}(X) = 1/p\)
\[\mathbb{E}(X(X-1)) = \sum_{x=1}^\infty x(x-1)f(x) = \sum_{x=2}^\infty x(x-1)f(x)\]
\[\mathbb{E}(X(X-1)) = \sum_{x=1}^{\infty} x(x-1) \cdot q^{x-1}p = pq \sum_{x=2}^{\infty} x(x-1) q^{x-2}\]
\[\sum_{x=2}^{\infty} x(x-1) q^{x-2} = \frac{d^2}{dq^2} \left( \sum_{x=0}^{\infty} q^x \right) = \frac{d^2}{dq^2} \left( \frac{1}{1-q} \right)\] Taking the second derivative: \[\frac{d}{dq} \left( \frac{1}{(1-q)^2} \right) = \frac{2}{(1-q)^3} = \frac{2}{p^3}\]
\[\mathbb{E}(X(X-1)) = pq \cdot \frac{2}{p^3} = \frac{2q}{p^2}\] Thus \[\mathbb{E}(X^2)= \mathbb{E}(X(X-1))+\mathbb{E}(X) = \frac{2q}{p^2} + \frac{1}{p}\]
\[Var(X) = \mathbb{E}(X^2)-(\mathbb{E}(X))^2 = \frac{2q}{p^2} +\frac{1}{p} -(\frac{1}{p})^2\] \[= \frac{2q + p -1}{p^2} = \frac{q + q + p - 1}{p^2}= \frac{q}{p^2}\]
What is the expected number of flips until the first heads is observed when a fair coin is flipped repeatedly?
Solution:
Let X = number of flips needed until the first heads occur. Then X~Geometric(0.5) and \(\mathbb{E}(X) = 1/0.5 = 2\).
Note that \(Var(X) = \frac{0.5}{0.5^2}=2\)
The probability mass function \(f(x) = q^{x-1}p\) for x = 1, 2, 3, … is calculated in R using the R function dgeom(x-1,p). In Example 1, we calculated f(5) when p=0.5 and we got 0.03125. Alternatively, we can calculate this in R as follows:
Note that to calculate f(x), we need to put x-1 in dgeom because R is treating X as the number of failures needed before the first success. We only need to do this adjustment for the Geometric distribution.
The cdf \(F(x) = 1 - q^x\) when \(x = 1,2,3, ...\) can be calculated in R using the pgeom(x,p) function.
In Example 4 we calculated F(6)-F(3) when p = .05 and got 0.1223.
Alternatively, we can calculate this in R as follows:
The \(u^{th}\) quantile of a random variable X is the smallest value k that satisfies \(F(k) = P(X \le k)\ge u/100\).
If the random variable X has a Geometric(p) distribution, its \(u^{th}\) quantile can be calculated using qgeom(u/100,p).
As an example, if X~Geometric(0.60) as in Example 2, the 90th quantile or 90th percentile is calculated in R as follows:
Thus the smallest number of attempts so that the probability is at least 90% that the player makes his first shot is 3 (don’t forget to adjust by adding 1 to the quantile). To verify this, we calculate the following probabilities:
To generate values of a Geometric(p) random variable in R, we use the rgeom(n,p) where \(n\) is the number of values we want to randomly generate and \(p\) is the success probability.
As an example, let’s simulate 100 basketball players attempting free throws repeatedly until each of them make their first shot if each of the players has a 60% probability of making a free throw shot.
The following code will simulate this:
We can plot the pmf for this Geometric random variable.
Note that the mean of x is
which is not too far from the theoretical mean of
Similarly, the variance of x is
which is not too far from the theoretical variance of
If the number of players in this simulation is increased, the simulated mean and variance will be even closer to their theoretical values.
If X~Geometric(p) then \(P(X = x + n|X > n) = P(X = x)\)
Proof:
\[P(X = x + n|X > n) = \frac{P(X = x+n \cap X >n)}{P(X > n)}\] \[ = \frac{P(X = x+n)}{P(X > n)} = \frac{q^{x+n-1}p}{q^n}\] \[=q^{x-1}p = P(X =x)\]
Given that the first free throw a player with a 60% shooting percentage is after his 3rd attempt, find the probability that he’ll make his first free throw in his 4th attempt?
Solution:
Let X = the number of attempts until the player makes his first free throw shot. Then X~Geometric(0.60) and
\[P(X = 4|X > 3) = P(X = 3 + 1|P(X > 3)) = P(X = 1)\] \[= f(1) = (.4^0)(.6) = .6\]