18.1 KB · commit a9602da
Many counting problems can be solved by finding the number of ways to arrange a specified number of distinct elements of a set of a particular size, where the order of these elements matters. Many other counting problems can be solved by finding the number of ways to select a particular number of elements from a set of a particular size, where the order of the elements selected does not matter. For example, in how many ways can we select three students from a group of five students to stand in line for a picture? How many different committees of three students can be formed from a group of four students? In this section we will develop methods to answer questions such as these.
We begin by solving the first question posed in the introduction to this section, as well as related questions.
In how many ways can we select three students from a group of five students to stand in line for a picture? In how many ways can we arrange all five of these students in a line for a picture?
Solution: First, note that the order in which we select the students matters. There are five ways to select the first student to stand at the start of the line. Once this student has been selected, there are four ways to select the second student in the line. After the first and second students have been selected, there are three ways to select the third student in the line. By the product rule, there are 5⋅4⋅3=60 ways to select three students from a group of five students to stand in line for a picture.
To arrange all five students in a line for a picture, we select the first student in five ways, the second in four ways, the third in three ways, the fourth in two ways, and the fifth in one way. Consequently, there are 5⋅4⋅3⋅2⋅1=120 ways to arrange all five students in a line for a picture. ◀
Example 1 illustrates how ordered arrangements of distinct objects can be counted. This leads to some terminology.
A permutation of a set of distinct objects is an ordered arrangement of these objects. We also are interested in ordered arrangements of some of the elements of a set. An ordered arrangement of r elements of a set is called an r-permutation.
Let S={1,2,3}. The ordered arrangement 3,1,2 is a permutation of S. The ordered arrangement 3,2 is a 2-permutation of S. ◀
The number of r-permutations of a set with n elements is denoted by P(n,r). We can find P(n,r) using the product rule.
Let S={a,b,c}. The 2-permutations of S are the ordered arrangements a,b; a,c; b,a; b,c; c,a; and c,b. Consequently, there are six 2-permutations of this set with three elements. There are always six 2-permutations of a set with three elements. There are three ways to choose the first element of the arrangement. There are two ways to choose the second element of the arrangement, because it must be different from the first element. Hence, by the product rule, we see that P(3,2)=3⋅2=6. ◀
We now use the product rule to find a formula for P(n,r) whenever n and r are positive integers with 1≤r≤n.
Proof: We will use the product rule to prove that this formula is correct. The first element of the permutation can be chosen in n ways because there are n elements in the set. There are n−1 ways to choose the second element of the permutation, because there are n−1 elements left in the set after using the element picked for the first position. Similarly, there are n−2 ways to choose the third element, and so on, until there are exactly n−(r−1)=n−r+1 ways to choose the rth element. Consequently, by the product rule, there are n(n−1)(n−2)⋯(n−r+1) r-permutations of the set. ■
Note that P(n,0)=1 whenever n is a nonnegative integer because there is exactly one way to order zero elements. That is, there is exactly one list with no elements in it, namely the empty list.
We now state a useful corollary of Theorem 1.
Proof: When n and r are integers with 1≤r≤n, by Theorem 1 we have P(n,r)=n(n−1)(n−2)⋯(n−r+1)=(n−r)!n!. Because (n−0)!n!=n!n!=1 whenever n is a nonnegative integer, we see that the formula P(n,r)=(n−r)!n! also holds when r=0. ■
By Theorem 1 we know that if n is a positive integer, then P(n,n)=n!. We will illustrate this result with some examples.
How many ways are there to select a first-prize winner, a second-prize winner, and a third-prize winner from 100 different people who have entered a contest?
Solution: Because it matters which person wins which prize, the number of ways to pick the three prize winners is the number of ordered selections of three elements from a set of 100 elements, that is, the number of 3-permutations of a set of 100 elements. Consequently, the answer is P(100,3)=100⋅99⋅98=970,200. ◀
Suppose that there are eight runners in a race. The winner receives a gold medal, the second-place finisher receives a silver medal, and the third-place finisher receives a bronze medal. How many different ways are there to award these medals, if all possible outcomes of the race can occur and there are no ties?
Solution: The number of different ways to award the medals is the number of 3-permutations of a set with eight elements. Hence, there are P(8,3)=8⋅7⋅6=336 possible ways to award the medals. ◀
Suppose that a saleswoman has to visit eight different cities. She must begin her trip in a specified city, but she can visit the other seven cities in any order she wishes. How many possible orders can the saleswoman use when visiting these cities?
Solution: The number of possible paths between the cities is the number of permutations of seven elements, because the first city is determined, but the remaining seven can be ordered arbitrarily. Consequently, there are 7!=7⋅6⋅5⋅4⋅3⋅2⋅1=5040 ways for the saleswoman to choose her tour. If, for instance, the saleswoman wishes to find the path between the cities with minimum distance, and she computes the total distance for each possible path, she must consider a total of 5040 paths! ◀
How many permutations of the letters ABCDEFGH contain the string ABC?
Solution: Because the letters ABC must occur as a block, we can find the answer by finding the number of permutations of six objects, namely, the block ABC and the individual letters D,E,F,G, and H. Because these six objects can occur in any order, there are 6!=720 permutations of the letters ABCDEFGH in which ABC occurs as a block. ◀
We now turn our attention to counting unordered selections of objects. We begin by solving a question posed in the introduction to this section of the chapter.
How many different committees of three students can be formed from a group of four students?
Solution: To answer this question, we need only find the number of subsets with three elements from the set containing the four students. We see that there are four such subsets, one for each of the four students, because choosing three students is the same as choosing one of the four students to leave out of the group. This means that there are four ways to choose the three students for the committee, where the order in which these students are chosen does not matter. ◀
Example 8 illustrates that many counting problems can be solved by finding the number of subsets of a particular size of a set with n elements, where n is a positive integer.
An r-combination of elements of a set is an unordered selection of r elements from the set. Thus, an r-combination is simply a subset of the set with r elements.
Let S be the set {1,2,3,4}. Then {1,3,4} is a 3-combination from S. (Note that {4,1,3} is the same 3-combination as {1,3,4}, because the order in which the elements of a set are listed does not matter.) ◀
The number of r-combinations of a set with n distinct elements is denoted by C(n,r). Note that C(n,r) is also denoted by (rn) and is called a binomial coefficient. We will learn where this terminology comes from in Section 6.4.
We see that C(4,2)=6, because the 2-combinations of {a,b,c,d} are the six subsets {a,b},{a,c},{a,d},{b,c},{b,d}, and {c,d}. ◀
We can determine the number of r-combinations of a set with n elements using the formula for the number of r-permutations of a set. To do this, note that the r-permutations of a set can be obtained by first forming r-combinations and then ordering the elements in these combinations. The proof of Theorem 2, which gives the value of C(n,r), is based on this observation.
Proof: The P(n,r) r-permutations of the set can be obtained by forming the C(n,r) r-combinations of the set, and then ordering the elements in each r-combination, which can be done in P(r,r) ways. Consequently, by the product rule, P(n,r)=C(n,r)⋅P(r,r). This implies that C(n,r)=P(r,r)P(n,r)=r!/(r−r)!n!/(n−r)!=r!(n−r)!n!.
We can also use the division rule for counting to construct a proof of this theorem. Because the order of elements in a combination does not matter and there are P(r,r) ways to order r elements in an r-combination of n elements, each of the C(n,r) r-combinations of a set with n elements corresponds to exactly P(r,r) r-permutations. Hence, by the division rule, C(n,r)=P(r,r)P(n,r)=r!(n−r)!n!. ■
The formula in Theorem 2, although explicit, is not helpful when C(n,r) is computed for large values of n and r. The reasons are that it is practical to compute exact values of factorials exactly only for small integer values, and when floating point arithmetic is used, the formula in Theorem 2 may produce a value that is not an integer. When computing C(n,r), first note that when we cancel out (n−r)! from the numerator and denominator of the expression for C(n,r) in Theorem 2, we obtain C(n,r)=r!(n−r)!n!=r!n(n−1)⋯(n−r+1).
Consequently, to compute C(n,r) you can cancel out all the terms in the larger factorial in the denominator from the numerator and denominator, then multiply all the terms that do not cancel in the numerator and finally divide by the smaller factorial in the denominator. [When doing this calculation by hand, instead of by machine, it is also worthwhile to factor out common factors in the numerator n(n−1)⋯(n−r+1) and in the denominator r!.] Note that many calculators have a built-in function for C(n,r) that can be used for relatively small values of n and r and many computational programs can be used to find C(n,r). [Such functions may be called choose(n, k) or binom(n, k)].
Example 11 illustrates how C(n,k) is computed when k is relatively small compared to n and when k is close to n. It also illustrates a key identity enjoyed by the numbers C(n,k).
How many poker hands of five cards can be dealt from a standard deck of 52 cards? Also, how many ways are there to select 47 cards from a standard deck of 52 cards?
Solution: Because the order in which the five cards are dealt from a deck of 52 cards does not matter, there are C(52,5)=5!47!52! different hands of five cards that can be dealt. To compute the value of C(52,5), first divide the numerator and denominator by 47! to obtain C(52,5)=5⋅4⋅3⋅2⋅152⋅51⋅50⋅49⋅48. This expression can be simplified by first dividing the factor 5 in the denominator into the factor 50 in the numerator to obtain a factor 10 in the numerator, then dividing the factor 4 in the denominator into the factor 48 in the numerator to obtain a factor of 12 in the numerator, then dividing the factor 3 in the denominator into the factor 51 in the numerator to obtain a factor of 17 in the numerator, and finally, dividing the factor 2 in the denominator into the factor 52 in the numerator to obtain a factor of 26 in the numerator. We find that C(52,5)=26⋅17⋅10⋅49⋅12=2,598,960. Consequently, there are 2,598,960 different poker hands of five cards that can be dealt from a standard deck of 52 cards.
Note that there are C(52,47)=47!5!52! different ways to select 47 cards from a standard deck of 52 cards. We do not need to compute this value because C(52,47)=C(52,5). (Only the order of the factors 5! and 47! is different in the denominators in the formulae for these quantities.) It follows that there are also 2,598,960 different ways to select 47 cards from a standard deck of 52 cards. ◀
In Example 11 we observed that C(52,5)=C(52,47). This is a special case of the useful identity for the number of r-combinations of a set given in Corollary 2.
Proof: From Theorem 2 it follows that C(n,r)=r!(n−r)!n!
and C(n,n−r)=(n−r)![n−(n−r)]!n!=(n−r)!r!n!. Hence, C(n,r)=C(n,n−r). ■
We can also prove Corollary 2 without relying on algebraic manipulation. Instead, we can use a combinatorial proof. We describe this important type of proof in Definition 1.
Many identities involving binomial coefficients can be proved using combinatorial proofs. We now show how to prove Corollary 2 using a combinatorial proof. We will provide both a double counting proof and a bijective proof, both based on the same basic idea.
Bijective Proof of Corollary 2: We will use a bijective proof to show that C(n,r)=C(n,n−r) for all integers n and r with 0≤r≤n. Suppose that S is a set with n elements. The function that maps a subset A of S to A is a bijection between subsets of S with r elements and subsets with n−r elements (as the reader should verify). The identity C(n,r)=C(n,n−r) follows because when there is a bijection between two finite sets, the two sets must have the same number of elements. ■
Double Counting Proof of Corollary 2: By definition, the number of subsets of S with r elements equals C(n,r). But each subset A of S is also determined by specifying which elements are not in A, and so are in A. Because the complement of a subset of S with r elements has n−r elements, there are also C(n,n−r) subsets of S with r elements. It follows that C(n,r)=C(n,n−r). ■
How many ways are there to select five players from a 10-member tennis team to make a trip to a match at another school?
Solution: The answer is given by the number of 5-combinations of a set with 10 elements. By Theorem 2, the number of such combinations is C(10,5)=5!5!10!=252. ◀
A group of 30 people have been trained as astronauts to go on the first mission to Mars. How many ways are there to select a crew of six people to go on this mission (assuming that all crew members have the same job)?
Solution: The number of ways to select a crew of six from the pool of 30 people is the number of 6-combinations of a set with 30 elements, because the order in which these people are chosen does not matter. By Theorem 2, the number of such combinations is C(30,6)=6!24!30!=6⋅5⋅4⋅3⋅2⋅130⋅29⋅28⋅27⋅26⋅25=593,775. ◀
How many bit strings of length n contain exactly r 1s?
Solution: The positions of r 1s in a bit string of length n form an r-combination of the set {1,2,3,…,n}. Hence, there are C(n,r) bit strings of length n that contain exactly r 1s. ◀
Suppose that there are 9 faculty members in the mathematics department and 11 in the computer science department. How many ways are there to select a committee to develop a discrete mathematics course at a school if the committee is to consist of three faculty members from the mathematics department and four from the computer science department?
Solution: By the product rule, the answer is the product of the number of 3-combinations of a set with nine elements and the number of 4-combinations of a set with 11 elements. By Theorem 2, the number of ways to select the committee is C(9,3)⋅C(11,4)=3!6!9!⋅4!7!11!=84⋅330=27,720. ◀