Explanation - Unit 4 Counting Techniques
Explanation - Unit 4 Counting Techniques
When computing probabilities, it is sometimes necessary to determine the number of outcomes in a sample
space. In this section we will describe several methods for doing this. The basic rule, which we will call the
fundamental principle of counting, is presented by means of Example 9.
Example 9:
A certain make of automobile is available in any of three colors: red, blue, or green, and comes with either
a large or small engine. In how many ways can a buyer choose a car?
Solution:
There are three choices of color and two choices of engine. A complete list of choices is written in the
following 3 × 2 table. The total number of choices is (3)(2) = 6.
To generalize Example 9, if there are n1 choices of color and n2 choices of engine, a complete list of choices
can be written in an n1×n2 table, so the total number of choices is n1n2.
The fundamental principle of counting states that this reasoning can be extended to any number of
operations.
Example 10:
When ordering a certain type of computer, there are 3 choices of hard drive, 4 choices for the amount of
memory, 2 choices of video card, and 3 choices of monitor. In how many ways can a computer be ordered?
Solution:
The total number of ways to order a computer is (3)(4)(2)(3) = 72.
PERMUTATIONS
A permutation is an ordering of a collection of objects.
For example, there are six permutations of the letters A, B, C:
ABC, ACB, BAC, BCA, CAB, and CBA.
With only three objects, it is easy to determine the number of permutations just by listing them all. But with
a large number of objects this would not be feasible. The fundamental principle of counting can be used to
determine the number of permutations of any set of objects.
For example, we can determine the number of permutations of a set of three objects
as follows.
There are 3 choices for the object to place first. After that choice is made, there are 2 choices
remaining for the object to place second. Then there is 1 choice left for the object to place last.
This is the product of the integers from 1 to n. This product can be written with the symbol n!, read “n
factorial.
Example 11:
Five people stand in line at a movie theater. Into how many different orders can they be arranged?
Solution:
The number of permutations of a collection of five people is 5! = (5)(4)(3)(2)(1) = 120.
Sometimes we are interested in counting the number of permutations of subsets of a certain size chosen
from a larger set.
Example 12:
In one year, three awards (research, teaching, and service) will be given to a class of 25 graduate students in
a statistics department. If each student can receive at most one award, how many possible selections are
there?
Solution: Since the awards are distinguishable, it is a permutation problem. The total number of sample
points is
25! 25!
25 𝑃𝑃3 = = = (25)(24)(23) = 13,800
(25 − 3)! 22!
Permutations that occur by arranging objects in a circle are called circular permutations. Two circular
permutations are not considered different unless corresponding objects in the two arrangements are
preceded or followed by a different object as we proceed in a clockwise direction.
For example, if 4 people are playing bridge, we do not have a new permutation if they all move one
position in a clockwise direction. By considering one person in a fixed position and arranging the
other three in 3! ways, we find that there are 6 distinct arrangements for the bridge game.
where n1 + n2 + · · · + nr = n.
Example 13:
In a college football training session, the defensive coordinator needs to have 10 players standing in a row.
Among these 10 players, there are 1 freshman, 2 sophomores, 4 juniors, and 3 seniors. How many different
ways can they be arranged in a row if only their class level will be distinguished?
Solution:
Directly using the formula, we find that the total number of arrangements is
10!
= 12,600
1! 2! 4! 3!
COMBINATIONS
In some cases, when choosing a set of objects from a larger set, we don’t care about the ordering of the
chosen objects; we care only which objects are chosen.
Each distinct group of objects that can be selected, without regard to order, is called a combination.
Solution:
Since the order of the five chosen people does not matter, we need to compute the number of combinations
of 5 chosen from 30. This is
30 30! (30)(29)(28)(27)(26)
� �= = = 142,506
5 5! 25! (5)(4)(3)(2)(1)
Example 15:
A box of bolts contains 8 thick bolts, 5 medium bolts, and 3 thin bolts. A box of nuts contains 6 that fit the
thick bolts, 4 that fit the medium bolts, and 2 that fit the thin bolts. One bolt and one nut are chosen at
random. What is the probability that the nut fits the bolt?
Solution:
The sample space consists of all pairs of nuts and bolts, and each pair is equally likely to be chosen. The event
that the nut fits the bolt corresponds to the set of all matching pairs of nuts and bolts. Therefore
number of matching pairs of nuts and bolts
𝑃𝑃 (𝑛𝑛𝑛𝑛𝑛𝑛 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏) =
number of pairs of nuts and bolts
There are 6 + 4 + 2 = 12 nuts, and 8 + 5 + 3 = 16 bolts. Therefore
Number of pairs of nuts and bolts = (12)(16) = 192
The number of matching pairs is found by summing the number of pairs of thick nuts and bolts, the number
of pairs of medium nuts and bolts, and the number of pairs of thin nuts and bolts. These numbers are
Number of pairs of thick nuts and bolts = (6)(8) = 48
Number of pairs of medium nuts and bolts = (4)(5) = 20
Number of pairs of thin nuts and bolts = (2)(3) = 6
Therefore
48 + 20 + 6
𝑃𝑃(𝑛𝑛𝑛𝑛𝑛𝑛 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏) = = 0.3854
192
Conditional Probability
The probability of an event B occurring when it is known that some event A has occurred is called a
conditional probability and is denoted by P(B|A). The symbol P(B|A) is usually read “the probability that B
occurs given that A occurs” or simply “the probability of B, given A.”
In Example 6 we discussed a population of 1000 aluminum rods. For each rod, the length is classified as too
short, too long, or OK, and the diameter is classified as too thin, too thick, or OK. These 1000 rods form a
sample space in which each rod is equally likely to be sampled. The number of rods in each category is
presented in Table 2.1.
Of the 1000 rods, 928 meet the diameter specification. Therefore, if a rod is sampled, P(diameter OK) =
928/1000 = 0.928. This probability is called the unconditional probability, since it is based on the entire
sample space. Now assume that a rod is sampled, and its length is measured and found to meet the
specification. What is the probability that the diameter also meets the specification? The key to computing
this probability is to realize that knowledge that the length meets the specification reduces the sample space
from which the rod is drawn. Table 2.2 presents this idea.
Once we know that the length specification is met, we know that the rod will be one of the 942 rods in the
sample space presented in Table 2.2.
Of the 942 rods in this sample space, 900 of them meet the diameter specification. Therefore, if we know
that the rod meets the length specification, the probability that the rod meets the diameter specification is
900/942.
We say that the conditional probability that the rod meets the diameter specification given that it meets
the length specification is equal to 900/942, and we write
Note that the conditional probability P(diameter OK | length OK) differs from the unconditional probability
P(diameter OK), which was computed from the full sample space (Table 2.1) to be 0.928.
Example 16:
Compute the conditional probability P(diameter OK | length too long). Is this the same as the unconditional
probability P(diameter OK)?
Solution:
The conditional probability P(diameter OK | length too long) is computed under the assumption that the rod
is too long. This reduces the sample space to the 40 items indicated in boldface in the following table.
Of the 40 outcomes, 25 meet the diameter specification. Therefore
P(diameter OK | length too long) = 25/40 = 0.625
The unconditional probability P(diameter OK) is computed on the basis of all 1000 outcomes in the sample
space and is equal to 928/1000 = 0.928. In this case, the conditional probability differs from the unconditional
probability. Let’s look at the solution more closely. We found that
P(diameter OK | length too long) = 25/40
In the answer 25/40, the denominator, 40, represents the number of outcomes that satisfy the condition
that the rod is too long, while the numerator, 25, represents the number of outcomes that satisfy both the
condition that the rod is too long and that its diameter is OK. If we divide both the numerator and
denominator of this answer by the number of outcomes in the full sample space, which is 1000, we obtain
25�
𝑃𝑃(𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑂𝑂𝑂𝑂 | 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙ℎ 𝑡𝑡𝑡𝑡𝑡𝑡 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙) = 1000
40�
1000
Now 40/1000 represents the probability of satisfying the condition that the rod is too long. That is,
40
𝑃𝑃(𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙ℎ 𝑡𝑡𝑡𝑡𝑡𝑡 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙) =
1000
The quantity 25/1000 represents the probability of satisfying both the condition that the rod is too long and
that the diameter is OK. That is,
25
𝑃𝑃(𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑂𝑂𝑂𝑂 𝑎𝑎𝑎𝑎𝑎𝑎 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙ℎ 𝑡𝑡𝑡𝑡𝑡𝑡 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙) =
1000
We can now express the conditional probability as
𝑃𝑃(𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑂𝑂𝑂𝑂 𝑎𝑎𝑎𝑎𝑎𝑎 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑡𝑡ℎ 𝑡𝑡𝑡𝑡𝑡𝑡 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙
𝑃𝑃(𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑂𝑂𝑂𝑂 | 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙ℎ 𝑡𝑡𝑡𝑡𝑡𝑡 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙) =
𝑃𝑃(𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙ℎ 𝑡𝑡𝑡𝑡𝑡𝑡 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙)
This reasoning can be extended to construct a definition of conditional probability that holds for any sample
space:
The following figure presents Venn diagrams to illustrate the idea of conditional probability.
(a) The diagram represents the unconditional probability P(A). P(A) is illustrated by considering the event A
in proportion to the entire sample space, which is represented by the rectangle. (b) The diagram represents
the conditional probability P(A|B). Since the event B is known to occur, the event B now becomes the sample
space. For the event A to occur, the outcome must be in the intersection A ∩ B. The conditional probability
P(A|B) is therefore illustrated by considering the intersection A ∩ B in proportion to the entire event B.
Example 17:
In a process that manufactures aluminum cans, the probability that a can has a flaw on its side is 0.02, the
probability that a can has a flaw on the top is 0.03, and the probability that a can has a flaw on both the side
and the top is 0.01. What is the probability that a can will have a flaw on the side, given that it has a flaw on
top?
Solution:
Let A = the event that the can has a flaw on the side
B = the event that the can has a flaw on top
We are given that P(A) = 0.02, and P(A ∩ B) = 0.01. Using Equation for conditional probability
Example 18:
The concept of conditional probability has countless uses in both industrial and biomedical applications.
Consider an industrial process in the textile industry in which strips of a particular type of cloth are being
produced. These strips can be defective in two ways, length and nature of texture. For the case of the latter,
the process of identification is very complicated. It is known from historical information on the process that
10% of strips fail the length test, 5% fail the texture test, and only 0.8% fail both tests. If a strip is selected
randomly from the process and a quick measurement identifies it as failing the length test, what is the
probability that it is texture defective?
Solution:
Consider the events
L: length defective, T: texture defective.
Given that the strip is length defective, the probability that this strip is texture defective is given by
𝑷𝑷(𝑻𝑻 ∩ 𝑳𝑳) 𝟎𝟎. 𝟎𝟎𝟎𝟎𝟎𝟎
𝑷𝑷(𝑻𝑻 | 𝑳𝑳) = = = 𝟎𝟎. 𝟎𝟎𝟎𝟎
𝑷𝑷(𝑳𝑳) 𝟎𝟎. 𝟎𝟎𝟎𝟎
Thus, knowing the conditional probability provides considerably more information
than merely knowing P(T)
Independent Events
Sometimes the knowledge that one event has occurred does not change the probability
that another event occurs. In this case the conditional and unconditional probabilities are
the same, and the events are said to be independent. We present an example.
Example 19:
If an aluminum rod is sampled from the sample space presented in Table 2.1, find P(too long) and P(too long
| too thin). Are these probabilities different?
Solution:
P(too long) = 40/1000 = 0.04
P(too long and too thin) 2/1000
P(too long | too thin) = = = 0.04
P(too thin) 50/1000
The conditional probability and the unconditional probability are the same. The information that the rod is
too thin does not change the probability that the rod is too long.
Example 19 shows that knowledge that an event occurs sometimes does not change the probability that
another event occurs. In these cases, the two events are said to be independent. The event that a rod is too
long and the event that a rod is too thin are independent.
We now give a more precise definition of the term, both in words and in symbols.
Two events A and B are independent if the probability of each event remains
the same whether or not the other occurs.
When two events are independent, then P(A|B) = P(A) and P(B|A) = P(B), so the multiplication rule simplifies:
P(A ∩ B) = P(A)P(B)
Example 21:
A vehicle contains two engines, a main engine and a backup. The engine component fails only if both engines
fail. The probability that the main engine fails is 0.05, and the probability that the backup engine fails is 0.10.
Assume that the main and backup engines function independently. What is the probability that the engine
component fails?
Solution:
The probability that the engine component fails is the probability that both engines fail. Therefore
P(engine component fails) = P(main engine fails and backup engine fails)
Since the engines function independently, P(A ∩ B) = P(A)P(B):
P(main engine fails and backup engine fails) = P(main fails)P(backup fails)
= (0.10)(0.05)
= 0.005
The above equation is a special case of the law of total probability, restricted to the case where there are
four mutually exclusive and exhaustive events. The intuition behind the law of total probability is quite
simple. The events A1, A2, A3, A4 break the event B into pieces. The probability of B is found by adding up the
probabilities of the pieces.
We could redraw Figure 2.6 to have any number of events Ai. This leads to the general case of the law of
total probability.
Example 22:
Customers who purchase a certain make of car can order an engine in any of three sizes. Of all cars sold, 45%
have the smallest engine, 35% have the medium-sized one, and 20% have the largest. Of cars with the
smallest engine, 10% fail an emissions test within two years of purchase, while 12% of those with the medium
size and 15% of those with the largest engine fail. What is the probability that a randomly chosen car will fail
an emissions test within two years?
Solution:
Let B denote the event that a car fails an emissions test within two years,
A1 denote the event that a car has a small engine,
A2 the event that a car has a medium-size engine, and
A3 the event that a car has a large engine.
Then
P(A1) = 0.45, P(A2) = 0.35, P(A3) = 0.20
The probability that a car will fail a test, given that it has a small engine, is 0.10. That is, P(B|A1) = 0.10.
Similarly, P(B|A2) = 0.12, and P(B|A3) = 0.15. By the law of total probability,
P(B) = P(B|A1)P(A1) + P(B|A2)P(A2) + P(B|A3)P(A3)
= (0.10)(0.45) + (0.12)(0.35) + (0.15)(0.20)
= 0.117
Sometimes problems like Example 22 are solved with the use of tree diagrams. Figure 2.7 presents a tree
diagram for Example 22. There are three primary branches on the tree, corresponding to the three engine
sizes. The probabilities of the engine sizes are listed on their respective branches. At the end of each primary
branch are two secondary branches, representing the events of failure and no failure. The conditional
probabilities of failure and no failure, given engine size, are listed on the secondary branches. By multiplying
along each of the branches corresponding to the event B = fail, we obtain the probabilities P(B|Ai)P(Ai).
Bayes’ Rule
If A and B are two events, we have seen that in most cases P(A|B) ≠ P(B|A). Bayes’ rule provides a formula
that allows us to calculate one of the conditional probabilities if we know the other one. To see how it works,
assume that we know P(B|A) and we wish to calculate P(A|B). Start with the definition of conditional
probability:
P(A|B) = P(A ∩ B)/P(B)
Now use the equation P(A ∩ B) = P(A)P(B|A) to substitute P(B|A)P(A) for P(A ∩ B):
P(A|B) = P(B|A)P(A)/P(B) (2.25)
The above equation is essentially Bayes’ rule. When Bayes’ rule is written, the expression P(B) in the
denominator is usually replaced with a more complicated expression derived from the law of total
probability. Specifically, since the events A and Ac are mutually exclusive and exhaustive, the law of total
probability shows that
P(B) = P(B|A)P(A) + P(B|Ac)P(Ac) (2.26)
Substituting the right-hand side of Equation (2.26) for P(B) in Equation (2.25) yields Bayes’ rule. A more
general version of Bayes’ rule can be derived as well, by considering a collection A1, . . ., An of mutually
exclusive and exhaustive events and using the law of total probability to replace P(B) with the expression on
the right-hand side of Equation (2.24).
Bayes’ Rule
Special Case: Let A and B be events with P(A) ≠ 0, P(Ac) ≠ 0, and P(B) ≠ 0. Then
𝑃𝑃 (𝐵𝐵|𝐴𝐴)𝑃𝑃(𝐴𝐴)
𝑃𝑃(𝐴𝐴|𝐵𝐵) = (2.27)
𝑃𝑃 (𝐵𝐵|𝐴𝐴)𝑃𝑃 (𝐴𝐴) + 𝑃𝑃(𝐵𝐵|𝐴𝐴𝑐𝑐 )𝑃𝑃(𝐴𝐴𝑐𝑐 )
Example 23:
In a certain assembly plant, three machines, B1, B2, and B3, make 30%, 45%, and 25%, respectively, of the
products. It is known from past experience that 2%, 3%, and 2% of the products made by each machine,
respectively, are defective. Now,
suppose that a finished product is randomly selected.
a. What is the probability that it is defective?
b. If a product was found to be defective, what is the probability that it was made by machine B3?
Solution:
Consider the following events:
A: the product is defective,
B1: the product is made by machine B1,
B2: the product is made by machine B2,
B3: the product is made by machine B3.
a.
Applying the rule of elimination, we can write
P(A) = P(B1)P(A|B1) + P(B2)P(A|B2) + P(B3)P(A|B3).
Referring to the tree diagram of Figure 2.8, we find that the three branches give the probabilities
P(B1)P(A|B1) = (0.3)(0.02) = 0.006,
P(B2)P(A|B2) = (0.45)(0.03) = 0.0135,
P(B3)P(A|B3) = (0.25)(0.02) = 0.005,
and hence
P(A) = 0.006 + 0.0135 + 0.005 = 0.0245.
FIGURE 2.8 Tree diagram for the solution to Example 23
b.
Using Bayes’ rule to write
Example 24:
A system contains two components, A and B, connected in series as shown in the following
diagram.
The system will function only if both components function. The probability that A functions is given by P(A)
= 0.98, and the probability that B functions is given by P(B) = 0.95. Assume that A and B function
independently. Find the probability that the system functions.
Solution:
Since the system will function only if both components function, it follows that
P(system functions) = P(A ∩ B)
= P(A)P(B) by the assumption of independence
= (0.98)(0.95)
= 0.931
Example 25 illustrates the computation of the reliability of a system consisting of two components connected
in parallel.
Example 25:
A system contains two components, C and D, connected in parallel as shown in the following diagram.
The system will function if either C or D functions. The probability that C functions is 0.90, and the probability
that D functions is 0.85. Assume C and D function independently. Find the probability that the system
functions.
Solution:
Since the system will function so long as either of the two components functions, it follows that
P(system functions) = P(C ∪ D)
= P(C) + P(D) - P(C ∩ D)
= P(C) + P(D) - P(C)P(D)
by the assumption of independence
= 0.90 + 0.85 - (0.90)(0.85)
= 0.985
The reliability of more complex systems can often be determined by decomposing
the system into a series of subsystems, each of which contains components connected
either in series or in parallel.