Discrete Math Problems
Discrete Math Problems
William F. Klostermeyer
School of Computing
University of North Florida
Jacksonville, FL 32224
E-mail: [email protected]
Contents
0 Preface 3
1 Logic 5
1.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Truth Tables and Logical Equivalences . . . . . . . . . . . . . 6
1.3 Quantiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4 Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2 Sets 13
3 Functions 17
5 Proofs 25
5.1 Direct Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.2 Proofs by Contradiction . . . . . . . . . . . . . . . . . . . . . 26
5.3 Proofs by Induction . . . . . . . . . . . . . . . . . . . . . . . 27
6 Graphs 31
6.1 Basic Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.1.1 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.1.2 Directed Graphs . . . . . . . . . . . . . . . . . . . . . 35
6.2 Problems Requiring Proofs . . . . . . . . . . . . . . . . . . . 35
7 Counting 39
8 Other Topics 47
8.1 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1
2 CONTENTS
Preface
3
4 CHAPTER 0. PREFACE
Chapter 1
Logic
1.1 Basics
Evaluate each of the following.
6. q p
7. p (q p)
5
6 CHAPTER 1. LOGIC
8. q p
9. r p
10. q p
11. (q p) (q (r p))
1. p q r
2. p q
3. (p q) p
4. (p q) (q p)
5. (p q) q
6. (p q) (q p)
7. (p q) r
8. (p q) p
1.2. TRUTH TABLES AND LOGICAL EQUIVALENCES 7
9. (p q) (p q)
10. (p p) p
11. (p q) (p q)
12. (p p) q
13. (p q) (p q)
Prove or disprove each of the following using (a) truth tables and (b)
the rules of logic.
14. (p q) (p q) True
15. (p q) q True
17. p q q p
18. (p q) q p q
19. (p q) q q p
20. p (q r) p (q r)
21. p (q r) p (q r)
8 CHAPTER 1. LOGIC
22. (p (q r)) (p q) r
23. p (p q) True
24. p (q r)
25. p (q r)
26. q (p q)
27. (p q r) (p q)
28. (p q r) (p q r) (p q)
32. Show that p not (not q and not p) is logically equivalent to True.
1.3. QUANTIFIERS 9
1.3 Quantifiers
Evaluate each of the following for the universe Z, the set of integers
4. x(x = 5) (x = 6)
5. x(x = 5) (x 5)
6. x(x = 5) (x 5)
8. x x2 > 0
9. x x2 = 0
10. xy x < y
11. xy x < y
12. xy(x + y = 0) (x y = 0)
13. xy(x y x + y)
10 CHAPTER 1. LOGIC
15. xy(x y)
16. xy((x = 3) (y = 4)
17. xyz(x2 y + z = 0)
19. xy(x2 = y 1)
21. xP (x)
23. xP (x)
26. Argue that xyP (x, y) xyP (x, y) is (or is not) a tautology.
1.4 Circuits
Design logic circuits, using AND, OR, and NOT gates to solve the following
problems.
2. Input two bits x, y and output two bits representing the absolute value
of x y
3. Input three bits x, y, z and output one bit which is the majority of the
three input bits
12 CHAPTER 1. LOGIC
Chapter 2
Sets
List the elements of the following sets. Assume the universe is Z.(Note: 2X
denotes the power set of X)
1. {x|x2 = 6}
2. {x|x2 = 9}
4. [2] {x|x = x2 }
6. {a, b, c} {1, 2}
7. {1, 2} {a, b, c}
13
14 CHAPTER 2. SETS
8. {a, b, c}
10. 2{a,{a}}
12. {{x}}
13.
14. {}
15. {{}}
17. Z
18. 2Z
19. 2
20. 22
21. A B
22. A C
23. A B
24. A B
25. B A
26. A B
27. B C
28. A
29. B {}
30. C
31. A B C
32. A A
33. A B
Prove the following set identities, using either Venn Diagrams or the
rules of sets.
36. [2] A (B A) =
37. [2] (A B) (A B) = A
38. [2] (A B) C A C
39. [2] (A C) (C B) =
40. Argue that the symmetric dierence operator does, or does not, always
satisfy the associative property.
42. {x|x = 6 x 4}
Functions
1. 1.5
2. 2.6
3. 1.1
4. 1.3
7. log2 64
8. log2 27
9. log2 85
17
18 CHAPTER 3. FUNCTIONS
10. 7!
11. 26 25
12. 13
13. 35
14. 57
15. 101110
16. 10001
17. 11100
18. f (x) = x2 1
19. f (x) = x2 + 1
20. f (x) = x
21. f (x) = x
19
22. f (x) = 5
23. f (x) = 2x
25. f (x) = log x, where log x = 1 + log (log2 x) and log x = 1 for
x 2.
n
26. Dene a recursive function such that f (n) = 5(2 ) .
i=6 i+1 ?
9. What is the value of i=2 2
21
22 CHAPTER 4. INTEGERS AND MATRICES
i=5
11. What is the value of i=0 i + 1?
i=8
i=1 2 ?
i
12. What is the value of
i=6
16. What is the value of i=1 i 2?
i=n
19. Find a closed form formula that is equal to of i=2 3i 1?
22. Prove that if every even integer n 4 is the sum of two (not necessar-
ily distinct) primes, then every odd integer m 7 is the sum of three
(not necessarily distinct) primes.
25. What is the largest positive integer k such that (324 mod k) = (374 mod
k) = (549 mod k)? (What principle can you use to solve this problem
quickly?)
Proofs
2. Use the solution to the previous problem to prove that if n is odd, then
n3 is odd. Also, nd a direct proof that does not rely on the solution
to the previous problem.
5. Let P (A) denote the power set of set A. Let A and B be sets such that
A = B. That is, there exists an element x such that x A and x / B.
Argue that P (A) = P (B) by showing there exists a specic element in
P (A) that is not in P (B) or a specic element in P (B) that is not in
P (A).
7. A perfect number is a positive integer n such that the sum of the fac-
tors of n is equal to 2n (1 and n are considered factors of n). So 6 is
25
26 CHAPTER 5. PROOFS
8. Prove that there does not exist an integer n > 3 such that n, n+2, n+4
are each prime.
11. [2] Prove that there are no integer solutions to x2 3 = 4y. (Hint: Do
a proof by cases, the cases being the value of x modulo 4).
12. Prove that if p, q are positive integers such that p|q and q|p, then p = q.
13. Prove that for any integer x, the integer x(x + 1) is even.
14. Prove that the product of any two odd integers is odd.
5. Prove that in any set of n numbers, there is one number whose value
is at least the average of the n numbers.
n
1. Prove that i=0 2i = n(n + 1).
n 2
7. Prove that i=0 (fi ) = fn fn+1 .
8. Prove that fn , fn+1 are relatively prime (i.e., have no common factors
except 1).
11. (a) Prove that 2n < n! for n 4. (b) Prove that n! < nn for all n > 0.
n
12. Prove that i=1 i(i!) = (n + 1)! 1.
n
13. Prove that i=1 (2i 1) = n2 .
15. Prove that if A is a set with n elements, then the power set of A con-
tains 2n elements.
n n(n+1)(n+2)
16. Prove that i=1 i(i + 1) = 3 .
5.3. PROOFS BY INDUCTION 29
n 2 n(n+1)(2n+1)
17. Prove that i=1 i = 6 .
n
18. Prove that 1
i=0 2i =2 1
2n .
n
19. Prove that i=1
1
i
2 n.
n a(kn+1 1)
20. Prove that if k = 1 then i=0 ar
i = k1 .
n 1 n
21. Prove or disprove that i=1 (2i1)(2i+1) = 2n+1 .
n i 3n+1 1
22. Prove that i=0 3 = 2 .
2n 2n
24. Prove that for n 1, i=1 (1)
i+1 1
i = 1
i=n+1 i .
26. (hard) [2] Prove that any set of n+1 numbers taken from {1, 2, . . . , 2n}
contains a pair a, b such that a|b.
27. Prove that any positive integer can be factored into primes. (Note it is
more dicult to prove this factorization is unique, dont worry about
that for this problem).
29. [2] Prove that any amount of postage greater than seven cents can be
formed using only three and ve cent stamps. Based on your proof,
write a recursive algorithm that prints the actual stamps used.
30 CHAPTER 5. PROOFS
n
30. Prove that i=1
1
i
2( n + 1 1), for all n 1.
32. What is the largest number you cannot write as the sum of 6, 9, or
20? That is, what is the largest x such that x = 6u + 9v + 20w, where
u, v, w 0.
Graphs
7. Let Kn,m be the bipartite graph with n vertices in one part and m in
the other part and having nm edges. Draw K2,3 so that no edges cross
(i.e., give a planar embedding).
31
32 CHAPTER 6. GRAPHS
8. Draw a 5 5 grid graph. How many edges does the n n grid graph
have?
12. Is C52 isomorphic to P52 ? (G and H are isomorphic if they have the
same number of vertices and there is a function f such that uv is an
edge in G if and only of f (u)f (v) is an edge in H, for all edges uv in
G, where u and v are vertices in G. In other words, G and H can be
drawn so as to look exactly the same).
13. If G = (V, E) is a graph, then G is the graph with vertex set V and
all edges of the form uv where uv 4 isomorphic?
/ E. Are C10 and C10
17. Explain why a graph with n vertices, where each vertex has degree at
least n 2, cannot be bipartite when n 5.
6.1. BASIC PROBLEMS 33
18. What is the vertex connectivity and edge connectivity of the following
graph:
a !
@aaa!!!
@
@
@
C
C
C
19. Suppose a graph has two internally-disjoint x y paths (i.e., two paths
that have nothing in common except x and y). Is it necessarily 2-
connected? Does this violate Mengers Theorem? Why or why not?
20. Is it true that every degree one vertex in a graph has a neighbor that
is a cut-vertex? (a cut-vertex in a connected graph is a vertex whose
deletion results in a disconnected graph).
21. Consider Kn . Let us call the graph formed by taking Kn and removing
one edge Kn e. What is the chromatic number of K8 e?
22. Draw a graph G that is such that (G) > (G v) for all vertices v.
(Such a graph is called critical).
23. Draw a graph G that is such that (G) > (G e) for all edges v.
(Such a graph is called edge-critical).
a !
@aaa!!!
@
@
@
C
C
C
34 CHAPTER 6. GRAPHS
27. The edge chromatic number of a graph is the minimum number of col-
ors needed to color the edges of a graph so that edges sharing a vertex
have dierent colors. Argue that the edge chromatic number of G is at
least the maximum degree of G. Find a graph whose edge chromatic
number exceeds the maximum degree.
30. For which m, n does Km,n contain an Euler Circuit (a closed walk
containing all the edges of the graph)? A Hamiltonian Cycle (a cycle
containing all the vertices of the graph)? For which is it planar?
31. True or False: all m n grid graphs contain a Hamiltonian cycle (as-
sume m n 2). Justify your answer.
6.2. PROBLEMS REQUIRING PROOFS 35
32. A perfect code is a subset of vertices of the graph, D, such that each
vertex in GD is adjacent to exactly one element of D and each vertex
in D has no neighbors that are in D. Give an example of a tree with
10 vertices that has a perfect code and an example with 10 vertices
that does not have a perfect code.
a !
@aaa!!!
@
@
@
C
C
C
34. Is it true that every tree has a perfect matching? Does any tree have
more than one perfect matching?
9. Let
T be a tree in which the average vertex degree is k, that is,
vV
deg(v)
n = k. From the value k, can you deduce what n is?
11. Prove that an outerplanar graph (i.e., a planar graph that can be em-
bedded in the plan with all the vertices bordering the exterior face)
6.2. PROBLEMS REQUIRING PROOFS 37
12. Prove that any graph with n vertices and m edges has at least mn+1
cycles.
17. Let f, e, v denote the number of faces, edges, and vertices, respectively,
in a planar graph. Use induction on e to prove that f = e v + 2 (this
is known as Eulers formula).
19. Prove that a graph with minimum vertex degree at least two must
contain a cycle. (Hint: Consider a longest path in the graph and look
at the ends of the path).
20. Prove that every graph with at least two vertices has at least two ver-
tices that are not cut-vertices. (Hint: consider a spanning tree of the
graph).
38 CHAPTER 6. GRAPHS
Chapter 7
Counting
2. If |A B| = 4, what is |A B|?
39
40 CHAPTER 7. COUNTING
9. How many bit strings are there of length 10 that do not end in 111
10. How many bit strings are there of length 6 are there that do not con-
tain 1111 as a substring?
11. How many dierent SSNs are there that do not contain any even digit?
12. [2] How many positive integers less that 1000 are (a) divisible by 7; (b)
divisible by 7 but not by 11; (c) divisible by 7 and 11; (d) divisible by
7 or 11; (e) divisible by exactly one of 7, 11 (f) divisible by neither 7
nor 11; (g) have distinct digits; (h) have distinct digits and are even.
13. Repeat the previous question, but only consider three digit numbers.
16. Repeat the previous question, but require that f (x) < f (x + 1) for all
0 x < n.
17. How many three digit numbers contain distinct digits? Have a digit
repeated? Have consecutive digits that are the same?
18. How many 10 digit numbers have no two digits the same? How many
10 digit numbers have no two digits the same and do not start with 0
or 1?
19. On a multiple choice test with 100 questions and 5 answers per ques-
tion, how many dierent ways can the test be completed?
41
20. On a multiple choice test with 100 questions and 5 answers per ques-
tion, how many dierent ways can the test be completed if every answer
is wrong?
21. On a multiple choice test with 10 questions and 5 answers per question,
how many dierent ways can the test be completed if exactly 5 of the
answers are wrong?
22. On a multiple choice test with 100 questions and 5 answers per ques-
tion, how many dierent ways can the test be completed if no two
consecutive answers are ever the same?
23. On a multiple choice test with 98 questions and 5 answers per question,
explain why some answer must occur at least 20 times on the answer
key.
24. How many people must be in a room to ensure at least two were born
on the same day of the week?
25. How many people must be in a room to ensure at least three were born
on the same day of the week?
26. How many people must be in a room to ensure at least two were born
on a Monday?
27. How many people must be in a room to ensure that either (i) at least
two were born on a Monday or (ii) at least three were born on a day
other than Monday.
28. Suppose four disjoint sets contain 15 items in total. Enumerate the
possible cardinalities of these sets provided that no single set contains
more than ve items.
42 CHAPTER 7. COUNTING
29. What are the permutations of the letters a, b, c, d? How many of these
permutations have a preceding b? How many end with ab?
30. How many ways can we choose 5 items from a box containing 10 items?
2 items from a box containing 10 items? 8 items from a box containing
10 items?
31. How many ways can we choose 3 numbers from the set {1, 2, 3, 4, 5, 6, 7}
(and the order we choose matters: so 1, 2, 3 is dierent from 2, 3, 1).
32. Repeat the previous question, but this time the order does not matter.
33. How many ways can we choose 3 numbers from the set {1, 2, 3, 4, 5, 6, 7}
so that the numbers are chosen in increasing order.
34. How many ways can we choose 3 numbers from the set {1, 2, 3, 4, 5, 6, 7}
so that 7 is chosen.
35. (a) How many ways can we choose 3 numbers from the set {1, 2, 3, 4, 5, 6, 7, 8}
so that more odd numbers are chosen than even?
(b)How many ways can we choose 3 numbers from the set {1, 2, 3, 4, 5, 6, 7}
so that more odd numbers are chosen than even?
36. How many bit strings of length 8 contain at least three 0s?
37. How many bit strings of length 8 contain at least three 0s and at least
two 1s?
38. How many bit strings of length 8 contain an equal number of 0s and
1s?
39. How many bit strings of length 8 contain more 0s than 1s?
43
40. How many paths are there of length 5 are there between two distinct
vertices in the complete graph K10 ?
41. How many paths are there between two distinct vertices in the complete
graph Kn ?
42. Let Kn be such that the vertices are labelled 1, 2, 3, . . . , n. How many
paths are there between v1 and vn such that the labels on the path are
strictly increasing?
43. How many dierent induced subgraphs are there of Kn that contain
at least one edge?
45. Suppose we have 10 dierent men and 2 dierent women. How many
ways can we seat them on a row of seats so that the two women sit
next to each other?
46. Suppose we have 10 dierent men and 13 dierent women. How many
ways can we seat them on a row of seats so that no two women sit next
to each other?
47. Suppose we have 10 dierent men and 3 dierent women. How many
ways can we seat them on a row of seats so that no two women sit next
to each other?
48. Suppose we have 12 dierent men and 7 dierent women. How many
ways can we seat them around a circular table so that no two women
sit next to each other? (Note: it may help to assume the seats are
numbered)
44 CHAPTER 7. COUNTING
49. On a multiple choice test with 100 questions and 2 answers per ques-
tion, how many dierent ways can the test be completed if no two
consecutive answers are ever the same?
50. How many ways can 3 indistinguishable balls be placed into 3 boxes
if (let x y z denote the number of balls in each of the four bins) :
(a) For example, 2-1-0 is dierent from 0-1-2
(b) For example, 2-1-0 is the same as 0-1-2, i.e, any two arrangements
are the same if they have the same numbers, in any order.
(c) Generalize your answer to n balls and n boxes for both parts (a)
and (b). [For part a), work out the rst few terms in the sequence and
consider looking in the Online Encyclopedia of Integer Sequences.] [For
part b, the answer is equivalent to the number of integer partitions
of n, why?].
51. How many ways can 4 indistinguishable balls be placed into 3 boxes
if (let x y z denote the number of balls in each of the four bins) :
(a) For example, 2-1-1 is dierent from 1-2-1
(b) For example, 2-1-1 is the same as 1-1-2, i.e, any two arrangements
are the same if they have the same numbers, in any order.
(c) Generalize your answer to n+1 balls and n boxes for both parts (a)
and part (b) [For part a), work out the rst few terms in the sequence
and consider looking in the Online Encyclopedia of Integer Sequences.]
[For part b, answer is related to number the number of integer parti-
tions of n + 1.
52. Suppose cards come in four varieties: Spaces, Clubs, Hearts, and
Diamonds. We assume cards are not numbered. A hand consists of 5
cards dealt from a deck containing these cards. The order of the cards
in a hand does not matter.
(a) Suppose 5 cards are dealt from an innite deck. How many dier-
ent hands are there?
(b) Continuing part (a), how many of these hands have exactly 3
spades?
45
(c) Continuing part (a), how many of these hands have at least 3
spades?
(d) Suppose 5 cards are dealt from a 52 card deck. How many dierent
hands are there?
(d) Continuing part (b), how many of these hands have exactly 3
spades?
(e) Continuing part (b), how many of these hands have at least 3
spades?
(f) Continuing part (b), how many of these hands have at least 3 cards
of the same variety?
54. Consider a rectangular table with n chairs on each side. How many
ways can n married couples sit at the table to that each couple sits
either beside each other or directly across from each other?
55. Let f : A B, with |B| = 2. How many dierent f s are there? How
many dierent f s are there that are onto functions? How many are
onto if |B| = 3?
56. How many dierent ways can a team win a best 4 out of 7 series of
games? (A team must win 4 games; they might win 4 games to 0 or 4
games to 3; the order of wins matters in this problem).
57. We want to make ags with horizontal stripes. How many dierent
ags can we make if:
a) We have 3 colors and a ag has 3 stripes, all must be dierent colors
b) We have 6 colors and a ag has 6 stripes, all must be dierent colors
c) Repeat a and b, but assume two ags are the same if they have the
46 CHAPTER 7. COUNTING
58. Suppose we have six 3 cent stamps and 7 ve cent stamps. How many
dierent amounts of postage can we make?
59. Suppose we have three 3 cent stamps and 7 nine cent stamps. How
many dierent amounts of postage can we make?
60. Suppose we have six 3 cent stamps and 7 nine cent stamps. How many
dierent amounts of postage can we make?
61. Suppose we have six 9 cent stamps and 7 twelve cent stamps. How
many dierent amounts of postage can we make?
62. How many length 8 bit strings have consecutive 0s? (Hint: is probably
easier to count those without consecutive 0s).
63. How many two-letter strings (lowercase letters only) contain at least
one of {a, b, c, d}?
64. How many dierent ways can you distribute 4 dierent cookies to 4
dierent people: (a) so that each person gets at least one cookie (b)
so that each person may get any number of cookies?
Chapter 8
Other Topics
8.1 Relations
47
48 CHAPTER 8. OTHER TOPICS
Bibliography
49