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

Lecture Notes For CS 313H, Fall 2011

This document contains lecture notes for a CS course covering topics in discrete mathematics including: - Triangular numbers and proofs of closed-form expressions using induction and other methods. - Summations involving powers, factorials, and their properties. - Plane and space partitioning problems. - Fibonacci numbers, binomial coefficients, and their properties proved using induction and other techniques.

Uploaded by

cynthiangel007
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Lecture Notes For CS 313H, Fall 2011

This document contains lecture notes for a CS course covering topics in discrete mathematics including: - Triangular numbers and proofs of closed-form expressions using induction and other methods. - Summations involving powers, factorials, and their properties. - Plane and space partitioning problems. - Fibonacci numbers, binomial coefficients, and their properties proved using induction and other techniques.

Uploaded by

cynthiangel007
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Lecture Notes for CS 313H, Fall 2011

August 25.
We start by examining triangular numbers:
T(n) = 1 + 2 + + n (n = 0, 1, 2, . . .).
Triangular numbers can be also dened recursively:
T(0) = 0,
T(n + 1) = T(n) + n + 1,
or using sigma-notation:
T(n) =
n

i=1
i.
Topics for discussion:
A closed-form expression for T(n) and various ways of proving it.
The rate of growth of T(n).
Combinatorial problems related to triangular numbers.
A generalization of triangular numbers:
S
k
(n) = 1
k
+ 2
k
+ + n
k
.
A related conceptfactorials:
n! = 1 2 . . . n.
Here is a closed-form expression for T(n):
T(n) =
n
2
+ n
2
.
This formula can be also written as
T(n) =
n(n + 1)
2
. (1)
We will see that it can be proved in many dierent ways.
1
Problem 1. By S
3
(n) we denote the sum 1
3
+2
3
+ +n
3
. Calculate S
3
(n)
for several values of n and guess what a general formula for S
3
(n) may look
like.
August 30.
One possible approach to proving formula (1) is based on induction. When
we want to prove by induction that some statement containing a variable n
is true for all nonnegative integers n, we do two things. First we prove the
statement when n = 0; this part of the proof is called the basis. Then we
prove the statement for n + 1 assuming that it is true for n; this part of
the proof is called the induction step. (The assumption that the statement
is true for n, which is used in the induction step, is called the induction
hypothesis.)
Once we have completed both the basis and the induction step, we can
conclude that the statement holds for all nonnegative integers n. Indeed,
according to the basis, in holds for n = 0. From this fact, according to the
induction step, we can conclude that it holds for n = 1. From this fact,
according to the induction step, we can conclude that it holds for n = 2.
And so on.
Here is a proof of formula (1) by induction. Basis. When n = 0, the
formula turns into
0 =
0(0 + 1)
2
,
which is correct. Induction step. Assume that
1 + 2 + . . . + n =
n(n + 1)
2
.
We need to show that
1 + 2 + . . . + n + (n + 1) =
(n + 1)(n + 2)
2
.
Using the induction hypothesis, we calculate:
1 + 2 + . . . + n + (n + 1) =
n(n + 1)
2
+ (n + 1)
=
n(n + 1) + 2(n + 1)
2
=
(n + 1)(n + 2)
2
.
This is the end of the proof.
2
Problem 2. Prove that for any nonnegative integer n, 7
n
+ 5 is a multiple
of 6.
Our work on Problem 1 has led us to the conjecture that for any
nonnegative integer n
1
3
+ 2
3
+ + n
3
=
n
2
(n + 1)
2
4
. (2)
We have also conjectured that
1
2
+ 2
2
+ + n
2
=
n(n + 1)(2n + 1)
6
. (3)
Problem 3. Find a closed-form expression for 1
2
+2
2
+ +n
2
geometrically.
Problem 4. Use induction to prove formula (3).
Problem 5. Use induction to prove formula (2).
Problem 6. Use induction to solve Problem 2.
September 1.
Here is another proof of formula (1). Consider the formulas
(1 + 1)
2
= 1
2
+ 2 1 1 + 1
2
(2 + 1)
2
= 2
2
+ 2 2 1 + 1
2
(3 + 1)
2
= 3
2
+ 2 3 1 + 1
2
. . .
(n + 1)
2
= n
2
+ 2 n 1 + 1
2
.
By adding the left-hand sides and the right-hand sides, we get:
2
2
+ 3
2
+ 4
2
+ + (n + 1)
2
= 1
2
+ 2
2
+ 3
2
+ + n
2
+ 2 T(n) + n,
or, after subtracting 2
2
+ 3
2
+ + n
2
from both sides,
(n + 1)
2
= 1
2
+ 2 T(n) + n.
Solving this equation for T(n) gives formula (1).
Problem 7. Use this method to prove formula (3).
So far we used induction to prove assertions about nonnegative integers.
More generally, induction can be used to prove an assertion about all integers
that are n
0
for some initial value n
0
. First we prove the statement when
n = n
0
. Then we prove the statement for n + 1 assuming that it is true
for n, for an arbitrary n n
0
. Once this is done, we can conclude that the
statement holds for all n n
0
.
Problem 8. Prove that for every n 4, n! > 2
n
.
3
September 6.
Problem 9. Use calculus to nd the smallest value of 2
x
x.
Problem 10. Find a closed-form expression for
_
1
1
4
__
1
1
9
__
1
1
16
_
. . .
_
1
1
n
2
_
.
September 8.
By P
2
(n) we denote the number of parts into which a plane is divided by n
lines, provided that these lines are in a general position. Similarly, P
3
(n)
is the number of parts into which space is divided by n planes in a general
position.
Problem 11. Find P
3
(4).
Problem 12. Find a general formula for P
2
(n).
September 13.
Problem 13. Find a closed-form expression for P
3
(n).
The following approximate formula is often useful: for large values of n,
f(1) + f(2) + + f(n)
_
n
0
f(x)dx. (4)
It shows, for instance, that for large values of n
S
k
(n)
1
k + 1
n
k+1
.
The n-th harmonic number is dened by the formula
H(n) =
1
1
+
1
2
+ +
1
n
.
In application to harmonic numbers, formula (4) tells us that for large values
of n
H(n) lnn.
Problem 14. Use formula (4) to estimate n!.
4
September 15.
Problem 15. A slow but persistent worm, W, starts at one end of a foot-
long rubber band and crawls one inch per minute toward the other end. At
the end of each minute an equally persistent keeper of the band, K, whose
sole purpose in life is to frustrate W, stretches it one foot. Thus after one
minute of crawling, W is 1 inch from the start and 11 from the nish; then K
stretches the band one foot. During the stretching operation W maintains
his relative position, so that W is now 2 inches from the starting point and
22 inches from the goal. After W crawls for another minute the score is
3 inches traveled and 21 to go; but K stretches, and the distances become
4.5 and 31.5. And so on. Does the worm ever reach the nish? (We are
assuming an innite longevity for W and K, an innite elasticity of the
band, and an innitely tiny worm.)
As we have seen, the claim that some statement is true for all nonnegative
integers can be sometime proved by induction. In some cases, strong
induction is more useful. In a proof by strong induction we show that the
statement is true for a nonnegative integer n assuming that it is true for each
nonnegative integer that is < n. As in the case of simple (weak) induction,
we can talk about the integers beginning with some initial value n
0
, instead
of nonnegative integers.
5
September 20.
Fibonacci numbers are dened by the formulas
Fib(0) = 0,
Fib(1) = 1,
Fib(n + 2) = Fib(n) + Fib(n + 1) (n 0).
Problem 16. Prove that
Fib(1) + Fib(2) + . . . + Fib(n) = Fib(n + 2) 1.
Problem 17. Prove that
Fib(1)
2
+ Fib(2)
2
+ . . . + Fib(n)
2
= Fib(n)Fib(n + 1).
6
September 22.
Problem 18. Find all values of n such that Fib(n) < 1.1
n
.
About a function f dened on nonnegative integers we say that it is a
generalized Fibonacci function if it satises the equation
f(n + 2) = f(n) + f(n + 1).
Problem 19. A generalized Fibonacci function f satises the conditions
f(0) = 1, f(6) = 3. Find f(3).
Problem 20. Find a formula that expresses f(n) for any generalized
Fibonacci function f in terms of f(0), f(1), and n. The formula may use
the standard Fibonacci function Fib.
Problem 21. Find a number c such that the sequence of its powers
f(n) = c
n
is a generalized Fibonacci function.
7
September 27.
Problem 22. Find numbers a, b such that
Fib(n) = a
_
1 +

5
2
_
n
+ b
_
1

5
2
_
n
.
October 4.
Problem 23. Function f is dened by the formula
f(n) =
_
n 10, if n > 100,
f(f(n + 11)), otherwise.
Find f(98).
For any nonnegative integers m, n, the binomial coecient
_
n
m
_
(read
n choose m) is the number ways to choose an m-element subset from an
n-element set. Binomial coecients can be calculated using the formula
_
n
m
_
=
n(n 1) (n m + 1)
m!
.
When m n, this formula can be rewritten as
_
n
m
_
=
n!
m!(n m)!
.
Problem 24. Prove that
_
n + 1
m + 1
_
=
_
n
m
_
+
_
n
m + 1
_
.
This formula, combined with the initial conditions
_
n
0
_
= 1,
_
0
m + 1
_
= 0,
provides a recursive denition of binomial coecients.
Problem 25. Prove the binomial theorem:
(a + b)
n
=
_
n
0
_
a
n
+
_
n
1
_
a
n1
b +
_
n
2
_
a
n2
b
2
+ +
_
n
n
_
b
n
.
8
October 6.
Problem 26. Prove by induction:
0
_
n
0
_
+ 1
_
n
1
_
+ 2
_
n
2
_
+ + n
_
n
n
_
= n 2
n1
.
Stirling numbers (of the rst kind) are coecients in the expansion of
the polynomial x(x + 1)(x + 2) (x + n 1):
x(x + 1)(x + 2) (x + n 1) =
_
n
0
_
+
_
n
1
_
x +
_
n
2
_
x
2
+
_
n
n
_
x
n
.
For instance,
x(x + 1)(x + 2)(x + 3) = 6x + 11x
2
+ 6x
3
+ x
4
;
consequently,
_
4
0
_
= 0,
_
4
1
_
= 6,
_
4
2
_
= 11,
_
4
3
_
= 6,
_
4
4
_
= 1.
Problem 27. Find a formula expressing
_
n+1
m+1

in terms of
_
n
m

and
_
n
m+1

.
9
October 11.
Problem 28. Prove that for all n > 0
_
n
1
_
= (n 1)!.
Problem 29. Prove that for all n > 0
_
n
n 1
_
= T(n 1).
Problem 30. Prove that for all n > 0
_
n
2
_
= (n 1)! H(n 1).
October 13.
Problem 31. Prove that for all n 0
0
_
n
0
_
+ 1
_
n
1
_
+ 2
_
n
2
_
+ + n
_
n
n
_
= n! H(n).
10
October 18.
A set is a collection of objects. We write x A if object x is an element of
set A, and x , A otherwise.
The set whose elements are x
1
, . . . , x
n
is denoted by x
1
, . . . , x
n
. The
set is called empty and denoted also by . The set of nonnegative integers
is denoted by N:
N = 0, 1, 2, . . ..
When we specify which objects belong to a set, this denes the set
completely; there is no such thing as the order of elements in a set or the
number of repetitions of an element in a set. For instance,
2, 3 = 3, 2 = 2, 2, 3.
If C is a condition, then by x : C we denote the set of all objects x
satisfying this condition. For instance,
x : x = 2 or x = 3
is the same set as 2, 3.
If A is a set and C is a condition, then by x A : C we denote the
set of all elements of A satisfying condition C. For instance, 2, 3 can be
also written as
x N : 1 < x < 4.
If a set A is nite then the number of elements of A is also called the
cardinality of A and denoted by [A[. For instance,
[[ = 0, [2, 3[ = 2.
We say that a set A is a subset of a set B, and write A B, if every
element of A is an element of B. For instance,
N, 2, 3 N, N N.
For any sets A and B, by A B we denote the set
x : x A or x B,
called the union of A and B. By A B we denote the set
x : x A and x B,
11
called the intersection of A and B. For instance,
2, 3 3, 5 = 2, 3, 5,
2, 3 3, 5 = 3.
Problem 32. For any sets A, B, C, if
A B ,= , A C ,= , B C ,=
then A B C ,= . True or false?
Problem 33. Let [A[ = 3, [B[ = 4. What can you say about the
cardinalities of A B and A B?
By A B we denote the set
x : x A and x , B,
called the dierence of A and B. For instance,
2, 3 3, 5 = 2.
Problem 34. Let [A[ = 3, [B[ = 4. What can you say about the
cardinalities of A B and B A?
The Cartesian product of sets A and B is the set of ordered pairs x, y)
such that x A and y B:
AB = x, y) [ x A and y B.
For instance,
1, 2 2, 3, 4, 5, 6 = 1, 2), 1, 3), 1, 4), 1, 5), 1, 6),
2, 2), 2, 3), 2, 4), 2, 5), 2, 6).
Problem 35. Determine whether the following assertions are true. (a) For
any sets A and B, AB = BA. (b) For any sets A and B, if A is innite
then A B is innite too. (c) For any sets A and B, if [A B[ = 91 then
one of the sets A, B is a singleton.
12
October 20.
The cardinality of the union of two sets can be determined if we know their
cardinalities and the cardinality of their intersection:
[A B[ = [A[ +[B[ [A B[.
This formula is called the inclusion-exclusion principle. Similar formulas can
be written for the union of several sets.
Problem 36. Use a set diagram to simplify the expression
(A B) (B C) (C A) (A B C).
October 25.
By T(A) we denote the power set of a set A, that is, the set of all subsets
of A. The cardinality of T(A) is 2
|A|
.
Problem 37. For any sets A, B,
T(A B) = T(A) T(B).
True or false?
Problem 38. For any pair of dierent sets A and B, T(A) is dierent from
T(B). True or false?
Set-theoretic notation can be used to represent some English phrases by
mathematical formulas. For instance, the assertion
A is the set of roots of the polynomial x
2
+ px + q
can be written as
A = x R : x
2
+ px + q = 0.
Instead of
All elements of A are roots of the polynomial x
2
+ px + q
we can write
A x R : x
2
+ px + q = 0.
13
November 3.
A binary relation on a set A is a subset of A A. If R is a binary relation
then we write xRy instead of x, y) R.
A relation R on a set A is said to be
reexive if, for all x A, xRx;
symmetric if, for all x, y A, xRy implies yRx;
transitive if, for all x, y, z A, xRy and yRz imply xRz.
Problem 39. There are 2
16
binary relations on the set 1, 2, 3, 4. How
many of them are reexive? Symmetric? Both reexive and symmetric?
Problem 40. (a) Consider the relation R on the set N of nonnegative
integers dened by the condition: xRy if x y + 5. Is it reexive? Is it
symmetric? Is it transitive? (b) Answer the same questions for the relation:
xRy if [x y[ < 5.
14
November 8.
A binary relation R on a set A can be visualized as the directed graph with
the set of vertices A that has an edge from a vertex x to a vertex y whenever
xRy.
A binary relation on a nite set a
1
, . . . , a
n
can be represented by its
adjacency matrix an n n matrix such that the entry at the intersection
of column i and row j is
1 if a
i
Ra
j
,
0 otherwise.
If a relation is reexive, symmetric, and transitive, then we say that it
is an equivalence relation. If R is an equivalence relation on a set A, and x
is an element of A, then the set y A : xRy is called the equivalence
class of x and is denoted by [x]. The set of all equivalence classes of an
equivalence relation R is called the quotient set of R.
Problem 41. Prove that the equivalence classes of any equivalence relation
are pairwise disjoint.
A partition of a set A is a set P of non-empty subsets of A such that
each element of A belongs to a unique element of P. The quotient set of
any equivalence relation is a partition. The other way around, any partition
is the quotient set of some equivalence relation.
Problem 42. Find all partitions of the set 1, 2, 3. For each of them,
represent the corresponding equivalence relation as a graph and as an
adjacency matrix.
Problem 43. Does there exist a partition of N with innitely many
equivalence classes such that all of them are innite?
A relation R on a set A is antisymmetric if, for all x, y A, xRy and yRx
imply x = y. A partial order is a relation that is reexive, antisymmetric,
and transitive. A total order on a set A is a partial order R on A such that
for all x, y A, xRy or yRx.
15
November 10.
A function from a set A to a set B is a subset f of A B satisfying the
following condition: for every element x of A there exists a unique element y
of B such that x, y) f. This element y is called the value of f at x and
is denoted by f(x). Set A is called the domain of f, and B is called the
co-domain of f. The subset of the co-domain B consisting of the values f(x)
for all x A is called the range of f.
Problem 44. Let A = 1, 2, 3, B = 2, 3, 4, 5. Find the number of
functions from A to B and the number of functions from B to A.
In the following examples, the domain of each function is the set S of all
bit strings:
S = , 0, 1, 00, 01, 10, 11, 000, 001, . . ..
1. Function l from S to N: l(x) is the length of x. For instance,
l(00110) = 5.
2. Function z from S to N: z(x) is the number zeroes in x. For instance,
z(00110) = 3.
3. Function n from S to N: n(x) is the number represented by x in binary
notation. For instance, n(00110) = 6.
4. Function e from S to S: e(x) is the string 1x. For instance, t(00110) =
100110.
5. Function r from S to S: r(x) is the string x reversed. For instance,
r(00110) = 01100.
6. Function p fromS to T(S): p(x) is the set of prexes of x. For instance,
p(00110) = , 0, 00, 001, 0011, 00110.
If the range of f is the whole co-domain B then we say that f is a function
onto B. A function f from A to B is called one-to-one if, for any pair of
dierent elements x, y of A, f(x) is dierent from f(y). If a function f is
both onto and one-to-one then we say that f is a bijection.
16
November 17.
Problem 45. Which of the functions l, z, n, e, r, p dened above are
one-to-one?
If f is a function from A to B, and g is a function from B to C, then
the composition of these functions is the function h from A to C dened by
the formula h(x) = g(f(x)). This function is denoted by g f.
Problem 46. For the functions l, z, n, e and r dened above, which of the
following formulas are true?
l r = l,
z r = z,
n r = n,
e r = r e.
If f is a bijection from A to B then the inverse of f is the function g
from B to A such that, for every x A, g(f(x)) = x. This function is
denoted by f
1
.
Problem 47. Find all bijections f from 1, 2, 3 to 1, 2, 3 such that
f
1
,= f.
Now we turn to the study of logical notation, the last topic in this course.
Truth values are the symbols F (false) and T (true). Propositional
connectives are functions that are applied to truth values and return truth
values. We will use these propositional connectives:
not (negation)
and (conjunction)
or (disjunction)
implies (implication)
is equivalent to (equivalence)
Negation is a unary connective (takes one argument); the others are binary
(take two arguments). Here are the tables of values for these connectives:
p p
F T
T F
17
p q p q p q p q p q
F F F F T T
F T F T T F
T F F T F F
T T T T T T
Propositional variables are variables for truth values, such as p and q
in the tables above. Propositional formulas are built from truth values and
propositional variables using propositional connectives. For instance,
(p q) (r F)
is a propositional formula.
18
November 22.
The truth table of a propositional formula shows its truth values for all
possible combinations of values of its variables. For instance:
p q r (p q) (r F)
F F F T
F F T F
F T F T
F T T T
T F F T
T F T T
T T F T
T T T T
Problem 48. Find a propositional formula that gets the value T in two
cases: when p = T, q = F, r = T and when p = T, q = T, r = F.
About propositional formulas F and G we say that they are equivalent
to each other if, for each combination of the values of their variables, the
truth value of F equals the truth value of G. For example,
p q is equivalent to p q,
p q is equivalent to (p q) (p q),
F is equivalent to p p,
T is equivalent to p p.
Using these four facts, we can eliminate from any propositional formula
the connectives and and the constants F and T. In other words, any
propositional formula can be equivalently rewritten as a formula formed
from variables using the connectives , and .
Here are two other useful facts about the equivalence of propositional
formulas:
(p q) is equivalent to p q,
(p q) is equivalent to p q.
These facts are called De Morgans laws.
Propositional variables are also called atoms. Atoms and negated atoms,
such as p and p, are called literals. A propositional formula is said to be in
negation normal form if it is formed from literals using conjunctions () and
disjunctions (). Any propositional formula can be equivalently rewritten
in negation normal form in two steps:
19
eliminate , , F, T, as described above;
use De Morgans laws to push the negations inside.
A propositional formula is said to be in conjunctive normal form (CNF) if
it is a conjunction of disjunctions of literals. A propositional formula is said
to be in disjunctive normal form (DNF) if it is a disjunction of conjunctions
of literals. For instance, the formula
p (p q) (q r s)
is in disjunctive normal form.
A formula in negation normal form can be turned into CNF by
distributing disjunction over conjunction, and to DNF by distributing
conjunction over disjunction.
Problem 49. Convert the formulas
(p q) r
and
p (q r)
to CNF and DNF.
A propositional formula is called a tautology if each of its truth values
is T.
Problem 50. Determine which of these formulas are tautologies:
(p q) (q p),
((p q) p) p,
(p (q r)) ((p q) (p r)).
20
November 22.
In logical formulas, we use the propositional connectives introduced above
and the quantiers (for all) and (exists).
Problem 51. Express in logical notation:
1. A B C
2. A = B C
3. A = a, b
Problem 52. Express in logical notation using variables for nonnegative
integers:
1. Number n can be represented as the sum of two complete squares.
2. Number n is composite.
21

You might also like