4.1 Lists: (A, B, C, D, E) A, B, C, D, e A B
4.1 Lists: (A, B, C, D, E) A, B, C, D, e A B
Counting
4.1 Lists
A list is an ordered sequence of objects. A list is denoted by an opening
parenthesis, followed by the objects, separated by commas, followed by a
closing parenthesis. For example (a, b, c, d, e) is a list consisting of the first
five letters of the English alphabet, in order. The objects a, b, c, d, e are called
the entries of the list; the first entry is a, the second is b, and so on. If the
entries are rearranged we get a different list, so, for instance,
A list is somewhat like a set, but instead of being a mere collection of objects,
the entries of a list have a definite order. For sets we have
© ª © ª
a, b, c, d, e = b, a, c, d, e ,
but—as noted above—the analogous equality for lists does not hold.
Unlike sets, lists can have repeated entries. Thus (5, 3, 5, 4, 3, 3) is a
perfectly acceptable list, as is (S, O, S). The length of a list is its number of
entries. So (5, 3, 5, 4, 3, 3) has length six, and (S, O, S) has length three.
Lists 77
For more examples, (a, 15) is a list of length two. And (0, (0, 1, 1)) is a list
of length two whose second entry is a list of length three. Two lists are
equal if they have exactly the same entries in exactly the same positions.
Thus equal lists have the same number of entries. If two lists have different
lengths, then they can not be equal. Thus (0, 0, 0, 0, 0, 0) 6= (0, 0, 0, 0, 0). Also
¡ bread ¢
milk
( g, r, o, c, e, r, y, l, i, s, t ) 6= eggs
bananas
coffee
because the list on the left has length eleven but the list on the right has
just one entry (a piece of paper with some words on it).
There is one very special list which has no entries at all. It is called the
empty list, and is denoted (). It is the only list whose length is zero.
For brevity we often write lists without parentheses, or even commas.
For instance, we may write (S, O, S) as SOS if there is no risk of confusion.
But be alert that doing this can lead to ambiguity: writing (9, 10, 11) as
9 10 11 may cause us to confuse it with (9, 1, 0, 1, 1). Here it’s best to retain
the parenthesis/comma notation or at least write the list as 9, 10, 11. A list
of symbols written without parentheses and commas is called a string.
The process of tossing a coin ten times may be described by a string such
as HHT HTTT HHT . Tossing it twice could lead to any of the outcomes HH ,
HT , T H or TT . Tossing it zero times is described by the empty list ().
Imagine rolling a dice five times and recording the outcomes. This might
¡ ¢
be described by the list , , , , , meaning that you rolled first, then
, then , etc. We can abbreviate this list as .
Now imagine rolling a pair of dice, one white and one black. A typical
© ª
outcome might be modeled as a set like , . Rolling the pair six times
might be described with a list of six such outcomes:
¡© ª© ª© ª© ª© ª© ª¢
, , , , , , , , , , , .
Resulting list
first choice second choice third choice
a (a, 5, a)
5
x (a, 5, x)
a
a (a, 7, a)
7
x (a, 7, x)
a ( b, 5, a)
5
x ( b, 5, x)
b a ( b, 7, a)
7
x ( b, 7, x)
a ( c, 5, a)
5
x ( c, 5, x)
c
a ( c, 7, a)
7
x ( c, 7, x)
In the above example there are 3 choices for the first entry, 2 choices for
the second entry, and 2 for the third, and the total number of possible lists
is the product of choices 3 · 2 · 2 = 12. This kind of reasoning is an instance of
what we will call the multiplication principle. We will do one more example
before stating this important idea.
The Multiplication Principle 79
© ª
Consider making a list of length 4 from the four letters a, b, c, d , where
the list is not allowed to have a repeated letter. For example, abcd and cadb
are allowed, but aabc and cacb are not allowed. How many such lists are
there?
We analyze this question by making a tree representing the choices we
have for each list entry. In making such a list we could start with the first
entry: we have 4 choices for it, namely a, b, c or d , and the left side of the
tree branches out to each of these choices. But once we’ve chosen a letter
for the first entry, we can’t use that letter in the list again, so there are only
3 choices for the second entry. And once we’ve chosen letters for the first
and second entries we can’t use these letters in the third entry, so there are
just 2 choices for it. By the time we get to the fourth entry we are forced to
use whatever letter we have left; there is only 1 choice.
The situation is described fully in the below tree showing how to make
all allowable lists by choosing 4 letters for the first entry, 3 for the second
entry, 2 for the third entry and 1 for the fourth entry. We see that the total
number of lists is the product 4 · 3 · 2 · 1 = 24.
c d abcd
b
d c abdc
a c
b d acbd
d b acdb
b c adbc
d
c b adcb
c d bacd
a
d c badc
a d bcad
b c
d a bcda
a c bdac
d
c a bdca
a
b d cabd
d b cadb
a d cbad
c b
d a cbda
a b cdab
d
b a cdbc
b c dabc
a
c b dacb
a c dbac
d b
c a dbca
a b dcab
c
b a dcba
© ª
Figure 4.2. Constructing lists from letters in a, b, c, d , without repetition.
80 Counting
These trees show that the number of lists constructible by some specified
process equals the product of the numbers of choices for each list entry. We
summarize this kind of reasoning with an important fact.
In using the multiplication principle you do not need to draw the corre-
sponding tree with a 1 · a 2 · · · · · a n branches. Just multiply the numbers!
Example 4.1 A standard license plate consists of three letters followed
by four numbers. For example, JRB-4412 and MMX-8901 are two standard
license plates. How many different standard license plates are possible?
Solution: A license plate such as JRB-4412 corresponds to a length-7 list
(J, R, B, 4, 4, 1, 2), so we just need to count how many such lists are possible.
We use the multiplication principle. There are a 1 = 26 possibilities (one for
each letter of the alphabet) for the first entry of the list. Similarly, there are
a 2 = 26 possibilities for the second entry and a 3 = 26 possibilities for the third.
There are a 4 = 10 possibilities for the fourth entry. Likewise a 5 = a 6 = a 7 = 10.
So there is a total of a 1 · a 2 · a 3 · a 4 · a 5 · a 6 · a 7 = 26 · 26 · 26 · 10 · 10 · 10 · 10 =
175,760,000 possible standard license plates.
Example 4.2 In ordering a café latte, you have a choice of whole, skim or
soy milk; small, medium or large; and either one or two shots of espresso.
How many choices do you have in ordering one drink?
Solution: Your choice is modeled by a list (milk, size, shots). There are
3 choices for the first entry, 3 for the second and 2 for the third. By the
multiplication principle, the number of choices is 3 · 3 · 2 = 18.
There are two types of list-counting problems. On one hand, there are
situations in which list entries can be repeated, as in license plates or
telephone numbers. The sequence CCX-4144 is a perfectly valid license
plate in which the symbols C and 4 appear more than once. On the other
hand, for some lists repeated symbols do not make sense or are not allowed,
as in the (milk, size, shots) list from Example 4.2. We say repetition is
allowed in the first type of list and repetition is not allowed in the second
kind of list. (We will call a list in which repetition is not allowed a non-
repetitive list.) The following example illustrates the difference.
The Multiplication Principle 81
( , , , )
7 choices
7 choices
7 choices
7 choices
( , , , )
7 choices
6 choices
5 choices
4 choices
Thus there are 7 · 6 · 5 · 4 = 840 lists in which repetition does not occur.
(c) We are asked to count the length-4 lists in which repetition is not
allowed and the symbol E must appear somewhere in the list. Thus E
occurs once and only once in each such list. Let us divide these lists into
four categories depending on whether the E occurs as the first, second,
third or fourth entry. These four types of lists are illustrated below.
Type 1 Type 2 Type 3 Type 4
(E, , , ) ( , E, , ) ( , , E, ) ( , , , E)
6 choices 6 choices 6 choices 6 choices
5 choices 5 choices 5 choices 5 choices
4 choices 4 choices 4 choices 4 choices
82 Counting
Consider lists of the first type, in which the E appears in the first entry.
We have six remaining choices (A,B,C,D,F or G) for the second entry, five
choices for the third entry and four choices for the fourth entry. Hence
there are 6 · 5 · 4 = 120 lists having an E in the first entry. As shown above,
there are also 6 · 5 · 4 = 120 lists having an E in the second, third or fourth
entry. So there are 120 + 120 + 120 + 120 = 480 lists with exactly one E.
(d) Now we seek the number of length-4 lists where repetition is allowed
and the list must contain an E. Here is our strategy: By Part (a) of
this exercise there are 7 · 7 · 7 · 7 = 74 = 2401 lists with repetition allowed.
Obviously this is not the answer to our current question, for many of these
lists contain no E. We will subtract from 2401 the number of lists that do
not contain an E. In making a list that does not contain an E, we have
six choices for each list entry (because we can choose any one of the six
letters A,B,C,D,F or G). Thus there are 6 · 6 · 6 · 6 = 64 = 1296 lists without
an E. So the answer to our question is that there are 2401 − 1296 = 1105
lists with repetition allowed that contain at least one E.
Before moving on from Example 4.3, let’s address an important point.
Perhaps you wondered if Part (d) could be solved in the same way as Part (c).
Let’s try doing it that way. We want to count the length-4 lists (repetition
allowed) that contain at least one E. The following diagram is adapted from
Part (c). The only difference is that there are now seven choices in each slot
because we are allowed to repeat any of the seven letters.
(E, , , ) ( , E, , ) ( , , E, ) ( , , , E)
7 choices 7 choices 7 choices 7 choices
7 choices 7 choices 7 choices 7 choices
7 choices 7 choices 7 choices 7 choices
that avoid the pitfalls of double counting. But before moving on to these
new counting principles, let’s do one more example of the multiplication
principle. It illustrates a pitfall that you should be alert to.
Example 4.4 A non-repetitive list of length 5 is to be made from the
symbols A, B, C, D, E, F,G . The first entry must be either a B, C or D , and
the last entry must be a vowel. How many such lists are possible?
Solution: Start by making a list of five boxes. The first box must contain
either B, C or D , So there are three choices for it.
( , , , , )
3 choices
Now there are 6 letters left for the remaining 4 boxes. The knee-jerk action
is to fill them in, one at a time, using up an additional letter each time.
( , , , , )
3 choices
6 choices
5 choices
4 choices
( , , , , )
3 choices 2 choices
Then fill the remaining middle boxes with the 5 remaining letters.
( , , , , )
3 choices 2 choices
5 choices
4 choices
3 choices
X1 X4
X X ··· Xn
X3
X2 X5
Then we used the multiplication principle to count the lists of type 1. There
are 6 choices for the second entry, 5 for the third, and 4 for the fourth. This
is indicated above, where the number below a box is the number of choices
we have for that position. The multiplication principle implies that there
are 6 · 5 · 4 = 120 lists of type 1. Similarly there are 6 · 5 · 4 = 120 lists of types
2, 3, and 4.
X1 EABC X2 AEBC X3 ABEC X4 ABCE
EACB AECB ACEB ACBE
X EBAC BEAC BAEC BACE
.. .. .. ..
. . . .
86 Counting
The addition principle says that the number of lists that contain an E is
| X | = | X 1 | + | X 2 | + | X 3 | + | X 4 | = 120 + 120 + 120 + 120 = 480.
We use the addition principle when we need to count the number of
things in some set X . If we can find a way to break X up as X = X 1 ∪ X 2 ∪
· · ·∪ X n , where each X i is easier to count than X , then the addition principle
gives an answer of | X | = | X 1 | + | X 2 | + | X 3 | + · · · + | X n |.
But for this to work the intersection of any two pieces X i must be ;.
For instance, if X 1 and X 2 shared an element, then that element would be
counted once in | X 1 | and again in | X 2 |, making | X | < | X 1 | + | X 2 | + · · · + | X n |.
(This is precisely the double counting issue mentioned after Example 4.3.)
Example 4.6 How many even 5-digit numbers are there for which no
digit is 0, and the digit 6 appears exactly once? For instance, 55634 and
16118 are such numbers, but not 63304 (has a 0), nor 63364 (too many 6’s),
nor 55637 (not even).
Solution: Let X be the set of all such numbers. The answer will be | X |, so
our task is to find | X |. Put X = X 1 ∪ X 2 ∪ X 3 ∪ X 4 ∪ X 5 , where X i is the set of
those numbers in X whose i th digit is 6, as diagramed below. Note X i ∩ X j = ;
whenever i 6= j because the numbers in X i have their 6 in a different position
than the numbers in X j . Our plan is to use the multiplication principle to
compute each | X i |, and follow this with the addition principle.
X1 X2 X3 X4 X5
6 6 6 6 6
8 8 8 3 8 8 8 3 8 8 8 3 8 8 8 3 8 8 8 8
The first digit of any number in X 1 is 6, and the three digits following it
can be any of the ten digits except 0 (not allowed) or 6 (already appears).
Thus there are eight choices for each of three digits following the first 6.
But because any number in X 1 is even, its final digit must be one of 2,4
or 8, so there are just three choices for this final digit. By the multiplication
principle, | X 1 | = 8 · 8 · 8 · 3 = 1536. Likewise | X 2 | = | X 3 | = | X 4 | = 8 · 8 · 8 · 3 = 1536.
But X 5 is slightly different because we do not choose the final digit,
which is already 6. The multiplication principle gives | X 5 | = 8 · 8 · 8 · 8 = 4096.
The addition principle gives our final answer. The number of even 5-
digit numbers with no 0’s and one 6 is | X | = | X 1 | + | X 2 | + | X 3 | + | X 4 | + | X 5 | =
1536 + 1536 + 1536 + 1536 + 4096 = 10,240.
The Addition and Subtraction Principles 87
Example 4.7 How many length-4 lists can be made from the symbols
A, B, C, D, E, F,G if the list has at least one E , and repetition is allowed?
Solution: Such a list might contain one, two, three or four E ’s, which could
occur in various positions. This is a fairly complex situation.
But it is very easy to count the set U of all lists of length 4 made from
A, B, C, D, E, F,G if we don’t care whether or not there is an E . The multipli-
cation principle says |U | = 7 · 7 · 7 · 7 = 2401.
It is equally easy to count the set X of those lists that contain no E ’s.
The multiplication principle says | X | = 6 · 6 · 6 · 6 = 1296.
We are interested in those lists that have at least one E , and this is
the set U − X . By the subtraction principle, the answer to our question is
|U − X | = |U | − | X | = 2401 − 1296 = 1105.
4.4 Factorials
In working the examples from the previous two sections, you may have
noticed that we often need to count the number of non-repetitive lists of
length n that are made from n symbols. In This kind of problem occurs so
often that a special idea, called a factorial, is used to handle it.
The table below motivates this. The first column lists successive integer
© ª
values n, from 0 onward. The second contains a set A, B, . . . of n symbols.
The third column shows all the possible non-repetitive lists of length n that
can be made from these symbols. Finally, the last column tallies up how
many lists there are of that type. When n = 0 there is only one list of length
0 that can be made from 0 symbols, namely the empty list ( ). Thus the value
1 is entered in the last column of that row.
For n > 0, the number that appears in the last column can be computed
using the multiplication principle. The number of non-repetitive lists of
length n that can be made from n symbols is n(n − 1)(n − 2) · · · 3 · 2 · 1. Thus, for
instance, the number in the last column of the row for n = 4 is 4 · 3 · 2 · 1 = 24.
The number that appears in the last column of Row n is called the
factorial of n. It is denoted with the special symbol n!, which we pronounce
as “n factorial." Here is the definition:
It follows that 0! = 1
1! = 1
2! = 2·1 = 2
3! = 3·2·1 = 6
4! = 4 · 3 · 2 · 1 = 24
5! = 5 · 4 · 3 · 2 · 1 = 120
6! = 6 · 5 · 4 · 3 · 2 · 1 = 720, and so on.
Students are often tempted to say 0! = 0, but this is wrong. The correct
value is 0! = 1, as the above definition and table show. Here is another way
to see that 0! must equal 1: Notice that 5! = 5 · 4 · 3 · 2 · 1 = 5 · (4 · 3 · 2 · 1) = 5 · 4!.
Also 4! = 4 · 3 · 2 · 1 = 4 · (3 · 2 · 1) = 4 · 3!. Generalizing this, we get a formula.
n! = n · (n − 1)! (4.1)
(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1).
Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q
♥ ♣ ♠ ♦ ♥ ♣ ♦ ♠ ♥ ♠ ♣ ♦ ♥ ♠ ♦ ♣ ♥ ♦ ♣ ♠ ♥ ♦ ♠ ♣
Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q
♠ ♥ ♣ ♦ ♠ ♥ ♦ ♣ ♠ ♣ ♥ ♦ ♠ ♣ ♦ ♥ ♠ ♦ ♥ ♣ ♠ ♦ ♣ ♥
Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q
♦ ♥ ♠ ♣ ♦ ♥ ♣ ♠ ♦ ♣ ♥ ♠ ♦ ♣ ♠ ♥ ♦ ♠ ♣ ♥ ♦ ♠ ♥ ♣
© ª
4! = 24 permutations. The set a, b, c, d, e, f , g has 7! = 5040 permutations,
though there’s not much point in listing them all out. The important thing
is that the factorial counts the number of permutations.
In saying a permutation of a set is an arrangement of its elements in a
row, we are speaking informally because sometimes the elements are not
literally in a row. Imagine a classroom of 20 desks, in four rows of five desks
each. Let X be a class (set) of 20 students. If the students walk in and seat
themselves, one per desk, we still regard this as a permutation of the 20
students because we can number the desks 1, 2, 3, . . . , 20 and in this sense
the students have arranged themselves in a list of length 20. There are
20! = 2, 432, 902, 008, 176, 640, 000 permutations of the students.
92 Counting
a b c d.
ab ac ad ba bc bd ca cb cd da db dc.
Even before writing them all down, we’d know we’d get 12 of them because
in making a non-repetitive length-2 list from X we have 4 choices for the first
element, then 3 choices for the second, so by the multiplication principle
the total number of 2-permutations of X is 4 · 3 = 12.
Now let’s count the number of 3-permutations of X . They are the length-
3 non-repetitive lists made from elements of X . The multiplication principle
says there will be 4 · 3 · 2 = 24 of them. Here they are.
Continuing in this pattern, we will have n − k + 1 choices for the kth (last)
entry. Therefore
P(10, 1) = 10 = 10
P(10, 2) = 10 · 9 = 90
P(10, 3) = 10 · 9 · 8 = 720
P(10, 4) = 10 · 9 · 8 · 7 = 5040
.. .. ..
. . .
P(10, 10) = 10 · 9 · 8 · 7 · 6 · 5 · 4 · 3 · 2 · 1 = 3628800
P(10, 11) = 10 · 9 · 8 · 7 · 6 · 5 · 4 · 3 · 2 · 1 · 0 = 0.
Note P(10, 11) = 0, as the 11th factor in the product is 0. This makes sense
because P(10, 11) is the number of non-repetitive length-11 lists made from
just 10 symbols. There are no such lists, so P(10, 11) = 0 is right. In fact you
can check that Equation (4.2) gives P(n, k) = 0 whenever k > n.
Also notice above that P(10, 10) = 10!. In general P(n, n) = n!.
We now derive another formula for P(n, k). Using Equation (4.2) with
cancellation and the definition of a factorial,
To illustrate, let’s find P(8, 5) in two ways. Equation (4.2) says P(8, 5) =
8! 8! 40, 320
8 · 7 · 6 · 5 · 4 = 6720. By the above formula, P(8, 5) = = = = 6720.
(8 − 5)! 3! 6
94 Counting
n!
P(n, k) = n(n − 1)(n − 2) · · · (n − k + 1) = .
(n − k)!
Notice that P(n, 0) = (n−n!0)! = nn!! = 1, which makes sense because only one
list of length 0 can be made from n symbols, namely the empty list. Also
P(0, 0) = (0−0!0)! = 0! 1
0! = 1 = 1, which is to be expected because there is only one
list length 0 that can be made with 0 symbols, again the empty list.
Example 4.9 Ten contestants run a marathon. All finish, and there are
no ties. How many different possible rankings are there for first-, second-
and third-place?
Solution: Call the contestants A, B, C, D, E, F,G, H, I and J . A ranking of
winners can be regarded as a 3-permutation of the set of 10 contestants.
For example, ECH means E in first-place, C in second-place and H in third.
Thus there are P(10, 3) = 10 · 9 · 8 = 720 possible rankings.
Example 4.10 You deal five cards off of a standard 52-card deck, and line
them up in a row. How many such lineups are there that either consist of
all red cards, or all clubs?
Solution: There are 26 red cards. The number of ways to line up five of
them is P(26, 5) = 26 · 25 · 24 · 23 · 22 = 343, 200.
There are 13 club cards (which are black). The number of ways to line up
five of them is P(13, 5) = 13 · 12 · 11 · 10 · 9 = 154, 440.
By the addition principle, the answer to our question is that there are
P(26, 5) + P(13, 5) = 497, 640 lineups that are either all red cards, or all club
cards.
Notice that we do not need to use the notation P(n, k) to solve the prob-
lems on this page. Straightforward applications of the multiplication and
addition principles would suffice. However, the P(n, k) notation often proves
to be a convenient shorthand.
Counting Permutations 95
(a, b), (a, c), (a, d), (a, e), (b, c), (b, d), (b, e), (c, d), (c, e), (d, e)
(b, a), (c, a), (d, a), (e, a), (c, b), (d, b), (e, b), (d, c), (e, c), (e, d).
The reason that there are more lists than subsets is that changing the
order of the entries of a list produces a different list, but changing the order
of the elements of a set does not change the set. Using elements a, b ∈ A , we
© ª
can make two lists (a, b) and (b, a), but only one subset a, b .
This section is concerned with counting subsets, not lists. As noted above,
the basic question is this: How many subsets can be made by choosing k
elements from an n-element set? We begin with some notation that gives a
name to the answer to this question.
This is illustrated in the following table that tallies the k-element subsets
© ª
of the 4-element set A = a, b, c, d , for various values of k.
© ª ¡4¢
k k-element subsets of A = a, b, c, d k
¡4¢
−1 −1 =0
¡4¢
0 ; 0 =1
© ª© ª© ª© ª ¡4¢
1 a , b , c , d 1 =4
© ª© ª© ª© ª© ª© ª ¡4¢
2 a, b , a, c , a, d , b, c , b, d , c, d 2 =6
© ª© ª© ª© ª ¡4¢
3 a, b, c , a, b, d , a, c, d , b, c, d 3 =4
© ª ¡4¢
4 a, b, c, d 4 =1
¡4¢
5 5 =0
Counting Subsets 97
The values of k appear in the far-left column of the table. To the right of
each k are all of the subsets (if any) of A of size k. For example, when k = 1,
© ª © ª © ª © ª
set A has four subsets of size k, namely a , b , c and d . Therefore
¡4¢ ¡4¢
1 = 4. When k = 2 there are six subsets of size k so 2 = 6.
When k = 0, there is only one subset of A that has cardinality k, namely
the empty set, ;. Therefore 40 = 1.
¡ ¢
Although it was not hard to work out the values of 4k by writing out
¡ ¢
subsets in the above table, this method of actually listing sets would not
be practical for computing nk when n and k are large. We need a formula.
¡ ¢
To find one, we will now carefully work out the value of 53 in a way that
¡ ¢
column under each subset tallies the 3! = 6 permutations of that set. The
© ª
first subset a, b, c has 3! = 6 permutations, and these are listed below it.
© ª
The second column tallies the permutations of a, b, d , and so on.
¡5¢
3
© ª© ª© ª© ª© ª© ª© ª© ª© ª© ª
a,b,c a,b,d a,b,e a,c,d a,c,e a,d,e b,c,d b,c,e b,d,e c,d,e
abc abd abe acd ace ade bcd bce bde cde
acb adb aeb adc aec aed bdc bec bed ced
bac bad bae cad cae dae cbd cbe dbe dce
3!
bca bda bea cda cea dea cdb ceb deb dec
cba dba eba dca eca eda dcb ecb edb edc
cab dab eab dac eac ead dbc ebc ebd ecd
The body of this table has 53 columns and 3! rows, so it has a total of
¡ ¢
3! 53 lists. But notice also that the table consists of every 3-permutation of
¡ ¢
a, b, c, d, e . Fact 4.4 says that there are P(5, 3) = (5−5!3)! such 3-permutations.
© ª
Thus the total number of lists in the table can be written as either 3! 53 or
¡ ¢
5!
¡5 ¢ 5!
(5−3)! , which is to say 3! 3 = (5−3)! . Dividing both sides by 3! yields
à !
5 5!
= .
3 3!(5 − 3)!
Working this out, you will find that it does give the correct value of 10.
98 Counting
But there was nothing special about the values 5 and 3. We could do the
above analysis for any nk instead of 53 . The table would have nk columns
¡ ¢ ¡ ¢ ¡ ¢
Answer: There are 2,598,960 different five-card hands that can be dealt
from a deck of 52 cards.
Counting Subsets 99
Example 4.14 This problem concerns 5-card hands that can be dealt off
of a 52-card deck. How many such hands are there in which two of the cards
are clubs and three are hearts?
Solution: Such a hand is described by a list of length two of the form
µ½ ¾ ½ ¾¶
∗ ∗ ∗ ∗ ∗
, , , , ,
♣ ♣ ♥ ♥ ♥
where the first entry is a 2-element subset of the set of 13 club cards, and
the second entry is a 3-element subset of the set of 13 heart cards. There
are 13
¡ ¢ ¡13¢
2 choices for the first entry and
¡13¢¡133¢
choices for the second, so by the
13! 13!
multiplication principle there are 2 3 = 2!11! 3!10! = 22, 308 such lists.
Answer: There are 22, 308 such 5-card hands.
Example 4.15 A lottery features a bucket of 36 balls numbered 1 through
36. Six balls will be drawn randomly. For $1 you buy a ticket with six blanks:
ä ä ä ä ä ä . You fill in the blanks with six different numbers between 1
and 36. You win $1, 000, 000 if you chose the same numbers that are drawn,
regardless of order. What are your chances of winning?
Solution: In filling out the ticket you are choosing six numbers from a set of
36 numbers. Thus there are 36 36!
¡ ¢
6 = 6!(36−6)! = 1, 947, 792 different combinations
of numbers you might write. Only one of these will be a winner. Your
chances of winning are one in 1, 947, 792.
Example 4.16 How many 7-digit binary strings (0010100, 1101011, etc.)
have an odd number of 1’s?
Solution: Let A be the set of all 7-digit binary strings with an odd number
of 1’s, so the answer will be | A |. To find | A |, we break A into smaller parts.
Notice any string in A will have either one, three, five or seven 1’s. Let A 1 be
the set of 7-digit binary strings with only one 1. Let A 3 be the set of 7-digit
binary strings with three 1’s. Let A 5 be the set of 7-digit binary strings with
five 1’s, and let A 7 be the set of 7-digit binary strings with seven 1’s. Then
A = A 1 ∪ A 3 ∪ A 5 ∪ A 7 . Any two of the sets A i have empty intersection, so the
addition principle gives | A | = | A 1 | + | A 3 | + | A 5 | + | A 7 |.
Now we must compute the individual terms of this sum. Take A 3 , the
set of 7-digit binary strings with three 1’s. Such a string can be formed by
selecting three out of seven positions for the 1’s and putting 0’s in the other
spaces. Thus | A 3 | = 73 . Similarly | A 1 | = 71 , | A 5 | = 75 , and | A 7 | = 77 .
¡ ¢ ¡ ¢ ¡ ¢ ¡ ¢
Answer: | A | = | A 1 | + | A 3 | + | A 5 | + | A 7 | = 71 + 73 + 75 + 77 = 7 + 35 + 21 + 1 = 64.
¡ ¢ ¡ ¢ ¡ ¢ ¡ ¢
5. How many 16-digit binary strings contain exactly seven 1’s? (Examples of such
strings include 0111000011110000 and 0011001100110010, etc.)
6. ¯ X ∈ P ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) : | X | = 4 ¯ =
¯© © ª ª¯
7. ¯ X ∈ P ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) : | X | < 4 ¯ =
¯© © ª ª¯
14. Suppose n, k ∈¡ Z¢, and 0 ≤ k ≤ n. Use Definition 4.2 alone (without using Fact 4.5)
to show that nk = n−n k .
¡ ¢
15. How many 10-digit binary strings are there that do not have exactly four 1’s?
© ª
16. How many 6-element subsets of A = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 have exactly three even
elements? How many do not have exactly three even elements?
17. How many 10-digit binary strings are there that have exactly four 1’s or exactly
five 1’s? How many do not have exactly four 1’s or exactly five 1’s?
18. How many 10-digit binary strings have an even number of 1’s?
19. A 5-card poker hand is called a flush if all cards are the same suit. How many
different flushes are there?
Pascal’s Triangle and the Binomial Theorem 101
Any number n+k 1 for 0 < k < n in this pyramid is just below and between
¡ ¢
the two numbers k−n 1 and nk in the previous row. But Equation (4.3) says
¡ ¢ ¡ ¢
¡n+1¢ ¡ n ¢ ¡n¢
k = k−1 + k . Therefore any number (other than 1) in the pyramid is
the sum of the two numbers immediately above it.
102 Counting
This pattern is especially evident on the right of Figure 4.3, where each
¡ n¢
k is worked out. Notice how 21 is the sum of the numbers 6 and 15 above
it. Similarly, 5 is the sum of the 1 and 4 above it and so on.
This arrangement is called Pascal’s triangle, after Blaise Pascal, 1623–
1662, a French philosopher and mathematician who discovered many of its
properties. We’ve shown only the first eight rows, but the triangle extends
downward forever. We can always add a new row at the bottom by placing
a 1 at each end and obtaining each remaining number by adding the two
numbers above its position. Doing this In Figure 4.3 (right) gives a new
bottom row
1 8 28 56 70 56 28 8 1.
them without the formula k = k!(88!−k)! . Any nk can be computed this way.
¡8¢ ¡ ¢
The very top row (containing only 1) of Pascal’s triangle is called Row 0.
Row 1 is the next down, followed by Row 2, then Row 3, etc. Thus Row n
lists the numbers nk for 0 ≤ k ≤ n. Exercises 4.6.13 and 4.6.14 established
¡ ¢
à ! à !
n n
= , (4.4)
k n−k
1 1
1 1 1x + 1y
1 2 1 1 x2 + 2 x y + 1 y2
1 3 3 1 1 x3 + 3 x2 y + 3 x y2 + 1 y3
1 4 6 4 1 1 x4 + 4 x3 y + 6 x2 y2 + 4 x y3 + 1 y4
1 5 10 10 5 1 1 x5 + 5 x4 y + 10 x3 y2 + 10 x2 y3 + 5 x y4 + 1 y5
.. .. .. .. .. ..
. . . . . .
Figure 4.4. The n th row of Pascal’s triangle lists the coefficients of (x + y)n
In fact this turns out to be true for every n. This fact is known as the
binomial theorem, and it is worth mentioning here. It tells how to raise
a binomial x + y to a non-negative integer power n.
Theorem 4.1 (Binomial Theorem) If n is a non-negative integer, then
¡ n¢ ¡ n¢
y + n2 x n−2 y2 + n3 x n−3 y3 + · · · + n−
¡ n ¢ n−1 ¡n¢ n
(x + y)n = xn + n−1
¡ ¢ ¡ ¢
0 1 x 1 xy + n y .
For now we will be content to accept the binomial theorem without proof.
(You will be asked to prove it in an exercise in Chapter 14.) You may find it
useful from time to time. For instance, you can use it if you ever need to
expand an expression such as (x + y)7 . To do this, look at Row 7 of Pascal’s
triangle in Figure 4.3 and apply the binomial theorem to get
8. Use Fact 4.5 (page 98) to derive Equation 4.3 (page 101).
Use the binomial theorem to show n0 − n1 + n2 − n3 + n4 − · · · + (−1)n nn = 0.
¡ ¢ ¡ ¢ ¡ ¢ ¡ ¢ ¡ ¢ ¡ ¢
9.
10. Show that the formula k nk = n nk−−11 is true for all integers n, k with 0 ≤ k ≤ n.
¡ ¢ ¡ ¢
A B
Notice that the sets A , B and A ∩ B are all generally smaller than A ∪ B,
so Fact 4.6 has the potential of reducing the problem of determining | A ∪ B|
to three simpler counting problems. It is called the inclusion-exclusion
formula because elements in A ∩ B are included (twice) in | A | + |B|, then
excluded when | A ∩ B| is subtracted. Notice that if A ∩ B = ;, then we do
in fact get | A ∪ B| = | A | + |B|. (This is an instance of the addition principle!)
Conversely, if | A ∪ B| = | A | + |B|, then it must be that A ∩ B = ;.
Example 4.17 A 3-card hand is dealt off of a standard 52-card deck. How
many different such hands are there for which all 3 cards are red or all
three cards are face cards?
Solution: Let A be the set of 3-card hands where all three cards are red
(i.e., either ♥ or ♦). Let B be the set of 3-card hands in which all three cards
are face cards (i.e., J,K or Q of any suit). These sets are illustrated below.
(( ) ( ) ( ) )
5 K 2 K J Q A 6 6
A = , , , , , , , , ,... (Red cards)
♥ ♦ ♥ ♥ ♥ ♥ ♦ ♦ ♥
(( ) ( ) ( ) )
K K J K J Q Q Q Q
B = , , , , , , , , ,... (Face cards)
♠ ♦ ♣ ♥ ♥ ♥ ♦ ♣ ♥
The Inclusion-Exclusion Principle 105
We seek the number of 3-card hands that are all red or all face cards, and
this number is | A ∪ B|. By Fact 4.6, | A ∪ B| = | A | + |B| − | A ∩ B|. Let’s examine
| A |, |B| and | A ∩ B| separately. Any hand in A is formed by selecting three
cards from the 26 red cards in the deck, so | A | = 26
¡ ¢
3 . Similarly, any hand in
B is formed by selecting three cards from the 12 face cards in the deck, so
|B| = 12
¡ ¢
3 . Now think about A ∩ B. It contains all the 3-card hands made up
of cards that are red face cards.
(( ) ( ) ( ) )
K K J K J Q Q J Q (Red face
A∩B = , , , , , , , , , ,...
♥ ♦ ♥ ♥ ♥ ♥ ♦ ♦ ♥ cards)
¡6¢
The deck has only 6 red face cards, so | A ∩ B| = 3 .
Now we can answer our question. The number of 3-card hands that are
all red or all face cards is | A ∪ B| = | A | + |B| − | A ∩ B| = 26
¡ ¢ ¡12¢ ¡6¢
3 + 3 − 3 = 2600 +
220 − 20 = 2800.
Example 4.18 A 3-card hand is dealt off of a standard 52-card deck. How
many different such hands are there for which it is not the case that all 3
cards are red or all three cards are face cards?
Solution: We will use the subtraction principle combined with our answer
to Example 4.17, above. The total number of 3-card hands is 52 52!
¡ ¢
3 = 3!(52−3)! =
52! 52·51·50
3!49! = 3! = 26 · 51 · 17 = 22, 542. To get our answer, we must subtract from
this the number of 3-card hands that are all red or all face cards, that is,
we must subtract the answer from Example 4.17. Thus the answer to our
question is 22, 542 − 2800 = 19, 742.
There is an analogue of Fact 4.6 that involves three sets. Consider three
sets A , B and C , as represented in the following Venn Diagram.
A B
Using the same kind of reasoning that resulted in Fact 4.6, you can convince
yourself that
| A ∪ B ∪ C | = | A | + | B | + | C | − | A ∩ B | − | A ∩ C | − | B ∩ C | + | A ∩ B ∩ C |. (4.5)
106 Counting
There’s probably not much harm in ignoring this one for now, but if you
find this kind of thing intriguing you should definitely take a course in
combinatorics. (Ask your instructor!)
But this is not a valid model of your collection of change, because a set
cannot have repeated elements. To overcome this difficulty, we make a new
construction called a multiset. A multiset is like a set, except that elements
©ª
can be repeated. We will use square brackets [ ] instead of braces to denote
multisets. For example, your multiset of change is
£ ¤
1, 1, 1, 1, 5, 5, 10, 25, 25 .
A multiset is a hybrid of a set and a list; elements can be repeated, but order
does not matter. Thus we have
¤ £ ¤
[1, 1, 1, 1, 5, 5, 10, 25, 25 = 25, 5, 1, 1, 10, 1, 1, 5, 25
£ ¤
= 25, 10, 25, 1, 5, 1, 5, 1, 1 .
[a, a] [a, b] [a, c] [a, d] [b, b] [b, c] [b, d] [c, c] [c, d] [d, d],
where we have listed them so that the letters in each multiset are in alpha-
betical order (remember, we can order the elements of a multiset in any way
we choose), and the 10 multisets are arranged in dictionary order.
© ª
For multisets of cardinality 3 made from a, b, c, d , we have
© ª
Though X = a, b, c, d has no subsets of cardinality 5, there are many
multisets of cardinality 5 made from these elements, including [a, a, a, a, a],
[a, a, b, c, d] and [b, c, c, d, d], and so on. Exactly how many are there?
This is the first question about multisets that we shall tackle: Given a
finite set X , how many cardinality-k multisets can be made from X ?
Let’s start by counting the cardinality-5 multisets made from symbols
© ª
X = a, b, c, d . (Our approach will lead to a general formula.) We know we
can write any such multiset with its letters in alphabetical order. Tweaking
the notation slightly, we could write any such multiset with bars separating
the groupings of a, b, c, d , as shown in the table below. Notice that if a
symbol does not appear in the multiset, we still write the bar that would
have separated it from the others.
This suggests that we can encode the multisets as lists made from the two
symbols ∗ and |, with an ∗ for each element of the multiset, as follows.
For examples see right-hand column of the table. Any such encoding is a
list made from 5 stars and 3 bars, so the list has a total of 8 entries. How
many such lists are there? We can form such a list by choosing 3 of the 8
positions for the bars, and filling the remaining three positions with stars.
Therefore the number of such lists is 83 = 3!5!8!
¡ ¢
= 56.
That is our answer. There are 56 cardinality-5 multisets that can
be made from the symbols in X = {a, b, c, d }.
If we wanted to count the cardinality-3 multisets made from X , then the
exact same reasoning would apply, but with 3 stars instead of 5. We’d be
counting the length-6 lists with 3 stars and 3 bars. There are 63 = 3!3!
6!
¡ ¢
= 20
such lists. So there are 20 cardinality-3 multisets made from X = {a, b, c, d }.
This agrees with our accounting on the previous page.
Counting Multisets 109
Such a list has k stars (one for each element of the multiset) and n − 1
separating bars (a bar between each of the n groupings of stars). Therefore
its length is k + n − 1. We can make such a list by selecting n − 1 spots out of
k + n − 1 for the bars and inserting stars in the left-over spots. Thus there
are k+n−n−1 1 such lists. Alternatively we could choose k spots for the stars
¡ ¢
and fill in the remaining k with bars, so there are k+kn−1 such lists. Note
¡ ¢
Fact 4.7 The number of k-element multisets that can be made from the
© ª
elements of an n-element set X = x1 , x2 , . . . , xn is
à ! à !
k+n−1 k+n−1
= .
k n−1
This works because any cardinality-k multiset made from the n elements
of X can be encoded in a star-and-bar list of length k + n − 1, having form
For example, the number of 2-element multisets that can be made from
the 4-element set X = {a, b, c, d } is 2+42−1 = 52 = 10. This agrees with our
¡ ¢ ¡ ¢
Indeed, the four multisets are [a], [b], [c] and [d]. The number of 0-element
multisets made from X is 0+40−1 = 30 = 1. This is right, because there is
¡ ¢ ¡ ¢
[ R, R, R, R, R, R, R, R, R, R, R,G,G,G,G, B, B, B, B, B ].
[ R, R, R, R, R, R, R, R, R, R, B, B, B, B, B, B, B, B, B, B ].
made from the elements of the 3-element set X = {R,G, B}. By Fact 4.7, the
answer is 20+203−1 = 22
¡ ¢ ¡ ¢
20 = 231 possible outcomes.
Example 4.20 How many non-negative integer solutions does the equa-
tion w + x + y + z = 20 have?
Solution: We can model a solution with stars and bars. For example,
encode the solution (w, x, y, z) = (3, 4, 5, 8) as
3 4 5 8
z }| { ¯ z }| { ¯ z }| { ¯ z }| {
∗ ∗ ∗ ¯ ∗ ∗ ∗∗ ¯ ∗ ∗ ∗ ∗ ∗ ¯ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗ .
where all together there are 20 stars and 3 bars. So, for instance the solution
(w, x, y, z) = (0, 0, 10, 10) gets encoded as ||∗∗∗∗∗∗∗∗∗∗|∗∗∗∗∗∗∗∗∗∗. Thus
we can describe any non-negative integer solution to the equation as a list
of length 20 + 3 = 23 that has 20 stars and 3 bars. We can make any such
list by choosing 3 out of 23 spots for the stars, and filling the remaining
three spots with bars. The number of ways to do this is 23 23! 23·22·21
¡ ¢
3 = 3!20! = 3· 2 =
23 · 11 · 7 = 1771.
For example, here are some lists, paired with their encodings.
(2, 3, 6, 9) ∗ ∗ | ∗ | ∗ ∗ ∗ | ∗ ∗ ∗ |∗
(0, 3, 3, 7) | ∗ ∗ ∗ | | ∗ ∗ ∗ ∗ | ∗ ∗∗
(1, 1, 1, 1) ∗ | | | | ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗
Such encodings are lists of length 14, with 10 stars and 4 bars. We can
make such a list by choosing 4 of the 14 slots for the bars and filling the
remaining slots with stars. The number of ways to do this is 14
¡ ¢
4 = 1001.
Answer: There are 1001 such lists.
We will examine one more type of multiset problem. To motivate it,
consider the permutations of the letters of the word “BOOK.” At first glance
there are 4 letters, so we should get 4! = 24 permutations. But this is not
quite right. The problem is that two of the letters are identical. We could
interchange the two O’s but still have the same permutation. To get a grip
on the problem, lets make one of the letters lower-case: BOoK. Now our 24
permutations are listed below in the oval.
BOoK KOoB OoKB OoBK OBoK OKoB OKBo OBKo BKOo KBOo KOBo BOKo
BoOK KoOB oOKB oOBK oBOK oKOB oKBO oBKO BKoO KBoO KoBO BoKO
BOOK KOOB OOKB OOBK OBOK OKOB OKBO OBKO BKOO KBOO KOBO BOKO
The columns in the oval correspond to the same permutation of the letters
of BOOK, as indicated in the row below the oval. Thus there are actually
4! 24
2 = 2 = 12 permutations of the letters of BOOK.
This is actually a problem involving multisets. The letters in “BOOK”
£ ¤
form a multiset B,O,O,K , and we have determined that there are 12
permutations of this multiset.
For another motivational example, consider the permutations of the
letters of the word BANANA. Here there are two N’s and three A’s. Though
some of the letters look identical, think of them as distinct physical objects
that we can permute into different orderings. It helps to subscript the
letters to emphasize that they are actually six distinct objects:
B A1 N1 A2 N2 A3 .
Now, there are 6! = 720 permutations of these six letters. It’s not practical
to write out all of them, but we can get a sense of the problem by making a
partial listing in the box below.
Counting Multisets 113
B A1 N1 A2 N2 A3 A1 B N1 A2 N2 A3
···
B A1 N1 A3 N2 A2 A1 B N1 A3 N2 A2
B A2 N1 A1 N2 A3 A2 B N1 A1 N2 A3
···
B A2 N1 A3 N2 A1 A2 B N1 A3 N2 A1
B A3 N1 A2 N2 A1 A3 B N1 A2 N2 A1
···
B A3 N1 A1 N2 A2 A3 B N1 A1 N2 A2 720 permutations
B A1 N2 A2 N1 A3 A1 B N2 A2 N1 A3 of B A1 N1 A2 N2 A3
···
B A1 N2 A3 N1 A2 A1 B N2 A3 N1 A2
B A2 N2 A1 N1 A3 A2 B N2 A1 N1 A3
···
B A2 N2 A3 N1 A1 A2 B N2 A3 N1 A1
B A3 N2 A2 N1 A1 A3 B N2 A2 N1 A1
···
B A3 N2 A1 N1 A2 A3 B N2 A1 N1 A2
BANANA ABNANA
n!
.
p1 ! p2 ! · · · p k !
The division principle has a useful variant. Note that if n > k, then nk > 1,
so d nk e > 1, and this means some box contains more than one object. On the
other hand, if n < k then nk < 1, so b nk c < 1, meaning one box is empty. Thus
the division principle yields the following consequence, called the pigeonhole
principle.
then some box gets more than one pigeon. And if there are fewer pigeons
than boxes (n < k) then there must be at least one empty box.
Like the multiplication, addition and subtraction principles, the division
and pigeonhole principles are intuitive and obvious, but they can prove
things that are not obvious. The challenge is seeing where and how to apply
them. Our examples will start simple and get progressively more complex.
For an extremely simple application, notice that in any group of 13
people, at least two of them were born on the same month. Although this is
obvious, it really does follow from the pigeonhole principle. Think of the 13
people as objects, and put each person in the “box” that is his birth month.
As there are more people than boxes (months), at least one box (month) has
two or more people in it, meaning at least two of the 13 people were born in
the same month.
Continuing this example, for any group of 100 people, the division prin-
ciple says that there is a month in which d 100
12 e = 9 or more of the people were
born. It also guarantees a month in which b 100 12 c = 8 or fewer of the people
were born.
Example 4.24 Show that if you pick six numbers between 0 and 9 (inclu-
sive), then two of them add up to 9.
For example, suppose you picked 0, 1, 3, 5, 7 and 8. Then 1 + 8 = 9. If you
picked 4, 5, 6, 7, 8, 9. Then 4 + 5 = 9. The problem asks us to show that this
happens no matter how we pick the numbers.
Solution: Pick six numbers between 0 and 9. Here’s why two of them sum
to 9: Imagine five boxes, each marked with two numbers, as shown below.
Each box is labeled so that the two numbers written on it sum to 9.
0, 9 1, 8 2, 7 3, 6 4, 5
For each number that was picked, put it in the box having that number
written on it. For example, if we picked 7, it goes in the box labeled “2, 7.”
(The number 2, if picked, would go in that box too.) In this way we place the
six chosen numbers in five boxes. As there are more numbers than boxes,
the pigeonhole principle says that some box has more than one (hence two)
of the picked numbers in it. Those two numbers sum to 9.
Notice that if we picked only five numbers from 0 to 9, they might not
sum to 9. We could be unlucky and pick 0, 1, 2, 3, 4. But the pigeonhole
principle ensures that if six are picked then two do sum to 9.
The Division and Pigeonhole Principles 117
Solution: Let n be the number of gumballs that you buy. Imagine sorting
your n gumballs into four boxes labeled RED, GREEN, BLUE, and WHITE.
(That is, red balls go in the red box, green balls go in the green box, etc.)
The division principle says that one box contains d n4 e or more gumballs.
Provided d n4 e ≥ 13, you will know you have 13 gumballs of the same color.
This happens if n4 > 12 (so the ceiling of n4 rounds to a value larger than 12).
Therefore you need n > 4 · 12 = 48, so if n = 49 you know you have at least
d 49
4 e = d12.25e = 13 gumballs of the same color.
Answer: Buy 49 gumballs for 49 nickels, which is $2.45. You get $5, and
therefore have made $2.55.
Note that if you bought just 48 gumballs, you might win, but there is a
chance that you’d get 12 gumballs of each color and miss out on the $5. And
if you bought more than 49, you’d still get the $5, but you would have spent
more nickels.
Example 4.26 Nine points are randomly placed on the right triangle
shown below. Show that three of these points form a triangle whose area is
1
8 square unit or less.
1
| {z }
1
the area of the “box” that it is in. Thus these three
points form a triangle whose area is 81 or less.
There we argued that the left-hand side n+k 1 is, by definition, the number
¡ ¢
© ª
of k-element subsets of the set S = 0, 1, 2, . . . , n with |S | = n + 1. But the right-
hand side also gives the number of k-element subsets of S , because such a
subset either contains 0 or it does not. We can make any k-element subset of
S that contains 0 by starting with 0 and selecting k − 1 other elements from
© ª ¡ n ¢
1, 2, . . . , n , in k−1 ways. We can make©any k-element subset that does not
contain 0 by selecting k elements from 1, 2, . . . , n , and there are nk ways to
ª ¡ ¢
do this. Thus:
à ! à ! à !
n+1 n n
= +
k k−1 k
| {z } | {z } | {z }
number of number of number of
k-element k-element k-element
subsets of S subsets of S subsets of S
with 0 without 0
Both sides count the number of k-element subsets of S , so they are equal.
This is combinatorial proof.
¡ n¢ ¡ n ¢
Example 4.27 Use combinatorial proof to show k = n− k .
Solution. First, by definition, if k < 0 or k > n, then both sides are 0, and
thus equal. Therefore for the rest of the proof we can assume 0 ≤ k ≤ n.
The left-hand side nk is the number of k-element subsets of S = 1, 2, . . . , n .
¡ ¢ © ª
But you may feel that the combinatorial proof is “slicker” because it uses
the meanings of the terms. Often it is flat-out easier than using formulas,
as in the next example.
120 Counting
n ¡ ¢2
P n ¡2 n ¢
Our next example will prove that k = n , for any positive integer n,
k=0
¡n¢2 ¡n¢2 ¡n¢2 ¡n¢2 ¡2n¢
which is to say that 0 + 1 + 2 +· · ·+ n = n . For example, if n = 5, this
and this is true, as both sides equal 252. In general, the statement says the
the squares of the entries in the nth row of Pascal’s triangle add up to 2nn .
¡ ¢
n n 2
à ! à !
X 2n
Example 4.28 Use a combinatorial proof to show that = .
k=0 k n
First, the right-hand side 2nn is the number of ways to select n things
¡ ¢
n−1 from B
n−2 from B
n−3 from B
0 from B
0 from A
1 from A
2 from A
3 from A
n from A
n ¢ ¡ n¢
¡ ¡n¢¡n¢ ¡n¢¡n¢ ¡n¢¡n¢ ¡n¢¡n¢
But because n− k = k , this expression equals 0 0 + 1 1 + 2 2 +· · ·+ n n ,
¡n¢2 ¡n¢2 ¡n¢2 ¡n¢2 P n ¡ ¢2
n
which is 0 + 1 + 2 +···+ n = k .
k=0
In summary, we’ve counted the ways to choose n elements from the set
¡2n¢ n ¡ ¢2
P n
S with two methods. One method gives n , and the other gives k .
k=0
Therefore
n ¡ ¢2
P
k=0
n
k =
¡2n¢
n .
We will not do any exercises for combinatorial proof, but be on the lookout
for opportunities to use it.