0% found this document useful (0 votes)
44 views2 pages

Stanford Final

The document contains solutions to 6 exercises on discrete mathematics topics: 1) Proving an equivalence relation on sets. 2) Expressing a clique as a union of bipartite graphs. 3) Counting ways to select a committee with members from two clubs. 4) Proving Bezout's identity using the pigeonhole principle. 5) Counting integers coprime to 144. 6) Using inclusion-exclusion to count passwords satisfying certain constraints.

Uploaded by

A.Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views2 pages

Stanford Final

The document contains solutions to 6 exercises on discrete mathematics topics: 1) Proving an equivalence relation on sets. 2) Expressing a clique as a union of bipartite graphs. 3) Counting ways to select a committee with members from two clubs. 4) Proving Bezout's identity using the pigeonhole principle. 5) Counting integers coprime to 144. 6) Using inclusion-exclusion to count passwords satisfying certain constraints.

Uploaded by

A.Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS103X: Discrete Structures

Final Review
March 14, 2008

Exercise 1. Let S be some set and T be a subset of S. For subsets A and B of S, say A ∼ B if
and only if (A ∪ B) \ (A ∩ B) ⊆ T .

Solution (A ∪ A) \ (A ∩ A) = ∅ ⊆ T , so A ∼ A and the relation is reflexive. If A ∼ B, then


(A ∪ B) \ (A ∩ B) ⊆ T , but since ∪ and ∩ are symmetric, A ∪ B = B ∪ A and A ∩ B = B ∩ A, so
(B ∪ A) \ (B ∩ A) ⊆ T . So B ∼ A and the relation is symmetric. Assume A ∼ B and B ∼ C. It it
easy to prove that e is an element of S = (A ∪ B) \ (A ∩ B) if and only if it is in exactly one of A
and B. (If it is in exactly one, then it is in A ∪ B but not in A ∩ B and hence is preserved by the
set subtraction. If it is in neither, then it is not in A ∪ B and hence not in S, and if it is in both
then it is removed from S by subtracting A ∩ B.) So A ∼ B implies that every such element is in
T . Similarly B ∼ C implies that every element in exactly one of B and C is in T . Now consider
an element e in exactly one of A and C. Assume it is in A, hence not in C. If it is also in B, then
it satisfies the condition to be an element of (B ∪ C) \ (B ∩ C) and hence is in T . If e is not in B,
then it satisfies the condition to be in (A ∪ B) \ (A ∩ B) and hence is in T . An analogous line of
reasoning applies to show that if e is in C but not in A then it is in T . So A ∼ C and the relation
is transitive. Hence ∼ is an equivalence.

Exercise 2. Consider m graphs G1 = (V1 , E1 ), G2 = (V2 , E2 ), . . ., Gm = (Vm , Em ). Their union


can be defined as !
m
[ [m m
[
Gi = Vi , Ei .
i=1 i=1 i=1
Show that, for any natural number n ≥ 2, the clique Kn can be expressed as the union of k bipartite
graphs if n ≤ 2k .

Solution We proceed by induction on k. For k = 1, there are two cliques: K1 is just a single
point, which is trivially a bipartite graph. K2 is also a single bipartite graph (each vertex in its own
group). Now, for the inductive step assume the claim holds for k = m. Now for any n ≤ 2m+1 , let
a = b n2 c and b = d n2 e, and divide the vertices of Kn into disjoint sets A, B with |A| = a and |B| = b.
We can define a bipartite graph G with vertices A ∪ B and edges v, w with v ∈ A, w ∈ B. Removing
all of these edges from Kn leave two cliques Ka and Kb . Since a, b ≤ 2m , each of these cliques can
be represented as a union of m bipartite graphs. Since the two cliques have disjoint vertex sets, we
can say that the union of a bipartite graph over the vertices of Ka and a bipartite graph over the
vertices of Kb will still be a bipartite graph. Thus the two cliques together can be represented as
the union of m bipartite graphs, and adding G to the union represents all of Kn as m + 1 bipartite
graphs. This completes the inductive step and thus by induction the property holds for all k.
Exercise 3. The drama club has m members and the dance club has n members. For an upcoming
musical, a committee of k people needs to be formed with at least one member from each club. If
the clubs have exactly r members in common, what is the number of ways the committee may be
chosen? Substantiate.

1
Solution There are m + n − r total people to choose from, so without the restriction the number
of ways is m+n−r
k
. Then we subtract the ways that won’t work, which is when no people from one
 There are m − r only in the dance club and n − r only in the draman−r
club are chosen. club.
 Thus
there are m−r
k
ways to choose while having no one from the drama club chosen, and k 
ways to
m+n−r m−r n−r
 
pick no one from the dance club. Subtracting these gives a final answer of k
− k
− k
.
Exercise 4. You already know from Bezout’s Identity that if a and b are coprime integers, then
there are integers x and y such that ax + by = 1. Now prove the same result using the Pigeonhole
Principle. (You may assume that a and b are positive.)
Hint: Take the remainders, modulo b, of the first b − 1 positive multiples of a, and consider what
happens if 1 is not in this set.

Solution a and b are coprime, so at most one of a and b can be 1. Without loss of gener-
ality assume b 6= 1 — this ensures b - a. We can rewrite ax + by = 1 as ax = (−y)b + 1.
This suggests that we consider the remainders of multiples of a modulo b, i.e. the integers
a rem b, 2a rem b, 3a rem b, . . . , (b − 1)a rem b. Assume, for the sake of contradiction, that none
of them is 1. Then, since there are b − 1 of them and they all lie in the set {2, 3, . . . , b − 1} (0 is
absent since b - a), which has b − 2 elements, the Pigeonhole Principle tells us that two of them
must be equal. Say pa rem b = qa rem b, for 1 ≤ p, q < b. This implies pa ≡b qa, or (p − q)a ≡b 0.
But since a and b are coprime, this means p − q is a multiple of b, which is impossible since p and q
are unequal positive integers less than b (so 0 < |p − q| < b). Hence we have reached a contradiction
and 1 must be one of the remainders, say pa rem b = 1. Then pa = qb + 1 for some q, and choosing
x = p, y = −q we get the required result.
Exercise 5. How many nonnegative integers less than or equal to 300 are coprime with 144?
Substantiate.

Solution 144 has a prime factorization of all 2’s and 3’s. So, by inclusion-exclusion, the answer
is 300 − (number divisible by 2) − (number divisible by 3) + (number divisible by 2 and 3). Of
course, the last is the same as the number divisible by 6. Since 300 is divisible by 2,3, and 6, the
formula is 300 − 300
2
− 300
3
+ 300
6
= 300 − 150 − 100 + 50 = 100.
Exercise 6. A certain company wants to have security for their computer systems. So they
have given everyone a name and password. A length 10 word containing each of the characters:
a, d, e, f, i, l, o, p, r, s, is called a cword. A password will be a cword which does not contain any of
the subwords fails, failed, or drop.Use the Inclusion-exclusion Principle to find a simple formula for
the number of passwords.

Solution There are 7!cwords that contain drop, 6!that contain fails, and 5!that contain failed.
There are 3!cwords containing both drop and fails. No cword can contain both fails and failed. The
cwords containing both drop and failed come from taking the subword failedrop and the remaining
letter s in any order, so there are 2!of them. So by Inclusion-exclusion,we have the number of cwords
containing at least one of the three forbidden subwords is
(7! + 6! + 5!) − (3! + 0 + 2!) + 0 = 5!(48) − 8
Among the 10!cwords, the remaining ones are passwords, so the number of passwords is
10! − 5!(48) + 8 = 3, 623, 048
.

You might also like