0% found this document useful (0 votes)
2 views

CSC 203 - Lecture 4

This document discusses various counting techniques in mathematics, including the product and sum rules, permutations and combinations, combinatorial identities, and the inclusion-exclusion principle. It provides definitions, examples, and applications of these techniques to solve counting problems. The content aims to enhance understanding of counting methods and their practical applications in different scenarios.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

CSC 203 - Lecture 4

This document discusses various counting techniques in mathematics, including the product and sum rules, permutations and combinations, combinatorial identities, and the inclusion-exclusion principle. It provides definitions, examples, and applications of these techniques to solve counting problems. The content aims to enhance understanding of counting methods and their practical applications in different scenarios.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

4.

0 APPLICATIONS TO COUNTING

CONTENTS

1.0 Introduction
2.0 Objectives
3.0 Main Content
3.1 The Product and Sum Rules
3.2 Permutations and Combinations
3.3 Combinatorial Identities
3.3.1 Using Pascal’s triangle to expand a binomial expression
3.4 Inclusion-Exclusion Principle
4.0 Conclusion
5.0 Summary
6.0 Tutor-Marked Assignment
7.0 References/Further Reading

1.0 Introduction
Counting is a basic mathematical tool that has uses in many diverse circumstances.
How much RAM can a 32-bit register address? How many poker hands form full
houses compared to flushes? How many ways can ten-coin tosses end up with four
heads? To count, we can always take the time to enumerate all the possibilities;
but even just enumerating all poker hands is already daunting, let alone all 32-bit
addresses. This unit discusses some techniques that serve as useful shortcuts for
counting.
2.0 Objectives
By the end of this unit, you will be able to:
• apply product and sum rules
• discuss permutation and combination
• use Pascal’s triangle to expand a binomial expression
• identify and apply inclusion-exclusion and pigeonhole principle.
3.0 Main Content
3.1 The Product and Sum Rules
The product and sum rules represent the most intuitive notions of counting.
Suppose there are n(A) ways to perform task A, and regardless of how task A is
performed, there are n(B) ways to perform task B.

Then, there are n(A) n(B) ways to perform both task A and task B; this is the
product rule. This can generalize to multiple tasks, e.g., n(A) n(B) n(C) ways
to perform task A, B, and C, as long as the independence condition holds, e.g., the
number of ways to perform task C does not depend on how task A and B are done.
Example 3.1.1. On an 8 × 8 chess board, how many ways can I place a pawn and
a rook?
Example 3.1.1. 1. First I can place the pawn anywhere on the board; there are 64
ways. Then I can place the rook anywhere except where the pawn is; there are 63
ways. In total, there are 64 × 63 = 4032 ways.
Example 3.1.2. On an 8 × 8 chess board, how many ways can I place a pawn and a
rook so that the rook does not threaten the pawn?
Solution 3.1.2. Firstly, I can place the rook anywhere on the board; there are 64
ways. At the point, the rook takes up on square, and threatens 14 others (7 in its
row and 7 in its column). Therefore, I can then place the pawn on any of the 64 −
14 − 1 = 49 remaining squares. In total, there are 64 × 49 = 3136 ways.
Example 3.1.3. If a finite set A has n elements, then |P(A)| = 2n.
Solution 3.1.3. We can proof this by using the product rule. P(A) is the set of all
subsets of A. To form a subset of A, each of the n elements can either be in the
subset or not (2 ways). Therefore, there are 2n possible ways to form unique
subsets, therefore, |P(A)| = 2n.
Example 3.1.4. How many legal configurations are there in the towers of Hanoi?
Solution 3.1.4. Each of the n rings can be on one of three poles, giving us 3n
configurations. Normally we would also need to count the height of a ring relative
to other rings on the same pole, but in the case of the towers of Hanoi, the rings
sharing the same pole must be ordered in a unique fashion: from small at the top
to large at the bottom.
The sum rule is probably even more intuitive than the product rule. Suppose there
are n(A) ways to perform task A, and distinct from these, there are n(B) ways to
perform task B. Then, there are n(A) + n(B) ways to perform task A or task B.
This can generalize to multiple tasks, e.g., n(A) + n(B) + n(C) ways to perform
task A, B, or C, as long as the distinct condition holds, e.g., the ways to perform
task C are different from the ways to perform task A or B.

Example 3.1.5. To fly from Lagos to Brisbane you must fly through Istanbul or Dubai.

Solution 3.1.5. There are 5 such flights a day through Istanbul, and 3 such flights
a day through Dubai. How many different flights are there in a day that can take
you from Lagos to get to Brisbane? The answer is 5 + 3 = 8.

Example 3.1.6. How many 4- to 6-digit pin codes are there?


Solution 3.1.6. By the product rule, the number of distinct n digit pin codes is 10n
(each digit has 10 possibilities). By the sum rule, we have 104 + 105 + 106 number
of 4- to 6digit pin codes (to state the obvious, we have implicitly used the fact that
every 4-digit pin code is different from every 5-digit pin code).

3.2 Permutations and Combinations


Permutations and combinations are also tools for counting. Given n distinct
objects, how many ways are there to “choose” r of them? Well, it depends on
whether the r chosen objects are ordered or not. For example, suppose we deal
three cards out of a standard 52card deck. If we are dealing one card each to Alice,
Bob and Cathy, then the order of the cards being dealt matters; this is called a
permutation of 3 cards. On the other hand, if we are dealing all three cards to
Alice, then the order of the cards being dealt does not matter; this is called a
combination of 3 cards.
3.2.1. Permutations
Definition 3.2.1.1. A permutation of a set A is an ordered arrangement of the
elements in A. An ordered arrangement of just r elements from A is called an r-
permutation of A. For non-negative integers r ≤ n, P(n, r) denotes the number of
r-permutations of a set with n elements.

What is P(n, r)? To form an r-permutation from a set A of n elements, we can start
by choosing any element of A to be the first in our permutation; there are n
possibilities. The next element in the permutation can be any element of A except
the one that is already taken; there are n−1 possibilities. Continuing the argument,
the final element of the permutation will have n − (r − 1) possibilities. Applying
the product-rule, we have:

Note that 0! = 1.

Example 3.2.1.1. How many one-to-one functions are there from a set A with m
elements to a set B with n elements?

Solution 3.2.1.1. If m > n we know there are no such one-to-one functions. If m ≤


n, then each one-to-one function f from A to B is a m-permutation of the elements
of B: we choose m elements from B in an ordered manner (e.g., first chosen
element is the value of f on the first element in A). Therefore there are P(n, m)
such functions.
Example 3.2.2.1. How many poker hands (i.e., sets of 5 cards) can be dealt from a
standard deck of 52 cards?
Solution 3.2.2.1. Exactly C(52, 5) = 52!/(47!5!).
Example 3.2.2.2. How many full houses (3 of a kind and 2 of another) can be dealt from
a standard deck of 52 cards?
Solution 3.2.2.2. We have 13 denominations (ace to king), and 4 suites (spades, hearts,
diamonds and clubs). To count the number of full houses, we may
i. First pick a denomination for the “3 of a kind”: there are 13 choices. ii.
Pick 3 cards from this denomination (out of 4 suites): there are C(4, 3) = 4
choices.
iii. Next pick a denomination for the “2 of a kind”: there are 12 choices left (different
from the “3 of a kind”).
iv. Pick 2 cards from this denomination: there are C(4, 2) = 6 choices.
So in total there are 13 ∗ 4 ∗ 12 ∗ 6 = 3744 possible full houses.
3.3 Combinatorial Identities
There are many identities involving combinations. These identities are fun to learn
because they often represent different ways of counting the same thing; 66
counting one can also prove these identities by churning out the algebra, but that
is boring. We start with a few simple identities.

Lemma 3.1. If 0 ≤ k ≤ n, then C(n, k) = C(n, n − k).


Proof. Each unordered selection of k elements has a unique complement: an
unordered selection of n − k elements. So instead of counting the number of
selections of k elements from n, we can count the number of selections of n−k
elements from n (e.g., to deal 5 cards from a 52 card deck is the same as to throw
away 52 − 5 = 47 cards).
An algebraic proof of the same fact (without much insight) goes as follows:

Lemma 3.2. (Pascal’s Identity). If 0 < k ≤ n, then C(n + 1, k) = C(n, k − 1) + C(n, k).
Proof. Here is another way to choose k elements from n + 1 total element. Either the n +
1st element is chosen or not:

i. If it is, then it remains to choose k−1 elements from the first n


elements. ii. If it isn’t, then we need to choose all k elements from
the first n elements.
By the sum rule, we have C(n + 1, k) = C(n, k − 1) + C(n, k).

Pascal’s identity, along with the initial conditions C(n, 0) = C(n, n) = 1, gives a
recursive way of computing the binomial coefficients C(n, k). The recursion table
is often written as a triangle, called Pascal’s Triangle; as shown in Figure 3.1.
Lemma 3 n.

Proof. Let us once again count the number of possible subsets of a set of n
elements. We have already seen by induction and by the product rule that there are
2n such subsets; this is the RHS.

Another way to count is to use the sum rule:

No of subsets = ∑nk=0 No of subsets of size k This is the LHS.

Figure 3.1. Pascal’s triangle contains the binomial coefficients C(n, k) ordered as
shown in the figure. Each entry in the figure is the sum of the two entries on top
of it (except the entries on the side which are always 1).

Theorem 3.3.1. (The Binomial Theorem). For n ∈ ℕ,

Proof. If we manually expand (x + y)n, we would get 2n terms with coefficient 1


(each term corresponds to choosing x or y from each of the n factors). If we then
collect these terms, how many of them have the form xn−k yk? Terms of that form
must chooses n−k many x’s, and k many y’s. Because just choosing the k many
y’s specifies the rest to be x’s, there are C(n, k) such terms.

Exercise 3.3.1. What is the coefficient of x13y7 in the expansion of (x−3y)20?


We write (x − 3y)20 as (x + (−3y))20 and apply the binomial theorem, which gives
us the term: C(20, 7)x13(−3y)7 = −3 7C(20, 7)x13y7.
If we substitute specific values for x and y, the binomial theorem gives us more
combinatorial identities as corollaries.

Corollary 3.1. n, again.

Proof. Simply write 2n = (1+1)n and expand using the binomial theorem.

Corollary 3.2. .
Proof. Expand 0 = 0 = (1 − 1) using the binomial theorem:
n n

Rearranging terms gives us:


𝐶
This proves the corollary since C(n, 0) = 1.
3.3.1 Using Pascal’s triangle to expand a binomial expression
Let’s now see how useful the triangle can be when we want to expand a binomial
expression. Consider the binomial expression a + b, and suppose we wish to find (a + b)2.
We know that
(a + b)2 = (a + b)(a + b)
= a2 + ab + ba + b2
= a2 + 2ab + b2
That is,
(a + b) 2 = 1a2 + 2ab + 1b2
Observe the following in the final result:
1. As we move through each term from left to right, the power of a decreases from 2
down to zero.
2. The power of b increases from zero up to 2.
3. The coefficients of each term, (1, 2, 1), are the numbers which appear in the row of
Pascal’s triangle beginning 1,2.
4. The term 2ab arises from contributions of 1ab and 1ba, i.e. 1ab + 1ba = 2ab.
This is the link with the way the 2 in Pascal’s triangle is generated; i.e. by
adding 1 and 1 in the previous row.
If we want to expand (a + b)3 we select the coefficients from the row of the triangle
beginning 1,3: these are 1,3,3,1. We can immediately write down the expansion
by remembering that for each new term we decrease the power of a, this time
starting with 3, and increase the power of b. So,

(a + b) 3 = 1a3 + 3a2b + 3ab2 + 1b3

which we would normally write as just

(a + b) 3 = a3 + 3a2b + 3ab2 + b3

Thinking of (a + b)3 as

(a + b) (a2 + 2ab + b2) = a3 + 2a2b + ab2 + ba2 + 2ab2 + b3

= a3 + 3a2b + 3ab2 + b3

we note that the term 3ab2, for example, arises from the two terms ab2 and 2ab2 ;
again this is the link with the way 3 is generated in Pascal’s triangle - by adding
the 1 and 2 in the previous row.

Example 3.3.2. Suppose we wish to find (a + b)4.


Solution 3.3.2. To find this we use the row beginning 1,4, and can immediately write
down the expansion. (a + b)4 = a4 + 4a3b + 6a2b2 + 4ab3 + b4.
3.4 Inclusion-Exclusion Principle
Some counting problems simply do not have a closed form solution. In this section
we discuss a counting tool that also does not give a closed form solution. The
inclusionexclusion principle can be seen as a generalization of the sum rule.
Suppose there are n(A) ways to perform task A and n(B) ways to perform task B,
how many ways are there to perform task A or B, if the methods to perform these
tasks are not distinct? We can cast this as a set cardinality problem. Let X be the
set of ways to perform A, and Y be the set of ways to perform B. Then:
|X ∪ Y | = |X| + |Y | − |X ∩ Y |
This can be observed using the Venn Diagram. The counting argument goes as
follows: To count the number of ways to perform A or B (|X ∪ Y |) we start by
adding the number of ways to perform A (i.e., |X|) and the number of ways to
perform B (i.e., |Y |). But if some of the ways to perform A and B are the same (|X
∩ Y |), they have been counted twice, so we need to subtract those.
Example 3.4.1. How many positive integers ≤ 100 are multiples of either 2 or 5?

Solution 3.4.1. Let A be the set of multiples of 2 and B be the set of multiples of 5. Then
|A| = 50, |B| = 20, and |A ∩ B| = 10 (since this is the number of multiples of 10). By the
inclusion-exclusion principle, we have 50 + 20 − 10 = 60 multiples of either 2 or 5.

What if there are more tasks? For three sets, we can still gleam from the Venn diagram
that

|X ∪ Y ∪ Z| = |X| + |Y | + |Z| − |X ∩ Y | − |X ∩ Z| − |Y ∩ Z| + |X ∩ Y ∩ Z|

More generally,

3.5 Pigeonhole Principle


In this section, we will discuss the pigeonhole principle: a proof technique that
relies on counting. The principle says that if we place k + 1 or more pigeons into
k pigeon holes, then at least one pigeon hole contains 2 or more pigeons. For
example, in a group of 367 people, at least two people must have the same birthday
(since there are a total of 366 possible birthdays). More generally, we have
Lemma 3.4. (Pigeonhole Principle). If we place n (or more) pigeons into k pigeon
holes, then at least one box contains ⌈n/k⌉ or more pigeons.
Proof. Assume the contrary that every pigeon hole contains ≤ ⌈n/k⌉ −1 < n/k many
pigeons. Then the total number of pigeons among the pigeon holes would be
strictly less than k(n/k) = n, a contradiction.
Example 3.5.1. In a group of 800 people, how many people are likely to share the same
birthday?
Solution 3.5.1. There are at least ⌈800/366⌉ = 3 people with the same birthday.

4.0 Conclusion
Specially, you have learned about counting. You have also learned how to carry out
counting using some special techniques and principles.

5.0 Summary
In this unit, you have learnt how to use Pascal’s triangle to expand a binominal
expression. You have also been taught how to identify and apply inclusion-
exclusion and pigeonhole principle.
6.0 Tutor-Marked Assignment
1. How many positive divisors does 2000 = 2453 have?
2. Six friends Adam, Brian, Chris, Dan, Elvis and Frank want to go see a movie. If there
are only six seats available, how many ways can we seat these friends
3. Expand the following:

4. Find the minimum number of students in a class such that three of them are born in
the same month.
5. Show that from any three integers, one can always choose two, so that a3b – ab3 is
divisible by 10.
7.0 References/Further Reading
Asimow, L and Maxwell, M (2010). Probability and Statistics with Applications.
A problem solving text. ACTEX publications Inc. Winsted,
Conecticut. ISBN: 978-1-56698-721-9
Coolman, R. (2015). Properties of Pascal’s triangle. Published 17 June 2015.
Fraleigh, J. B. (1982). A First Course in Abstract Algebra, 3rd ed., Addison-Wesley.
Gallian, J. A. (1998. Contemporary Abstract Algebra, 4th edition, Houghton-Mifflin.
Kiltinen, J.O. (2004). Parity Theorem for Permutations - Convergence (December 2004)

You might also like