Professional Documents
Culture Documents
Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Lecture Outline
September 20, 2018
Pn n
= 2n .
Example. Prove that k=0 k
Given a set S of n distinct elements how many subsets are there of the set S?
From earlier lectures, we know that the answer is 2n . This gives us the RHS.
Another way to compute the answer to the question is as follows. The power set P(S)
containing all possible subsets can be partitioned into S0 , S1 , . . . , Sn , where Si , 0 ≤ i ≤ n,
is the set of all subsets of S that have cardinality i. Thus
How many ways are there to choose two numbers from S = {0, 1, 2, . . . , n}?
n(n+1)
By definition, there are n+1
2 = 2 distinct pairs of S. This gives us the RHS.
We can also compute the answer as follows. Let P be the set of all pairs of S. P can be
partitioned into S1 , S2 , . . . , Sn , where Si , 1 ≤ i ≤ n, is the set of pairs in which i is the
bigger element in the pair. Clearly,
r
X n m n+m
=
k r−k r
k=0
There are n men and m women, where n ≥ r and m ≥ r. How many ways are
there to form a committee of r people from this group of people?
n+m
By definition, there are r distinct committees of r people. This gives us the RHS.
The set S of all possible committees of r people can be partitioned into subsets S0 , S1 , S2 , . . . , Sr ,
m in which there are exactly k men and the rest r − k are
where Sk is the set of committees
women. Note that |Sk | = nk r−k . Thus we have
r
X
|S| = |Sk |
k=0
r
X n m
=
k r−k
k=0
n
n
X n
(a + b) = an−k bk
k
k=0
Proof. Observe that each term in the expansion of (a + b)n is of the form an−k bk , k =
0, 1, 2, . . . , n. How many terms are there of the form an−k bk ? This is
the same number of
n
times as there are orderings of n − k a’s and k b’s. This is equal to k . Thus the coefficient
of like terms of the form an−k bk is nk . This proves the theorem.
Pn n
Prove that 2n =
Example. k=0 k
September 20, 2018 Lecture Outline 3
Solution. Last week we proved this claim using a counting argument in which we showed
that L.H.S. and R.H.S. count the number of subsets of a set of n elements. Now we will
prove this using the binomial theorem as follows.
2n = (1 + 1)n
n
X n
= (1)n−k (1)k
k
k=0
n
X n
=
k
k=0
= R.H.S.
Pn n
Let n be a positive integer. Then, for all x prove that (1 + x)n = xk .
Example. k=0 k
Example. There are n pairs of socks. How many socks must you pick without looking to
ensure that you have at least one matching pair?
Solution. The pigeonhole principle can be applied by letting n bins correspond to the n
pairs of socks. If we select n + 1 socks and put each one in the box corresponding to the
pair it belongs to then there must be at least one box containing a matched pair.
4 Lecture Outline September 20, 2018
Proof: We will prove the contrapositive. That is, we will show that if each box contains
at most dn/ke − 1 objects then the total number of objects is not equal to n. Assume that
each box contains at most dn/ke − 1 objects. Then, the total number of objects is at most
l n m n
k −1 <k +1−1 =n
k k
Thus we have shown that the total number of objects is less than n. This completes the
proof.
Using the generalized pigeonhole principle we can conclude that among 100 people, there
are at least d100/12e = 9 who are born in the same month.
Example. Suppose each point in the plane is colored either red or blue. Show that there
always exist two points of the same color that are exactly one feet apart.
Solution. Consider an equilateral triangle with the length of each side being one feet.
The three corners of the triangle are colored red or blue. By pigeonhole principle, two of
these three points must have the same color.
Example. Given a sequence of n integers, show that there exists a subsequence of con-
secutive integers whose sum is a multiple of n.
Example. Show that in any group of six people there are either three mutual friends or
three mutual strangers.
Solution. Consider one of the six people, say A. The remaining five people are either
friends of A or they do not know A. By the pigeonhole principle, at least d5/2e = 3 of the
five people are either friends of A or are unacquainted with A. In the former case, if any
two of the three people are friends then these two along with A would be mutual friends,
otherwise the three people would be strangers to each other. The proof for the latter case,
when three or more people are unacquainted with A, proceeds in the same manner.