Discrete Mathematics I
Math. 125, Sec. 003, Fall 2018
Homework and Announcements
Urgent stuff
Your final course grade:!
I have graded the final exam and posted your
overall letter grade on the Patriot Web. You should be
able to see it tomorrow Dec. 20th.
The raw median score on the final exam was 45/100.
It has been my pleasure having you in my class.
I wish you all the best for the future and I hope
sincerely that you learned something during our
time together. -- Best wishes for Happy Holidays.!
General Info
Here below is a pdf version of the Syllabus.
It outlines the overall plan of
the course and should answer all practical questions, like when tests are,
what the grading policies are etc. If you didn't get a hard copy from me,
then please print one for your records.
Homework Info
Here below are the lectures and homework assignments (HW) so far in the course.
- Lectures and Homework (HW) from Week 1.
HW for Monday, September 10. NB! Monday Sept. 3rd is
Labor Day.
- Chapter-2:
- Sec 2.1: 1, 3, 9, 10.
- Sec 2.2: 1, 4, 5, 8, 10, 13, 18, 20, 22, 26, 30.
- Some additional problems from week 1.
A set is a well defined collection of objects
that we call elements. When dealing with sets
we usually agree on a given universe in which
we "live" and work. For the most part we will be dealing
with sets containing numbers of some sort (i.e. integers,
rational numbers, real numbers etc.) When we have two sets,
then we can form their intersection, union,
difference, symmetric difference and complement
(we do need the universe to form the complement).
To verify or prove identities involving sets, one can use
containment tables to list all the possibilities of an arbitrary
element being in a given set (denoted by 1) or not being
in the set (denoted by 0). This method is quite good
when the number of sets is three or less. However, when
the number of sets is large, then it is better to use
basic identities to prove that one set is equal to (or contained
in) another. Note that Venn diagrams are good to get
a sense of how sets relate to one another, but it is not
a proper way of proving things! -- For each set we can
attach either a non-negative integer or "infinity" for
the number of elements in the set. If a set has n
elements, for some non-negative integer n, then
we say that the set is finite, otherwise we say
the set is an infinte set. Although we will not
delve into infinite sets, note that there are different
notions of infinity. For example the set of the real numbers
is "more infinite" than the set of natural numbers. -- For
a given set A we can obtain the power set
of A, which contains all the subsets of A.
If A is finite and contains n elements, then
the power set is also finite and contains 2^{n}
elements. The Cartesian product of sets is the collection
of all ordered tuples, where the i-th coordinate is an
element of the set number i. If all the sets are the same
(for example the real number line), then
we obtain familiar sets of points, like 2-tuples representing points in
the Eculidean plane, and 3-tuples representing points
in the three dimensional real space.
- Lectures and Homework (HW) from Week 2.
HW for Monday, September 10.
The Cartesian
product of finite sets is also finite
and its number of elements is (nicely so)
the product of the number of elements of the original finite sets
we started with. -- A binary relation from a set A
to a set B is simply a subeset R of
the Cartesian product A x B. This is a pretty general
definition, but within this framwork there are many interesting
scenarios representing relationships between elements of either
different type or the same type (when B is also
the set A). Hence, any binary relation is determined
by some such subset R. Some conditions on the binary
relations are of interest; (i) reflexivity, (ii) symmetry,
(iii) antisymmetry and (iv) transitivity are four very
important properties for binary relations. Depending on how
the binary relation is defined, we must check to see if the
binary relation at hand saitifies any of these conditions. If
a binary relation satifies (i), (ii) and (iv) then we say
it is an equivalence relation, and we say that two
related elements are "equivalent" to one another. (Since clearly
the "equal to =" relation is clearly an equivalence relation, one
can view an equivalence relation as a generalization of being "equal to").
Equivalence relations have a very nice description: Every equivalence relation
on a set A yields a partition of A (where each part
contains exactly all elements related to one another) and vice versa,
every partition on A yields an equivalence relation (given
by "two elements are equivalent if they are contained in the same part").
- Lectures and Homework (HW) from Week 3.
HW for Monday, September 17. :
- Chapter-2:
- Sec 2.3: 3, 5, 7, 9, 11.
- Sec 2.4: 2, 3, 5, 6, 7, 10, 11, 12, 17, 20, 21.
- Some additional problems from week 2.
So if we have an element a, then the unique part in which a
is contained in, is called the equivalence class of a.
The collection of all equivalence classes (or the distinct parts in the
corresponding partition) is called the quotient set.
As we saw in class, it is possible to have an infinite set,
where each equivalence class is infinite and where there
are only finitely many equivalence classes (so the quotient set
is finite!). -- Another type of binary relation that is of great importance
is a partial order, which works the same way
as the relation "less than or equal to" on numbers. A binary
relation is a partial order if it satisfies (i), (iii) and (iv)
from above, that is: reflexivity, antisymmetry and
transitivity. A set that is provided with a partial order
is calle a partially ordered set or just poset
for short. Clearly the relation "less than or equal to" is a partial
order, but the catch with general partial orders is that given
two elements in a poset, they might not be comparable; one is
not necessarily greater than the other. As an example, we considerd
the "subset of or equal to" among subsets of a given set. This
turns out to be a partial order, but given two sets, one is not
necessarily contained in the other (in fact, they could be disjoint!)
If every two elements in a poset are comparable (so one is always
greater than or equal to the other) then the poset is said
to be totally or linearly ordered. This means
essentially that we can list all the elements in a row according to
size. In general, when working with posets it is a good idea
to look at their Hasse diagrams. Again, just like with Venn diagrams,
the Hasse diagrams don't prove anything, but they give you an idea
of the structure of the poset at hand. Not all posets have maximum
or minimum elements, but every finite poset has at least one maximal
element and at least one minimal element. -- Chapter 3 deals with
functions, something most of you have some familiarity with. Perhaps
what you are not used to is to specify the domain and
the codomain (or target) of a given function.
By the image of a function we mean all the elements
in the codomain that are a image of the function. The image
of a function does not have to be the whole codomain!
Two properties
of a function are of great importannce: (i) a function
is one-to-one (1-1) or injective if distinct
elements in the domain are mapped to distinct elements of the codomain.
(ii) A function is onto or surjective if the image
of the function is the whole codomain, that is, every element in
the codomain/target actually is an image of some element of the domain.
If a function is both injective and surjective, then it is bijective.
We can compose functions, and the composition does satisfy some nice
properties. For example, composition of functions is associative
in the sense that it does not matter the order you evaluate the composition,
as long as the left-to-right order is intact. Note that composition
is not commutative: f composed with g is not
the same as g composed with f! So we must take
some care! Bijective functions are very nice, since these functions are precisely
the ones that have inverses, that is functions that "cancel" the effect
of the function (i.e. you can get everything back in the domain from the codomain.)
We will see many examples of this in class and problems.
- Lectures and Homework (HW) from Week 4.
HW for Monday, September 24. :
- Chapter-2:
- Sec 2.5: 3, 4.
- Chapter-2 Review: 7.
Arithmetic with integers are of vital importance in computer science.
What makes the integers hard to deal with is, in part, due to
the fact that one cannot always divide one integer into another
and obtain an integer as an output. Division must be done with more
care. When dividing one integer into another we obtain two
numbers; the quotient and the remainder
using the well-known division algorithm. --
The Fundamental Theorem of Arithmetic states that
every natural number has a unique prime factorization. Using the
prime factorization we can immediately spot if one integer divides
another; it happens when all the prime factors of the denumerator
occur with the same or less power as in the numerator. Also the
greatest common divisor (gcd) and the least common multiple (lcm)
of two integers can be easily computed from the prime factorizations.
However, it is a very hard computational problem to find/obtain the
prime factorization of an integer. Luckily there are better ways
to compute both the gcd and lcm of two integers. The
Euclidean Algorithm (EA) is one of the oldest and yet fastest
ways to compute the gcd of two integers. In fact it is so fast that
no faster way has been developed in thousands of years!
Using the EA we can solve an integer equeation of the form
ax + by = c for arbitrary fixed integers a,b,c.
Using the EA we first determine if there is a solution at all.
If that is the case, the we use the EA to find one solution.
Once we have one solution, then there are infinitely many solutions
and we have a formula for writing down all the solutions to
this integer equation. -- Next week we will start on induction,
and various methods of proving.
- Lectures and Homework (HW) from Week 4.
HW for Monday, October 1st. :
There are roughly three ways to prove assertions in mathematics
(1) Direct proof: To prove that an assertion/propositon P implies
Q we assume P and work our way toward Q.
(2) Indirect proof: Here to prove that assertion/propositon P implies
Q we assume that Q does not hold and show that
P does not hold. (3) Proof by contradiction: This is one
of the corner stones of mathematical reasoning. Here in order to
prove a proposition, we assume that it is wrong and use that (together
with legitimate mathematical facts) to derive some nonsense (i.e. contradiction).
Once we have a contradiction, then we conclude that our assumption that
our original proposition is wrong is itself wrong. Hence the proposition
is true. We saw two Greek classical examples of this way or proving,
namely that the square root of 2 is irrational, and that there
are infinitely many prime numbers. -- To prove assertions
about the natural numbers, many times
we can use induction. There are two kinds of induction, the weak
form and the strong form of induction. The weak form is the form where
we (i) prove that P(a) is true, and then (ii) that
P(n) implies P(n+1) where n is an
arbitrary natural numbers. Note, that in (ii) we are not assuming
that P(n) itself is true, we only show that it implies
P(n+1). Once we have shown (i) and (ii), then we can conclude
that P(n) is true for all natural numbers n
from and including a. -- Note that inductive proofs can
many times yield procedures or algorithms on "how to do things"
constructively. For example, when we proved, by induction (weak form)
that any white 2^{n} x 2^{n} chess board, where
one black square (not to be tiled) could be tiled using L-shaped tiles (consisting
of 3 tiles), then we can obtain an algorithm to tile any such board.
Here below is a picture of such a tiling (curtsey of Mr. Samuel Levy, a student
of this class in Spring of 2014, who turned this inductive proof into an algorithm):
The strong form works in a similar
fashion, except that in (ii) we show that if all the propositions
P(a), P(a+1),...,P(n) are true, then so is P(n+1).
Recursion is what we mean when constucting something inductively.
It is really the same thing as induction, but it refers more to construction,
rather than proofs. For example, we can define a sequence of numbers (that is,
a function from the natural numbers to the reals) in a recursive manner, then
we can guess a formula for this function, and then prove by induction that
the formula is actually correct for all natural numbers. We saw examples
of such functions defined recursively. Sometimes it is very easy to guess
what the formula is (and so we can prove it by induction). Other times we can
derive a recursive definition for the function (and hence easily write a
computer program to compute the value of the function for an arbitrary
natural number) although it might be impossible to find an explicit
formula for the function. -- Next week we will continue to discuss
recursively defined functions/sequences and how possibly find formulas
for them.
- Lectures and Homework (HW) from Week 6.
HW for Tuesday, October 9. :
Recursively defined number sequences are very common in computations.
When a number sequence is defined recursively, it might be difficult
to find a formula (as a function of n alone!) of it.
As an example, we saw how the well-known Fibonacci number sequence
had an elegant and natural recursive presentation, but a formula
for the n-th Fionacci number involved both fractions
and square roots. So from this point of view it wasn't even clear
that it was an integer at all!. However, by examining general
variations of Fibonacci-like number sequences, we saw that by
using the characteristic equation we can use the
roots to present a formula for the n-th term of the sequence.
This is very easy and direct if we do not have any additional function
f(n) added in the recursion (i.e. f(n) = 0 for all n).
But if f(n) is not identically zero, then we must first guess
a particular solution for the recursion, and then use that to find all
solutions to the recursion. We will continue to discuss such "educated guesses"
next week.
- Lectures and Homework (HW) from Week 7.
HW for Monday, October 15. :
We have seen some "educated" ways to guess a particular solution
to a linear recurrence equation of 2nd degree. There are two
things to note when guessing the form of such a particular solution.
(i) If the particular solution is exponential function times a power
of n, then our particular solution should be a polynomial
P(n) times the exponential function. Now, the degree of
the polynomial should be (a) the same as the power of n
if the base of the exponential part is not a root of the characteristic
polynomial, (a) one more than the power of n if the
base of the exponential part is a single root of the characteristic
polynomial, (c) two more than the power of n if the
base of the exponential part is a double root of the
characteristic polynomial. (ii) The second (and very important) part
is that if we know the particular solutions for various functions,
then any linear combination (sums and scalar multiplications) of
these particular solutions will be a particular solution to the corrsponding
recurrence equation where the function is the same combination of the other
given added functions. -- Next week we will start discussing Chapter 6 on how
to count possibilities.
- Lectures and Homework (HW) from Week 8.
HW for Monday, October 29. :
When counting elements in a given set, one has to proceed with some
care and not be to hasty to rush to an answer. The two most fundamental
ways of counting elements are given by the product rule
(that the number
of elements in a Cartesian product of finite sets is the product of their
cardinalities) and by the inclusion/exclusion principle (I/E).
The I/E principle
can be generalized to count the number of elements in the union of 3, 4
and in general k sets, however, the formula we obtain for "many"
sets is very involved and complicated. But, for 2 or 3 sets using the I/E
principle is perfectly within reach. -- Another principle that can be
used to show an existence of a sertain situation is the Pigeon Hole
Principle (PHP). This principle is used when we need to prove that
we have two or more elements that have a common property. We don't use
this in direct counting per se. For that (exact counting) we need to
first establish the number of element in some basic sets. For example
n! called n-factorial is used in many
formulae where we express the number of combinations of various kinds.
Here , n! is the number of injective functions from
the set of the first n natural numbers to itself. This is
the same as the number of rearrangements of n distinct
symbols/items from left to right.
- Lectures and Homework (HW) from Week 9
HW for Monday, October 29. :
The number of ways to form an
ordered r-tuple from a set of n elements
is P(n,r) = n!/(n-r)!. From this we see that the number of
ways to choose an r-element subset from a set of n
elementsis given by C(n,r) = n!/[r!(n-r)!].
Here C(n,r) is
the binomial coefficient and it is read "n choose
r". The binomial coefficients are very important and come
up in many combinatorial situations. For example, the number of ways
to put n identical marbles into r labeled jars
is given by C(n+r-1,r-1). One of the most important applications
of the binomial coefficients is in the Binomial Theorem (BT), that
gives a formula for expanding (x+y) to the n-th
power. Pascal's Triangle can be used efficiently when n
is not too large, but for large n it is much better to
use the BT directly and draw our conclusions from that. -- Note, that
many times it is convenient to use calculus and find derivatives
when we want to derive an identity involving binomial coefficient, as
we saw in class.
- Lectures and Homework (HW) from Week 10.
HW for Monday, November 5th. :
- Chapter-7:
- Sec 7.7: 8, 9, 11, 14, 21.
- Chapter-9:
- Sec 9.1: 1, 2, 6, 10.
- Sec 9.2: 5, 6, 7, 13, 17, 21, 29, 30.
- Some additional problems from week 10.
- Selected solutions for HW 10.
- A solution to the Party Problem involving
six people, and proof that there are at least two monochromatic triangles.
For more info check This site on the Theorem of Friends and Strangers.
Graphs are one of the most used and
important concepts in discrete
mathematics. Countless discrete problems, both practical and theoretical,
can be phrased in terms of graphs. There are many types of graphs;
simple graphs (where there is at most one edge between two distinct
vertices) and general graphs (where there could be multiple edges between
two vertices, and also possible loops, that is edges with just one
endvertex.) The complete graph on n vertices
is a simple graph in which every pair of distinct vertices are connected
by an edge. Since there are exactly n-choose-2
such pairs of distinct vertices, we see that the complete graph
on n vertices has n-choose-2 edges.
Every simple graph is a subgraph of the complete graph
on n vertices, where n is the number of vertices
of the given graph. Two important ways to form a subgraph is by
(i) removing/deleting edges, and (ii) removing/deleting vertices.
Note that when we remove/delete a vertex, then we also remove
all the edges with that vertex as an endvertex. -- The Hand Shaking
Theorem states that the sum of all the degrees of the vertices
of a graph equals twice the number of edges of the graph. -- Another
important class of graphs consists of bipartite graphs. These
are graphs where we can partition the vertices into two groups, such
that every edge connects vertices from the two groups (and no edge
has both endvertices in the same group.) The complete bipartite graph
is a bipartite graph where all the possible edges between the two
groups are present. -- When we say that "two graphs are the same", what
we really mean is that their internal structure is the same, or that
they can both be represented by the same drawing. However, given two
graphs, it is in general a very difficult task to determine if they
are "the same" or not. The formal way of saying that two graphs
are the same is to say that they are isomorphic. An
isomorphism between two graphs is a bijective function/map from
the vertex set of one to the vertex set of the other, such that
two vertices in the former are adjacent if, and only if, their
images (under the bijective function) are adjacent in the second graph.
To find such an isomorphism can be a daunting task, even if we know
it exists! However, there are some easy ways to determine if two
graphs are not isomophic. For example, two isomorphic graphs
must have (i) the same number of vertices, (ii) the same number of edges,
(iii) the same number of vertices of degree k for
every k, (iv) the same number of triangles, squares etc...
If one of these requirements fails, then we can conclude that the graphs
are not isomorphic.
- Lectures and Homework (HW) from Week 11.
HW for Monday, November 12th. :
We now come back to the question we considered when introducing graphs,
namely the Bridges of Königsberg. This first problem
of graph theory, that was solved by Leonard Euler around 1730, can
be solved by considering the corresponding (general) graph and
see if it is Eulerian or not. A graph is Eulerian (i.e. contains
a circuit that covers all the edges) if and only if it is connected
and the degree of each vertex is even. This theorem is what solved the
problem of the Bridges of Königsberg and answered it in the negative.
One direction is fairly easy; namely, if a graph has an Eulerian circuit
then it must be connected and the degree of each vertex must be even.
The other direction is not so easy, but we saw in class an algorithm
(one of many that exist!) that will create an Eulerian circuit in a
connected graph where every vertex has an even degree. Unlike the problem
of determining whether two graphs are isomorphic or not, this problem
of finding an Euler circuit of an Eulerian graph is computatble in
a reasonable amount of time.
- Lectures and Homework (HW) from Week 12.
HW for Monday, November 26th. :
- Chapter-10:
- Sec 10.1: 3, 4, 11, 22, 24.
- Chapter-12:
- Sec 12.1: 5, 7, 16, 18, 20, 21, 24.
- Sec 12.2: 7, 12.
- Sec 12.3: 1, 10.
- Some additional problems from week 12.
- Selected solutions for HW 12.
We have seen in class an algorithm to find an Eulerian circuit in a graph
that is Eulerian (connected and has all degrees even). Note, determining
whether a graph is Eulerian or not is easy; just check connectivity
and check that all the degrees are even. Knowing that a graph is Eulerian,
it is another task to find the Eulerian circuit. That can take some effort,
although it is doable in a reasonable amount of time. -- Recall that a tree
is a connected graph with no cycles, and a forest is a graph in which
every component is a tree. There are many nice characterizations of trees;
(i) A graph is a tree if and only if there is a unique path between any two
vertices in the graph. (ii) A graph on n vertices is a tree
if and only if it is connected and has n-1 edges. To prove this
we used the fact that every tree has at least two (in fact one suffices!)
leaves, where a leaf is a vertex of degree one. A spanning tree
of a graph is a subgraph that (i) is a tree and (ii) contains all the vertices
of the graph. Every graph contains at least one spanning tree.
Of great interest is to find the minimum weight spanning tree (MWST)
of a weighted graph (where we have attached a real weight to each edge).
There is an elegant algorithm to find a MWST for graph for any weighted
graph, called Kruskal's Algorithm. The interesting part about
Kruskal's Algorithm is that we don't have to worry about keeping the
subgraph at each step connected; it will connect at the very last step
and yield a MWST for the graph. -- That is it for lectures folks!
- Lectures and Homework (HW) from Week 13.
- No new lectures this week.! I will cover HW problems (week 12
here above) and start reviewing.
Exam Info (Quizzes, Midterm and Final)
Here below are the handwritten solutions to
the quizzes that I have handed back so far.
Below is a review sheet for the first midterm. The
midterm is to be held in the classroom,
Monday, October 22nd. -- Please
note that this review sheet is not a recipe for the midterm,
but merely a collection of sample problems you should attempt to practice
your skills!
The midterm will consist of 5 to 8 problems. There are no
multiple choice questions. No calculators or cheat-sheets
are allowed either. You will have 50 minutes to do the midterm
and I will give partial credit. Note, that you might get
full credit for a problem even if your final answer is wrong,
provided that I see your method is correct! Likewise, you might
not get any points for a problem even if your final answer is
the correct one, if I see that your method is utterly wrong! --
The material covered in this midterm will basically be what
we will have covered up until and including last week Wednesday October 10th.
but not what is covered this week
Chapter 2, sections 2.1, 2.2, 2.3, 2.4, 2.5.
Chapter 3, sections 3.1, 3.2.
Chapter 4, sections 4.1, 4.2, 4.3.
Chapter 5, sections 5.1, 5.2.
The review sheet is only intended to give you an idea
of what might be on the midterm and I don't plan on going over
them in detail before the midterm.
But if you have some quick questions, I could give you a hint.
Dear folks!
Make sure you get back your midterm exam. The median
score was 59/100. -- Please
note that the curve I present in class is only
how you did in this midterm amongst yourselves. It
has nothing to do with your final letter grade
for the course since I only record the *number* grade.
I will not record the curved letter grade for this midterm exam.
Here below are handwritten solutions to the midterm exam. Please print
out a hard copy for your records. Make sure
you understand the solutions. -- If you have any concerns,
you are welcome to come and discuss them with me, but
read the solutions first.
Below is a review sheet for the final exam. The
final is to be held in the classroom,
Monday, December 17., 10:30 am – 12:30 pm in the classroom. -- Please
note that this review sheet is not a recipe for the final,
but merely a collection of sample problems you should attempt to practice
your skills! I will cover this review sheet the last week of class.
The final is cumulative and will consist of 10 problems, and the format
is the same as for the midterm exam; there are no
multiple choice questions, no calculators or cheat-sheets
are allowed either. You will have two hours to work on the final.
Roughly what we have covered is as follows
Chapter 2, sections 1,2,3,4,5,
Chapter 3, sections 1,2,
Chapter 4, sections 1,2,3,
Chapter 5, sections 1,2,3,
Chapter 6, sections 1,2,3,
Chapter 7, sections 1,1,2,,5,6,7,
Chapter 9, sections 1,2,3,
Chapter 10, sections 1,
Chapter 12, sections 1,2,3.
Some words of wisdom:
The question is always, "How should you study for the final?"
Well, a good rule of thumb is to drill the problems you have
done in homework, midterm and quizzes. Don't stay up too
late the night before if you possible can manage that.
Read over the solutions of the problems on the midterm
and quizzes so you are sure on how to answer the questions, and so
you have a good feeling for what I expect as a perfect
solution on the final.
Although regular office hours will not be valid the final
week, you can always drop me an email.
EOF/EOS