We are going to try to solve the following example with the basic tools of Probabilities.
Example
A screw factory has two machines, the M1, which is old, and does 75 % of all the screws, and the M2, newer but small, that does 25 % of the screws. The M1 does 4 % of defective screws, while the M2 just does 2 % of defective screws. If we choose a screw at random: what is the probability that ir turns out to be defective?
We consider the following events:
(and therefore,
If we represent our problem in a tree, we can compute the probability more easily.
In the diagram we can see the branches that we are interested in (in dark orange).
The top branch, "being produced by machine 1 and being defective", has probability
Therefore, the probability of being defective is:
Let's analyse what we have done. The probabilities with which we have worked are in a way conditional probabilities:
So, we can re-write our result as:
We can generalize this result with the theorem or law of total probability.
Law of total probability:
Let
Let's recall that a complete system of events or partition is a set of incompatible events two by two (that is, that they cannot happen simultaneously), and such that the union of all of them is the complete sample space. A particular example of a partition of the sample space is each of their events. Unless we say so, we will always assume that the events in a partition always have a non zero probability. Otherwise we could always eliminate such an evenet and we would obtain a smaller partition of the sample space.
Let's see other examples where we can apply this result.
Example
We have three boxes with light bulbs. The first one contains
We will write
Since the election is random, we have probability
The event that we are interested in is
We represent it in a tree:
In dark orange we observe the branches of the tree that lead to the event that we are interested in, i.e. "broken light bulbs".
We apply, then, the law of total probability:
As we can see, to apply the theorem of the total probability is the same as to compute the probability using the tree.
The only thing we have to care about is to compute the probabilities for each of the branches.
Example
A bag contains three red balls and two blue balls. We do two experiments:
i) We remove successively, and with replacement, two balls and observe their colour. What is the probability of
ii) We remove successively, but without replacement, two balls and observe their colour. What is the
This is a very frequent experiment: when we remove something with replacement, it means that when we remove the ball from the bag, we then introduce it back. If it is without replacement, we keep the ball out. This will influence the probability of the second ball being one color or another.
Let's consider the events:
Our sample space is:
i) We represent our problem in a tree.
Using the law of total probability,
ii) In this case, the second time that we remove a ball, the probabilities will be different, depending on whether the first ball was red or blue.
For example,
In this case, our tree is the following (compute the conditional probabilities, and verify that you obtain the same result):
And so, by virtue of the law of total probability, we have a different result from that of the previous case:
We will finish this level with a more complicated problem that will be useful to see that the way of solving more complicated problems is the same that what we have done until now.
Example
Suppose we have
Let's consider the following events:
It is a question of a compounded election: we choose three doctors, each of which can be in favor or against using the vaccine.Our sample space would be:
The are four favorable cases:
Now , in order to choose every doctor, we do another compounded experiment: we choose randomly a country between
We represent our problem in a tree. We have to be sure that we repeat this experiment three times, one for every vote. Note again that it is a case with replacement, since the same doctor can be picked more than once. Thus we have three votes coming out from the same tree, represented below:
Our sample space for every experiment is
What is the probability that a doctor chosen at random is in favor of the vaccine?
Using the law of total probability,
Seen through other lenses, we add the probability of all the branches that finish in
Substituting,
That is, a probability of 68,3%. Since we know that
We repeat this experiment three times. We have four favorable cases:
- Case
: its probability is . - Case
: its probability is . - Case
: its probability is . - Case
: its probability is .
Finally, the probability of approving the vaccine is:
Observació 1:
Since we are not concerned with the order with which the doctors are chosen, but rather with whether they are in favor of the vaccine or not, we might think that our sample space is
Note that, instead of writing the elementary events with brackets, "( )", ewe write them with "{ }", to signify that our results are wihtout order. We will analyze this with some more depth in the combinatorial analysis cell.
There are two favorable cases:
Observation 2:
It may look a bit weird that a single doctor can be chosen three times. In fact, if we do not allow the same doctor to vote more than once the result does not change much. This is because of the large number of doctors taking part in the conference. You are entitled, however, to redo the problem assuming that each doctor can vote only once, that is, that there is no replacement.