On this page
8.5 Discrete Probabilistic Models
Next we will see the main discrete probabilistic models, some of which have already been used in previous sections. The main models are: discrete uniform, Bernoulli, binomial, geometric, Poisson and Hypergeometric. Each of them will be analyzed individually.
The subjects covered below can be found in more detail in the book by Barry R. James and Murray R. Spiegel.
8.5.1 Binomial distribution
To build the binomial model we will introduce a sequence of Bernoulli tests. Such a sequence is defined through the following conditions:
- In each test, only the occurrence or non-occurrence of a certain event is considered, which will be called success (S) and whose non-occurrence will be called failure (F).
- The tests are independent.
- The probability of success, which we will denote by p, is the same for each trial. The probability of failure will be denoted by 1-p.
For an experiment that consists of carrying out $ n $ Independent Bernoulli trials, the sample space can be considered as the set of n-tuples, in which each position there is a success (S) or a failure (F).
The probability of a sample point with successes in $ k $ first tests and failures in $ n-k $ following tests is $ p^k(1-p)^{n-k}. $
Note that this is the probability of any point with $ k $ successes and $ n-k $ failures. The number of points in the sample space that satisfy this condition is equal to the number of ways we can choose $ k $ tests for the occurrence of success among the total number of $ n $ tests, as we $ n-k $ remaining failures will occur. This number is equal to the number of combinations of $ n $ elements taken $ k $ to $ k $, that is,

Definition 5.1.1
Be $ X $ the number of successes obtained in carrying out $ n $ independent Bernoulli trials. We will say that $ X $ has binomial distribution with parameters $ n $ and $ p $, in which $ p $ is the probability of success on each trial, if its probability function is given by

We will use the notation $ X \sim b(n,p) $.
Example 5.1.1
Suppose that in a production line the probability of obtaining a defective part (success) is $ p = 0,1 $. A sample of 10 pieces is taken to be inspected. What is the probability of obtaining:
-
A defective part?
-
No defective parts?
-
Two defective parts?
-
At least two defective parts?
-
At most two defective parts?
Solution

- $ \mathbb{P}(X\geq 2)=\mathbb{P}(X=2)+\mathbb{P}(X=3)+\ldots+\mathbb{P}(X=9)+\mathbb{P}(X=10) $.
i.e. $ \mathbb{P}(X\geq 2)=1-[\mathbb{P}(X=0)+\mathbb{P}(X=1)]=0,2639 $.
- $ \mathbb{P}(X\leq 2)=\mathbb{P}(X=0)+\mathbb{P}(X=1)+\mathbb{P}(X=2)=0,9298 $.
Example 5.1.2
Suppose a student wants to take a multiple choice test with 10 questions and five alternatives per question by answering each question randomly. What is the probability of him getting at most 3 questions correct?
As each question presents five alternatives and the student intends to answer them at random, we have the probability of success in each question, that is, the probability of choosing the correct alternative is 1/5. In this way, we can define the following random variables with Bernoulli distribution

We have to, for all $ i $, the probability of success is $ p=0,2 $ (since we have 5 alternatives available). This way, $ \mathbb{P}(X_i = 1) = 0,2 $. If we define $ X $ as the random variable that assumes the total number of correct answers in the test, we have
$$X = \sum_{i=1}^{10}X_i\sim b(10;0,2),$$
that is, $ X $ has binomial distribution with parameters $ n = 10 $ and $ p = 0,2 $. As we want to know the probability of the student getting a maximum of 3 questions correct, we want to find the value of $ \mathbb{P}(X\leq 3) $. So
$$\mathbb{P}(X\leq 3)=\mathbb{P}(X=0)+\mathbb{P}(X=1)+\mathbb{P}(X=2)+\mathbb{P}(X=3).$$
Therefore
$$P(X\leq 3)=\sum_{i=0}^{3} \left( \begin{array}{c} 10\ i \end{array} \right) (0,2)^i (1-0,2)^{10-i}\thickapprox 0,879.$$
Therefore, the probability that the student gets a maximum of 3 questions correct is approximately 0.879.
Example 5.1.3
An unbiased coin is tossed multiple times. What is the probability that we get 5 heads before we get 3 tails?
Let’s consider success as getting heads on each coin toss. This way we want to get 5 successes before getting 3 failures. But this is only possible if we flip the coin at least 5 times and a maximum of 7 times, because in less than 5 flips it is not possible to get 5 heads and in 8 flips or more, we must have already gotten 5 heads, otherwise we will have gotten 3 tails, or more, which is not the intention.
Consider random variables $ X_i\sim b(i,0,5) $, defined as the number of successes obtained in $ i $ coin flips with $ i = 5,6,7 $. Therefore, we need to calculate $ \mathbb{P}(X_i=5) $ for each $ i $.
Therefore, the probability of getting 5 heads before 3 tails is:
$$\mathbb{P}(X_5 =5)+\mathbb{P}(X_6=5)+\mathbb{P}(X_7=5)= \sum_{i=5}^7\left(\begin{array}{c} i\ 5 \end{array} \right) (1/2)^5 (1-1/2)^{i-5}\thickapprox 0,23.$$
Example 5.1.4
(Banach’s matchbox problem) Suppose a man always carries two matchboxes with $ n $ sticks each. Also suppose that every time he needs to use a match he picks it up randomly from any of the boxes. As he is a distracted person when he takes the last matchstick from the matchbox he doesn’t remember to throw it away. What is the probability that when he realizes that one of the boxes is empty the other contains exactly $ k $ matches?
To make solving the problem easier, we will number the matchboxes. Let us first calculate the probability that, when the man realizes that matchbox number 1 is empty, matchbox number 2 contains exactly $ k $ sticks. Let us consider the removal of a toothpick from box number 1 as success.
Be $ A $ the event “Take a match from box number 1, but box 1 is empty and box number 2 contains exactly $ k $ matches. The event $ A $ occurs if, and only if, the $ n+1 $-th success, occurs when removing a number $ n+1+n-k $.
In other words, for the event $ A $ occurs, it is necessary that $ n+1 $ times that we are successful, that is, that we take matches from box 1, we have already carried out $ n+1+n-k $ experiments. With this in mind, we conclude that there must be n successes in the first 2n-k trials, and there must be successes the next time.
So

Generating Function of Moments, Expected Value and Variance
Be $ X $ a random variable with Binomial distribution$ (n,p) $. Then the moment generating function $ X $, $ M_X(t) $ is given by

where, in the last equality, we use Newton’s binomial formula. We can find the mean and variance of $ X $ through the moment generating function. So
$$M^\prime_X(t)= \frac{d}{dt}(p e^t+ 1-p)^n=n(pe^t+1-p)^{n-1}pe^t$$
and, how $ \mathbb{E}(X)=M^\prime_X(0) $, it follows that $ \mathbb{E}(X)=n(p+1-p)^{n-1}p=np $.
To find the variance, we just need to differentiate the function once again $ M_X(t) $.
So we have to:
$$M^{\prime\prime}_X(t)=\frac{d^2}{dt^2}(p e^t+ 1-p)^n=n(n-1)(pe^t+1-p)^{n-2}(pe^t)^2+npe^t (pe^t+1-p)^{n-1}.$$
And therefore we obtain that $ \mathbb{E}(X^2)=M^{\prime\prime}_X(0)=n(n-1)p^2+ pn $. In this way, $ \text{Var}(X) $ can be calculated by
$$\text{Var}(X)=\mathbb{E}(X^2)-\mathbb{E}^2(X)=[n(n-1)p^2+pn] -(np)^2=n^2p^2-np^2+np-n^2p^2=np(1-p).$$
Therefore, the expected value represents the average number of successes. By definition, we have to

The variance $ \text{Var}(X) $ is given by
$$\text{Var}(X)=\mathbb{E}\left(\left(X-\mathbb{E}(X)\right)^2\right)=\mathbb{E}(X^2)-\left(\mathbb{E}(X)\right)^2=np(1-p).$$
8.5.2 Poisson Distribution
In many situations we are faced with the situation where the number of tests $ n $ It’s big ($ n\rightarrow \infty $) and $ p $ is small ($ p\rightarrow 0 $), in the calculation of the binomial function, which leads us to some difficulties, because, as we can analyze, for $ n $ very big and $ p $ small, it is relatively difficult to calculate the probability of $ k $ successes from the binomial model, that is, using the probability function

We note that we can rewrite the above expression as follows
$$\mathbb{P}(X=k)=\frac{n!}{k!(n-k)!}p^k\frac{n^k}{n^k}\left(1-\frac{np}{n}\right)^{n-k}=\frac{n!}{k!(n-k)!}\frac{(np)^k}{n^k}\left(1-\frac{np}{n}\right)^{n-k}$$
and, taking $ \lambda = np $, it follows that
$$\mathbb{P}(X = k)=\frac{n(n-1)\cdots(n-k+1)}{k!}\frac{\lambda^k}{n^k}\left(1-\frac{\lambda}{n}\right)^{n-k}=\frac{\lambda^k}{k!}1\left(1-\frac{1}{n}\right)\dots\left(1-\frac{k-1}{n}\right)\left(1-\frac{\lambda}{n}\right)^{n-k}.$$
If we take the limit when $ n\rightarrow \infty $, we obtain that
$$\lim_{n\rightarrow \infty}1\left(1-\frac{1}{n}\right)\dots\left(1-\frac{k-1}{n}\right)=1$$
and
$$\lim_{n\rightarrow \infty}\left(1-\frac{\lambda}{n}\right)^{n-k}=\lim_{n\rightarrow \infty}\left(1-\frac{\lambda}{n}\right)^{n}=e^{-\lambda}$$
for $ k = 0,1,\ldots $ and $ e\approx 2,718 $.
So we have to
$$\lim_{n\rightarrow \infty}\mathbb{P}(X=k)=\frac{e^{-\lambda}\lambda^k}{k!}.$$
This expression is due to Poisson and is widely used to calculate probabilities of occurrences of “rare” defects in systems and components.
Definition 5.2.1
A discrete random variable $ X $ follows the Poisson distribution with parameter $ \lambda $, $ \lambda \ > 0 $, if its probability function is given by
$$\mathbb{P}(X=k)=\frac{e^{-\lambda}\lambda^k}{k!}.$$
We use the notation $ X \sim \ \text{Poisson}(\lambda) $ or $ X\sim \ \text{Po}(\lambda) $. The parameter $ \lambda $ indicates the occurrence rate per unit measurement.
Example 5.2.1
Consider a process that has a rate of $ 0,2 $ defects per unit. What is the probability of any unit having:
a) two defects?
b) a defect?
c) zero defects?
Solution
In this case, we have to $ X \sim \ \text{Poisson}(\lambda) $ with $ \lambda=0,2 $. So
a) $ \displaystyle\mathbb{P}(X=2)=\frac{e^{-0,2}(0,2)^2}{2!}=0,0164 $;
b. $ \displaystyle\mathbb{P}(X=1)=\frac{e^{-0,2}(0,2)^1}{1!}=0,1637 $;
w. $ \displaystyle\mathbb{P}(X=0)=\frac{e^{-0,2}(0,2)^0}{0!}=0,8187 $.
Example 5.2.2
Suppose that a paint application to a car is done mechanically, and can produce manufacturing defects, such as bubbles or poorly painted areas, according to a random variable $ X $ which follows a parameter Poisson distribution $ \lambda=1 $. Suppose we randomly select a car for its paintwork to be inspected, what is the probability of finding at least $ 1 $ defect? And what is the probability of finding $ 2 $ to $ 4 $ defects?
The probability of finding at least one defect is given by:
$$\mathbb{P}(X\geq 1)=1-\mathbb{P}(X< 1)=1-\frac{e^{-1}1^0}{0!}=1-e^{-1}\approx 0,63212.$$
The probability of finding between 2 and 4 defects is
$$\mathbb{P}(2\leq X\leq 4)=\mathbb{P}(X=2)+\mathbb{P}(X=3)+\mathbb{P}(X=4)=\frac{e^{-1}1^2}{2!}+\frac{e^{-1}1^3}{3!}+\frac{e^{-1}1^4}{4!}\approx 0,26058.$$
Example 5.2.3
Suppose that 10% of children in a certain neighborhood in Rio de Janeiro prefer vanilla ice cream to chocolate. What is the probability that if we interview $ 10 $ children from this neighborhood, exactly $ 2 $ Do you two prefer vanilla ice cream?
We can solve this problem in two ways. The first is from the use of the binomial distribution with parameters $ n=10 $ and $ p=0,1 $. The second, through the Poisson distribution of parameter $ \lambda = np = 1 $ which, although not as exact as the binomial, is much simpler to calculate. Let us first calculate using the binomial distribution.

Using the Poisson method, we have
$$\mathbb{P}(X=2)=\frac{e^{-1}}{2!}\approx 0,184.$$
Although using the Poisson method we have an error associated with the approximation of the binomial distribution (which is the exact distribution), this error, in many cases, is not significant.
Example 5.2.4
Suppose that in a pharmaceutical industry 0.001% of a certain medicine leaves the production line with only the excipient, that is, without any active ingredient. What is the probability that in a sample of 4 thousand medicines more than 2 of them contain only the excipient?
Let’s calculate this probability using the Poisson approximation, as in addition to being a very good approximation in this case, it is much easier to calculate.
To use the Poisson distribution, we must first find the $ \lambda $, which is given by $ \lambda=n\times p=4000\times 0,00001=0,04 $. So
$$\mathbb{P}(X\geq 2)=1-\mathbb{P}(X=0)-\mathbb{P}(X=1)=1-\displaystyle \frac{0,04^0e^{-0,04}}{0!}-\frac{0,04^1 e^{-0,04}}{1!}\approx 1-0,999221\approx 0,00078.$$
Therefore, the probability that there are more than 2 medicines with just the excipient is 0.078%.
Generating Function of Moments, Expected Value and Variance
Be $ X $ a discrete random variable with Poisson distribution, with parameter $ \lambda $, that is, $ X\sim \ \text{Poisson}(\lambda) $. Then its moment generating function is given by:
$$M_{X}(t)=\mathbb{E}[e^{tX}]=\sum_{k=0}^{\infty}\frac{e^{tk}e^{\lambda}\lambda^k}{k!}=e^{-\lambda}\sum_{k=0}^{\infty}\frac{(\lambda e^t)^k}{k!}=e^{-\lambda}e^{\lambda e^t}=e^{\lambda[e^t-1]}.$$
The expected value of $ X $, which is often called the defect rate, is given by:
$$\mathbb{E}(X)=\sum_{k=0}^\infty k\frac{e^{-\lambda}\lambda^k}{k!}=\sum_{k=1}^{\infty}\lambda \left[\frac{e^{-\lambda}\lambda^{k-1}}{(k-1)!}\right]=\lambda e^{-\lambda}\sum_{k=1}^{\infty}\left[\frac{\lambda^{k-1}}{(k-1)!}\right]=\lambda e^{-\lambda}\sum_{k=0}^{\infty}\left[\frac{\lambda^k}{k!}\right] = \lambda e^{-\lambda}e^{\lambda}=\lambda.$$
Another way to calculate the waiting value is using the moment generating function, as $ M^\prime(0)=\mathbb{E}(X) $. This way we have to:
$$M^\prime(t)=\frac{d}{dt}\exp(\lambda(\exp(t)-1))=\lambda \exp(\lambda(e^t - 1)+t)$$
and then,
$$\mathbb{E}(X) = M^\prime(0)=\lambda \exp(1-1+0)=\lambda.$$
In the same way as done for hope, we will use the moment generating function to calculate the variance, as we have to $ \mathbb{E}[X^2]=M^{\prime\prime}(0) $. So
$$M^{\prime\prime}(t)=\lambda(e^{\lambda(e^t - 1)+t}(\lambda e^t +1))$$
and then,
$$\mathbb{E}(X^2) = M^{\prime\prime}(0)=\lambda(\lambda+1)$$
whence it follows that
$$\text{Var}(X)=\mathbb{E}(X^2)-(\mathbb{E}(X))^2=\lambda(\lambda+1)-\lambda^2=\lambda.$$
8.5.3 Geometric distribution
Let us consider an unlimited sequence of Bernoulli trials, with probability of success p in each trial. Let us designate success by $ S $ and fails for $ F $. We carry out the tests until the first success occurs.
The sample space for this experiment is the set $ (S, FS, FFS, FFFS,\ldots) $.
In other words, a typical element of this sample space is a sequence of $ n $ in which we $ n-1 $ first rehearsals we have $ F $ and in $ n $-th we have S.
The geometric distribution presents two important parameterizations, which have different interpretations. One of the parameterizations of the geometric function counts the number of failures until the first success occurs. Note that in this parameterization we can include zero as a possible result, as we can be successful in the first Bernoulli test.
The second geometric parameterization counts the number of Bernoulli tests necessary to obtain a success. So in this parameterization it is not possible to have zero, therefore in this geometric parameterization the domain will be the natural numbers without zero.
Geometric (counts the number of failures until success.)
Definition 5.3.1
Be $ X $ the random variable that gives the number of failures to the first success. The variable $ X $ has a geometric distribution with parameter $ p $, $ 0 \ < \ p \ < \ 1 $, if its probability function is given by
$$\mathbb{P}\left(X=j\right)=(1-p)^jp, \quad j=0,1,\ldots$$
We will use the notation $ X \sim \ \text{Geo}(p) $.
The event $ [X=j] $ occurs if, and only if, only failures occur in the $ j $ first trials and success in $ (j+1) $-th test.
The geometric distribution has a property that serves to characterize it in the set of discrete distributions:
Property 5.3.1
Se $ X $ is a discrete random variable with geometric distribution, so, for all $ j,k = 1,2,\ldots $ we have to:
$$\mathbb{P}\left(X> t+s|X\geq s\right)=\mathbb{P}\left(X> t\right).$$
This result reflects a lack of memory or wear of the geometric distribution.
Demo
In fact, we have to

whence it follows that
$$\mathbb{P}\left(X> t+s|X\geq s\right)=\frac{1-p\sum_{k=0}^{t+s}(1-p)^k}{1-p\sum_{j=0}^{s-1}(1-p)^j}=\frac{(1-p)^{t+s+1}}{(1-p)^{s}}=(1-p)^{t+1}=1-p\sum_{k=0}^{t}(1-p)^k$$
and therefore
$$\mathbb{P}\left(X> t+s|X\geq s\right)=\sum_{k=t+1}^{\infty}p(1-p)^k=\mathbb{P}\left(X> t\right).$$
Therefore, the geometric distribution presents the property of loss of momentum. It is worth noting that it is the only discrete distribution with this characteristic.
Property 5.3.2
Be $ h(k)=\displaystyle \frac{\mathbb{P}\left(X=k\right)}{\mathbb{P}\left(X\geq k\right)} $ show that if $ X\sim Geo(p) $ then h(k)=p
In fact,
$$h(k)=\frac{\mathbb{P}\left(X=k\right)}{\mathbb{P}\left(X\geq k\right)}=\frac{p(1-p)^k}{\sum_{j=k}^{\infty}p(1-p)^j}=\frac{p(1-p)^k}{1-\sum_{j=0}^{k-1}p(1-p)^j}=\frac{(1-p)^{k}p}{(1-p)^{k}}=p.$$
Note that h(k) is widely used in survival analysis and represents the risk function.
Example 5.3.1
Consider the experiment in which a biased coin is tossed successively until the first head comes up. Be $ X $ the random variable that counts the number of tails obtained in the experiment (that is, the number of tosses prior to obtaining the first head). Knowing that the probability of heads is $ 0,4 $, what is the probability of $ \mathbb{P}(2\leq X< 4) $ and the probability of $ \mathbb{P}(X> 1| X\leq 2) $.
We observe that
$$\mathbb{P}(2\leq X< 4)=\mathbb{P}(X=2)+\mathbb{P}(X=3)=0,6^2\cdot 0,4+0,6^3\cdot 0,4=0,2304.$$
Let’s calculate now $ \mathbb{P}(X> 1| X\leq 2) $.
$$\mathbb{P}(X> 1| X\leq 2)=\frac{\mathbb{P}(X> 1\cap X\leq 2)}{\mathbb{P}(X\leq2)}=\frac{\mathbb{P}(X=2)}{\mathbb{P}(X=0)+\mathbb{P}(X=1)+\mathbb{P}(X=2)}=\frac{0,144}{0,784}=0,18367.$$
Example 5.3.2
A researcher is carrying out independent chemical experiments and knows that the probability that each experiment will yield a positive reaction is $ 0,3 $. What is the probability that fewer than 5 negative reactions occur before the first positive one?
To solve this problem, consider $ X $ as the random variable that represents the number of negative reactions until the first positive one occurs. In this case, we have to $ X\sim \ \text{Geo}(0,3) $ and then
$$\mathbb{P}(X \ < \ 5) = \sum_{i=0}^4\mathbb{P}(X=i)=0,3+0,7\cdot 0,3 + 0,7^2\cdot 0,3 + 0,7^3\cdot 0,3 + 0,7^4\cdot 0,3 = 0,83193.$$
Example 5.3.3
Considering example 5.3.1, what is the probability that $ X\geq 1 $.
$$\mathbb{P}(X\geq 1)=1-\mathbb{P}(X< 1)=1-\mathbb{P}(X=0)=1-0,4=0,6.$$
Generating Function of Moments, Expected Value and Variance
Be $ X $ a discrete random variable with geometric distribution. Then the moment generating function is given by:
$$M_{X}(t)=\mathbb{E}\left(e^{tX}\right)=\sum_{k=0}^{\infty}e^{tk}(1-p)^{k}p=p\sum_{k=0}^{\infty}(e^{t})^{k}(1-p)^{k}=p\sum_{k=0}^{\infty}[e^{t}(1-p)]^{k} =\frac{p}{1-(1-p)e^t}.$$
In this way, the expected value of $ X $ is given by
$$\mathbb{E}(X)=\sum_{j=0}^\infty j(1-p)^jp=p\sum_{j=0}^\infty j(1-p)^j=p(1-p)\sum_{j=0}^\infty j(1-p)^{j-1}=\frac{p(1-p)}{p^2}.$$
i.e.
$$\mathbb{E}(X)=\frac{1-p}{p}.$$
We can calculate the expected value of $ X $ through the moment generating function, knowing that $ \mathbb{E}(X) = M^\prime(0) $. For this, we have to
$$M^\prime_X(t)=-\frac{(1-p)pe^t}{((p-1)e^t+1)^2}.$$
Thus the expected value is given by:
$$\mathbb{E}(X)=M^\prime_X(0)=-\frac{(p-1)pe^0}{((p-1)e^0+1)^2}=-\frac{(p-1)p}{((p-1)+1)^2}=-\frac{(p-1)p}{p^2}=\frac{(1-p)}{p}.$$
We can also use the moment generating function to calculate the variance of the variable $ X $, knowing that $ \mathbb{E}(X^2) = M^{\prime\prime}(0) $. For this, we have to
$$M^{\prime\prime}_X(t)=\frac{(p-1)pe^t((p-1)e^t -1)}{((p-1)e^t+1)^3}$$
and therefore
$$\mathbb{E}(X^2)=M^{\prime\prime}_X(0)=\frac{(p-1)p((p-1)-1)}{((p-1)+1)^3}=\frac{p(p-1)(p-2)}{p^3}=\frac{p^3-3p^2+2p}{p^3}$$
and the variance is given by
$$\text{Var}(X)=\mathbb{E}(X^2)-\mathbb{E}^2(X)=\frac{p^3-3p^2+2p}{p^3}-\frac{(1-p)^2}{p^2}=\frac{1-p}{p^2}.$$
Geometric (counts the number of trials to obtain a success.)
Definition 5.3.2
Be $ X $ the random variable that provides the number of Bernoulli trials carried out until the first success is obtained. The variable $ X $ has a geometric distribution with parameter $ p $, $ 0 \ < \ p \ < \ 1 $, if its probability function is given by
$$\mathbb{P}(X=j)=(1-p)^{j-1} p, \quad j=1,2,\ldots$$
We will use the notation $ \sim $ Geo(p).
Note 5.3.1
Note that, in this parameterization, the possible values assumed by the random variable $ X $ are $ \mathcal{R}_X = (1,2,\ldots) $ and that the probability of $ X $ be equal to the value $ k $ is equal to the probability of $ X $ be equal to $ k-1 $ in the previous parameterization.
Example 5.3.4
A fair die is rolled successively until face 1 appears for the first time. $ X $ the random variable that counts the number of trials until the first one runs $ 1 $. What is the probability of getting $ 1 $ on the third release.
As the die is fair, the probability of getting any face in a throw is equal to 1/6. In this case, the probability of obtaining the face $ 1 $ (success) is $ 1/6 $ and the probability of getting any other face (failure) is $ 5/6 $. We can define the random variable

In this case, $ Y\sim \ \text{Bernoulli}(1/6) $ and if we define $ X $ as the variable that represents the number of throws until the first success is obtained (appearance of face 1), we have $ X \sim \ \text{Geo}(1/6) $. Therefore, if we are interested in calculating the probability of obtaining $ 1 $ on the third throw, we need to calculate $ \mathbb{P}(X = 3) $, that is,
$$\mathbb{P}(X=3)=(1-p)^2p=\left(1-\frac{1}{6}\right)^2\frac{1}{6}=\left(\frac{5}{6}\right)^2\frac{1}{6}=\frac{5^2}{6^3}\approx 0,115741.$$
Example 5.3.5
A researcher is producing a new type of vaccine for use in humans. Through animal testing he came to the conclusion that this vaccine is likely to kill the user in 0.1% of cases. Due to the laws of the country where it will be applied, production of the vaccine must be suspended after the first death occurs.
If we accept the occurrence of the patient’s death as a success, then $ p=0,001 $. So, if $ X $ is the number of people who will take the vaccine until the first death occurs, we have to $ X $ has a geometric distribution with parameter $ p $, that is, $ X\sim \ \text{Geo}(0,001) $, and the probability that the first death occurs in the $ k $-th vaccination application is
$$\mathbb{P}(X=k)=0,001(1-0,001)^k-1.$$
Analyzing the function we can see that as the number of people who take the vaccine increases, the greater the chance that a person will die and production will be interrupted.
Example 5.3.6
Returning to Example 5.3.4, we will calculate $ \mathbb{P}\left(3 \leq X\leq 5\right) $.
$$\mathbb{P}\left(n\leq X \leq m\right)=\mathbb{P}\left(X\leq m\right)-\mathbb{P}\left(X \ < \ n\right)=\sum_{j=1}^{m}p(1-p)^{j-1}-\sum_{j=1}^{n-1}p(1-p)^{j-1}=\sum_{j=n}^{m}p(1-p)^{j-1}.$$
So
$$\mathbb{P}\left(3\leq X\leq 5\right)=\sum_{j=3}^{5}\frac{1}{6}(\frac{5}{6})^{j-1}=\frac{25}{216}+\frac{125}{1296}+\frac{625}{7776}\approx 0,29257.$$
Note that the two parameterizations are closely linked. In fact, suppose that $ Y $ be a geometric random variable with the previous parameterization and parameter $ p $, that is:
$$\mathbb{P}\left(Y=k\right)=p(1-p)^{k}$$
and suppose that $ X $ be a geometric distribution with the current parameterization and with the same parameter $ p $, that is:
$$\mathbb{P}\left(X=k\right)=p(1-p)^{k-1}.$$
So
$$\mathbb{P}\left(Y=k\right)=p(1-p)^{k}=p(1-p)^{(k+1)-1}=\mathbb{P}\left(X=k+1\right)$$
and therefore
$$\mathbb{P}\left(Y> m+n|Y\geq n\right)=\mathbb{P}\left(Y> m\right)=\mathbb{P}\left(X> m+1\right).$$
On the other hand
$$\mathbb{P}\left(Y> m+n|Y\geq n\right)=\frac{\mathbb{P}\left(Y > m+n\right)}{\mathbb{P}\left(Y\geq n\right)}=\frac{\mathbb{P}\left(X> m+n+1\right)}{\mathbb{P}\left(X\geq n+1\right)}=\mathbb{P}\left(X> m+1\right).$$
taking $ s = n+1 $, we have to:
$$\mathbb{P}\left(X> m+s|X\geq s\right)=\mathbb{P}\left(X> m+1\right).$$
Example 5.3.7
Be $ h(k)=\displaystyle \frac{\mathbb{P}\left(X=k\right)}{\mathbb{P}\left(X\geq k\right)} $. Show that if $ X\sim \ \text{Geo}(p) $ then $ h(k)=p $.
In fact,

whence it follows that
$$h(k)=\frac{p(1-p)^{k-1}}{1-\sum_{j=1}^{k-1}p(1-p)^j}=\frac{(1-p)^{k-1}p}{(1-p)^{k-1}}=p.$$
Generating Function of Moments, Expected Value and Variance
Be $ X $ a discrete random variable with geometric parameter distribution $ p $. Thus the moment generating function is given by
$$M_{X}(t)=\mathbb{E}[e^{tX}]=pe^{t}\sum_{k=0}^{\infty}(e^{t})^{k-1}(1-p)^{k-1}=pe^{t}\sum_{k=0}^{\infty}[e^{t}(1-p)]^{k-1}=\frac{p}{(1-p)}\sum^\infty_{k=0}[e^t(1-p)]^k=\frac{p}{(1-p)(1-(1-p)e^t)}.$$
Now let’s calculate the expected value.
$$\mathbb{E}(X)=\sum_{j=0}^\infty j(1-p)^{j-1}p=p\sum_{j=0}^\infty j(1-p)^{j-1}=\frac{p}{p^2}.$$
So, we have to
$$\mathbb{E}\left(X\right)=\frac{1}{p}.$$
Another way to calculate the expected value is using the moment generating function. This way
$$M^\prime_X(t)=\frac{pe^t}{((1-p)e^t+1)^2}.$$
How $ \mathbb{E}(X) = M^\prime_X(0 $, we have to
$$\mathbb{E}(X) = M^\prime_X(0)=\frac{p}{((p-1)+1)^2}=\frac{1}{p}.$$
We can also use the moment generating function to calculate the variance of this random variable, since $ \mathbb{E}(X^2) = M^{\prime\prime}_X(0) $. So
$$M_X^{\prime\prime}(t)=-\frac{pe^t((p-1)e^t-1)}{((p-1)e^t+1)^3}$$
and therefore
$$\mathbb{E}(X^2) = M_X^{\prime\prime}(0)=-\frac{p(p-2)}{p^3}=-\frac{(p-2)}{p^2}=\frac{2-p}{p^2}.$$
Therefore, the variance of $ X $ is given by

8.5.4 Hypergeometric distribution
Consider a population with $ N $ objects in which $ M $ are classified as type $ A $ and $ N-M $ are classified as type $ B $. For example, in a batch of $ 100 $ ($ N $) parts we have $ 10 $ ($ M $) defective parts and $ 90 $ ($ N-M $) compliant parts. We take a random, unreplaced and unordered sample of $ n $ objects. Be $ X $ the random variable that counts the number of objects classified as of the type $ A $ in the sample. Then the probability distribution of $ X $ is given by:

being $ k $ whole and $ \max(0,n-(N-M))\leq k \leq \min(M,n) $.
Definition 5.4.1
We will say that a random variable $ X $ has hypergeometric distribution of parameters $ M $, $ N $ and $ n $ if your probability function is given in the above way. We denote $ X \sim \ \text{Hgeo}(M,N,n) $
Example 5.4.1
Be $ X $ the random variable that follows the hypergeometric model with parameters $ N=10 $, $ M=5 $ and $ n=4 $. Determine the probability $ \mathbb{P}(X\leq 1) $.
To calculate the desired probability we need.

Example 5.4.2
A company manufactures a type of socket that are packaged in a batch of $ 25 $ units. To accept the batch sent by this factory, the company’s quality control took the following procedure: a batch was drawn and from that batch, $ 8 $ test sockets, without replacement. If a maximum of two defective sockets are found, the batch supplied by the factory will be accepted. If the lot drawn has $ 7 $ defective parts, what is the probability of accepting the lot?
We note here that the population size is the batch size, i.e. $ N=25 $, of which we have $ M = 7 $ defective and draw a sample size $ n=8 $. So be $ X $ the random variable that represents the number of defective parts found in the sample. This way $ X\sim \ \text{Hgeo}(7, 25, 8) $ and then, the probability of accepting the lot is equal to the probability that $ X $ is less than or equal to $ 2 $, that is,
$$\mathbb{P}\left(\hbox{aceitar o lote}\right)=\mathbb{P}[X\leq 2]=\mathbb{P}(X=0)+\mathbb{P}(X=1)+\mathbb{P}(X=2)$$
i.e.

Example 5.4.3
Suppose $ 3 $ commemorative coins were mistakenly placed in a piggy bank in which there were already some common coins, which ended up containing a total of $ 12 $ coins. Suppose that, due to the difficulty of taking the coins out of the piggy bank without breaking it, we are going to randomly remove a total of $ 4 $ coins, what is the probability of withdrawing at least $ 1 $ commemorative coin?
Let us observe that the hypergeometric model fits well to our problem with $ N=12 $, $ M=3 $ and $ n=4 $. Be $ X $ the random variable that counts the number of commemorative coins taken from the piggy bank.
So, we are interested in calculating $ \mathbb{P}(X\geq 1) $ which is given by

Example 5.4.4
An urn contains $ 10 $ balls, of which $ 6 $ are white and $ 4 $ black. Suppose tenths take away $ 5 $ balls in the urn, what is the probability that of the $ 5 $ balls removed $ 3 $ Are they white?
For this problem, we simply use the hypergeometric distribution, with $ M=6 $, $ k=3 $, $ N=10 $ and $ n=5 $.

Example 5.4.5
We will show that when the population is very large, the hypergeometric distribution converges to a binomial, that is, if $ X\sim \ \text{Hgeo}(M,N,n) $, then

whence it follows that
$$\mathbb{P}\left(X=k\right)=\frac{n!}{k!(n-k)!}\frac{M!}{(M-k)!}\frac{(N-M)!}{(N-M-n+k)!}\frac{(N-n)!}{N!}$$
so what

from which we can conclude that

Generating Function of Moments, Expected Value and Variance
The hypergeometric moment-generating function exists, but it is written depending on a function introduced by Gauss known as the hypergeometric function. This function is the solution to the following differential equation:
$$x(x-1)\frac{d^2}{dx^2}y + [(a+b+1)x-c]\frac{d}{dx}y+aby=0.$$
The hypergeometric function is given by:
$$F(a,b,c,x)=1+\frac{ab}{c}x+\frac{a(a+1)b(b+1)}{2c(c+1)}x^2+\frac{a(a+1)(a+2)b(b+1)(b+2)}{6c(c+1)(c+2)}x^3\cdots$$
which can be written as
$$F(a,b,c,x)=1+ \sum_{i=0}^{\infty}\frac{(a+i)!(b+i)!c!}{i!(a-1)!(b-1)!(c+i)!}x^{i+1}.$$
Thus, the moment generating function of the hypergeometric distribution is given by:

and thus

Let’s now calculate the variance.
$$\mathbb{E}\left(X^2\right)=\sum_{k=0}^{n}k^2\mathbb{P}\left(X=k\right)=\sum_{k=0}^{n}[k(k-1)+k]\mathbb{P}\left(X=k\right)=\sum_{k=0}^{n}x(x-1)\mathbb{P}\left(X=k\right)+\sum_{k=0}^{n}x\mathbb{P}\left(X=k\right)=$$

Then, the variance is given by
$$\text{Var}\left(X\right)=\mathbb{E}\left(X^2\right)-\mathbb{E}^2\left(X\right)=\frac{M(M-1)n(n-1)}{N(N-1)}+\frac{nM}{N}-\left(\frac{nM}{N}\right)^2=n\frac{M}{N}\frac{(N-M)}{N}\left(1-\frac{n-1}{N-1}\right)$$
8.5.5 Multinomial distribution
Consider an experiment divided into $ n $ independent trials, in which each trial results in a finite number $ k $ of possible values with probabilities $ p_1,p_2,\ldots,p_k $ (so that $ p_i \geq 0 $ for $ i = 1,\ldots,k $ and $ \displaystyleΣ\sum_{i=1}^kp_i=1 $).Taking the random variable $ X_i $ which represents the number of times the index $ i $ was observed in $ n $ trials, the vector $ X = (X_1,\ldots,X_k) $ follows a multinomial distribution with parameters $ n $ and $ p $ where $ p = (p_1,\ldots,p_k) $.
Therefore, its probability distribution is given by
$$\mathbb{P}(X_1=n_1,\ldots,X_k=n_k)=\frac{n!}{n_1!\times\ldots\times n_k!}\times p_1^{n_1}\times p_2^{n_2}\times\ldots\times p_k^{n_k}.$$
Definition 5.5.1
We will say that a random vector $ X = (X_1,\ldots,X_k) $ follows a multinomial distribution with parameters $ n $ and $ p = (p_1,\ldots,p_k) $ if your probability function is given by
$$\mathbb{P}(X_1=n_1,\ldots,X_k=n_k)=\frac{n!}{n_1!\times\ldots\times n_k!}\times p_1^{n_1}\times p_2^{n_2}\times\ldots\times p_k^{n_k}.$$
We denote $ X \sim \ \text{Multi}(n,p_1,\ldots,p_k) $.
Example 5.5.1
The following events can occur with a package sent by mail: arriving in perfect condition, arriving damaged or getting lost along the way. The probabilities of these events are, respectively $ 0,7 $, $ 0,2 $ and $ 0,1 $. Were recently sent $ 10 $ packages by mail. What is the probability of $ 6 $ arrive correctly at their destination, $ 2 $ be lost and the others $ 2 $ damaged?
Define the following random variables:
$ X_1 $: number of packages that arrived correctly and without damage;
$ X_2 $: number of packages that arrived damaged;
$ X_3 $: number of packets that were lost along the way.
So $ X_1+X_2+X_3=n=10 $ and $ p_1+p_2+p_3=0,7+0,2+0,1=1 $. Then,
$$\mathbb{P}(X_1=6,X_2=2,X_3=2)=\frac{10!}{6!2!2!}\times(0,7)^6\times(0,2)^2\times(0,1)^2=0,059.$$
Example 5.5.2
A box containing $ 12 $ balls, of which $ 5 $ are red, $ 4 $ white and $ 3 $ blue. Suppose it is withdrawn $ 5 $ balls at random and with replacement. What is the probability that they will be withdrawn $ 2 $ red balls, $ 2 $ white and $ 1 $ blue.
First we have to calculate the probability of drawing a white ball:
$$\mathbb{P}(B)=\displaystyle \frac{4}{12}$$
the probability of drawing a red ball:
$$\mathbb{P}(V)=\displaystyle \frac{5}{12}$$
and the probability of drawing a blue ball:
$$\mathbb{P}(A)=\displaystyle \frac{3}{12}$$
So using the multinomial formula we have
$$\mathbb{P}(V=2,B=2,A=1)=\frac{5!}{2!2!1!}\left(\frac{5}{12}\right)^2\left(\frac{4}{12}\right)^2\left(\frac{3}{12}\right)=\frac{3000}{20736}\approx 0,144675.$$
Generating Function of Moments, Expected Value and Variance
Se $ X\sim \ \text{Multi}(n,p_1,\cdots, p_k) $ then its moment generating function is given by:
$$M_X(t)=\mathbb{E}\left(e^{tX}\right)=\sum_{x}e^{tx}P[X=k]=\sum_{j_1}^{n}\cdots\sum_{j_k}^{n}e^{tj_1}\cdots e^{tj_k}\frac{n!}{j_1!\cdots j_k}p_1^{j_1}\cdots p_k^{j_k}=\left(\sum_{i=1}^{n}p_ie^{t_i}\right)^n.$$
The expected value of the number of times the index $ i $ is observed is given by
$$\mathbb{E}(X_i)=np_i$$
and the variance
$$\text{Var}(X_i)=np_i(1-p_i).$$
8.5.6 Negative binomial
Be $ X $ a random variable that counts the number of attempts needed to obtain $ k $ successes, in $ n $ Bernoulli trials with probability $ p $ in each test. Note that in this case the last test will be the $ k $-th success. This variable is known as negative binomial. In fact, the negative binomial is the sum of $ k $ geometric variables with parameters equal to $ p $. In this case, we have the probability of realizing $ x $ tests is given by

Definition 5.6.1
Be $ X $ a random variable that provides the number of trials until the $ k $-th success. So $ X $ has a negative binomial distribution with parameter $ p\in (0,1) $, if its probability function is given by:

We usually use the notation $ X\sim BN(p,k) $.
Example 5.6.1
Suppose that, to win a dice game, it is necessary to obtain $ 3 $ times the face up of the die with the number of $ 1 $. Since the number of launches must be $ 6 $ and we must get the face $ 1 $ turned up for the third time on the sixth throw. Assuming the dice is fair, what is the probability of winning the game?
In fact, as the dice are honest we have the probability of coming up face $ 1 $ is $ 1/6 $, therefore using the negative binomial formula we have:

Example 5.6.2
Suppose that a car salesman has, in addition to his salary, a bonus of $ 200 $ reais for each car he sells. Suppose also that he needs to sell at least $ 5 $ cars a month so he doesn’t get fired. What is the probability that the salesperson will be laid off in February, given that he works every day, including weekends and holidays. Suppose he can sell at most 1 car per day with a probability of 0.2.
For him to be fired in February he needs to sell a maximum of 4 cars during the entire month. In this way, consider $ X_i $ the random variable that represents the number of days needed to sell $ i $ cars. In this case, we have to $ X_i\sim \ \text{BN}(0,2;i) $ and then

Therefore,
$$\mathbb{P}\left(X_0=28\right)=(0,8)^{28}=0,001934.$$

Therefore, the probability of him being sent away in February is given by
$$\mathbb{P}\left(\text{Ser demitido}\right)=\sum_{i=0}^{4}\mathbb{P}\left(X_i=28\right)\approx 0,0364561.$$
Example 5.6.3
Suppose that a factory produces resistance for showers, with a defect rate of $ 2(porcentagem)% $. What is the probability that in an inspection of $ 10 $ resistance if you have $ 3 $ defective resistors, with the third defective being exactly the tenth inspected.
Be $ X $ the number of resistors inspected until we find the third defective. So we have to $ X \sim \ \text{BN}(0,02;3) $ and

Generating Function of Moments, Expected Value and Variance
Be $ X $ a negative binomial discrete random variable with parameters $ p $ and $ k $. Then the moment generating function $ X $ is given by

whence it follows that
$$M_X(t) = \left(\frac{p}{1-p}\right)^{k}(e^t(1-p))^k\sum_{x=0}^{\infty}\frac{(k+x)!}{x!k!}((1-p)e^t)^{x}=\frac{(pe^t)^k}{[1-(1-p)e^t]^k}=\frac{p^k}{[e^{-t}+p-1]^k}.$$
Therefore, the negative Binomial moment generating function is given by:
$$M_X(t) = \frac{p^k}{[e^{-t}+p-1]^k}$$
Using the moment generating function we will calculate the expected value, we have
$$M^\prime_X(t)=\frac{kp^k}{e^{t}(p+e^{-t}-1)^{k+1}}$$
from which we conclude that
$$\mathbb{E}(X) = M^\prime_X(0)=\frac{kp^{k}}{(p+e^{0}-1)^{k+1}e^{0}}=\frac{kp^k}{(p)^{k+1}}=\frac{k}{p}.$$
Let’s calculate now $ \mathbb{E}\left(X^2\right) $ using the moment generating function.
$$M'';_X(t)=\frac{kp^k (k-(p-1)e^t)(p+e^{-t}-1)^{-k}}{((p-1)e^{t}+1)^2}.$$
And then,
$$\mathbb{E}\left(X^2\right)=M'';_X(0)=\frac{k(k-p+1)}{p^2}.$$
We are now in a position to calculate the value of the variance of $ X $ which is given by
$$\text{Var}(X)=\mathbb{E}\left(X^2\right)-\mathbb{E}^2\left(X\right)=\frac{k(k-p+1)}{p^2}-\frac{k^2}{p^2}=\frac{k(1-p)}{p^2}.$$