Download 1 Lecture 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Mathematics of radio engineering wikipedia , lookup

Large numbers wikipedia , lookup

Abuse of notation wikipedia , lookup

List of first-order theories wikipedia , lookup

List of prime numbers wikipedia , lookup

History of the function concept wikipedia , lookup

List of important publications in mathematics wikipedia , lookup

Mathematical proof wikipedia , lookup

Vincent's theorem wikipedia , lookup

Chinese remainder theorem wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Central limit theorem wikipedia , lookup

Four color theorem wikipedia , lookup

Addition wikipedia , lookup

Non-standard calculus wikipedia , lookup

Brouwer fixed-point theorem wikipedia , lookup

Principia Mathematica wikipedia , lookup

Elementary mathematics wikipedia , lookup

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Fundamental theorem of calculus wikipedia , lookup

Recurrence relation wikipedia , lookup

Collatz conjecture wikipedia , lookup

Theorem wikipedia , lookup

Quadratic reciprocity wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
1
Lecture 1
Introduction to Logic and Proofs.
Consider an example:
“If Peter studies hard he gets A in a class.”
Question: if Peter gets A in the class does it mean he studied hard? NO
Question: if Peter didn’t get A in class does it mean he didn’t study hard? YES
Statements “Peter gets A in the class,” “Peter studies hard” are examples of propositions. We can prescribe “True” or “False” values to these statement. Denote the first
statement as p, and the second as q. Then the whole statement becomes:
If p Then q,
or
p → q.
1. Propositions, Operations on propositions.
(a) Definition of a proposition.
(b) Definition of negation.
(c) Definition of injunction and disjunction. Truth Tables.
(d) Definition of exclusive or and conditional statement.
(e) Definition of bi-conditional statement.
(f) Compound propositions.
(g) Equivalent propositions.
2. Show that p ↔ q ≡ (p → q) ∧ (q → p).
3. Show that p → q ≡ ¬q → ¬p ≡ ¬p ∨ q.
1
2
Lecture 2
Tautology is a compound proposition that is always true; T. Contradiction is a compound proposition that is always false; F
1. Rules of logical operations. Identity laws:
p ∧ T ≡ p,
p ∨ F ≡ p.
Domination laws:
p ∨ T ≡ T,
p ∧ F ≡ F.
Idempotent laws:
p ∧ p ≡ p,
p ∨ p ≡ p.
Double negation:
¬(¬p) = p.
Commutative laws:
p ∧ q ≡ q ∧ p,
p ∨ q ≡ q ∨ p.
Associative laws:
p ∧ (q ∧ r) ≡ (p ∧ q) ∧ r,
p ∨ (q ∨ r) ≡ (p ∨ q) ∨ r.
Distributive laws:
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r),
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r).
Absorption Laws:
p ∨ (p ∧ q) ≡ p,
p ∧ (p ∨ q) ≡ p.
De Morgan’s Laws:
¬(p ∧ q) ≡ ¬p ∨ ¬q,
¬(p ∨ q) ≡ ¬p ∧ ¬q.
Negation Laws:
p ∨ ¬p ≡ T,
p ∧ ¬p ≡ F.
2
2. Proving rules of logical operations using Truth Tables.
(a) Prove De Morgan’s Laws for n propositions.
(b) Using the rules of logical operation show that
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
3. Satisfiability Problems. A compound proposition is called satisfiable if there is
an assignment of truth values of its variables that make the proposition True.
Determine if the compound proposition
(p ∨ q ∨ r) ∧ (¬p ∨ ¬q ∨ ¬r)
is satisfiable.Find all assignments of variables that make it satisfiable. Use the
Truth Table and/or the definition of logical operation.
Predicates and Quantifiers
Suppose that for any x from a set U, P(x) is a proposition then P(x) is called a
predicate with the domain U.
P(x) = “Student x in this class is a Math major” is a predicate on the domain
U = {set of all students in this class}.
Q(x, y) = “2x + y = 21” is a predicate with a domain
U = {(x, y)– all real numbers}.
Find the truth values of Q(5, 10) and Q(10, 1).
3
Propositions
“All students in this class are Math majors”
“There is a computer science major in this class”
are examples of quantifiers.
1. The universal quantifier of P(x) is the proposition “P(x) for all values x in the
domain U.” Notation:
∀ x P(x).
If U = {x1 , ..., xn }, then
∀ x P(x) = P(x1 ) ∧ ... ∧ P(xn ).
Let P(x) : “x > −x” with the domain of all positive real numbers. Find the truth
value of ∀ x P(x).
Answer: True.
Let P(x) : “x > −x” with the domain of all real numbers. Find the truth value of
∀ x P(x).
Answer: False.
Let Q(x, y) =“ Item x in store y is fresh,” where
x ∈ {carrots, onions, fish},
y ∈ {store1, store2, store3}.
Item
Carrots
Onions
Fish
Store1
+
-
Store2
+
-
Store3
+
+
+
Determine the truth value of ∀(x, y)Q(x, y), ∀xQ(x, store1), ∀xQ(x, store2), ∀yQ(carrots, y).
4
2. The existential quantifier of P(x) is the proposition “P(x) for some values x in
the domain U.” Notation:
∃ x P(x).
If U = {x1 , ..., xn }, then
∃ x P(x) = P(x1 ) ∨ ... ∨ P(xn ).
Let P(x) =“x2 ≥ 10” on the set of positive integers not exceeding 4. Find the
truth value of ∃ x P(x).
Answer: False.
3. Negating quantifiers:
¬∀xP(x) ≡ ∃x¬P(x),
¬∃xP(x) ≡ ∀x¬P(x).
Translate the statements into the logical symbols. Let x be in set of all students
in this class.
(a) Someone in your class can speak Hindi.
(b) Everyone in your class is friendly.
(c) There is a student in your class who was not born in California.
P(x) =“ x speaks Hindi”, Q(x) =“ x is friendly,” C(x) =“ x was born in
California.”
Answers: ∃xP(x), ∀xQ(x), ∃x¬C(x), or ¬∀xC(x).
Let x be in the domain of all people and S(x) =“ x is in my class.” Translate into
the logical symbols the statements from the previous problem.
Answers: ∃x(S(x) ∧ P(x)), ∀x(S(x) → Q(x)), ∃x(S(x) ∧ ¬C(x)).
4. Nested Quantifiers Let Q(x, y) be the predicate from the store problem. What
is the meaning of the following quantifiers:
5
(a) ∀x∀yQ(x, y) = ∀x(∀yQ(x, y));
(b) ∃x∀yQ(x, y) = ∃x(∀yQ(x, y));
(c) ∀x∃yQ(x, y) = ∀x(∃yQ(x, y));
(d) ∃x∃yQ(x, y) = ∃x(∃yQ(x, y)).
Describe in logical symbols the definition of a function continuous at a point x0 .
5. Negating Nested Quantifiers.
¬∃x∀yQ(x, y) ≡ ¬∃x(∀yQ(x, y)) ≡ ∀x¬∀yQ(x, y) ≡ ∀x∃y¬Q(x, y).
Describe in logical symbols the fact that a function is discontinuous at a point
x0 .
3
Lecture 3
Proofs
Definition is a statement in the form P(x) ↔ Q(x) that introduces new term, object or
property using already defined terms.
Examples:
1. Two lines l and m are parallel is they don’t intersect.
2. An integer n is even if n = 2k, for some integer k.
3. An integer n is odd if n = 2k + 1, for some integer k.
Axioms are the statements we assume to be true.
Examples:
6
1. If a and b are integers, then a + b and ab are integers.
2. Trough a point x not lying on the line l passes one and only one line m parallel
to l.
Theorems (lemmas, propositions) are the statements that can be shown to be True,
using definitions, axioms, and previously proved theorems.
4-point geometry
Undefined terms: a point, a line, a point is on the line.
1. Axiom 1 For every pair of distinct points x and y there is a unique line l such that
x is on l and y is on l.
2. Axiom 2 Given a line l and point x that is not on l, there is a unique line m such
that x is on m and no point of l is on m.
3. Axiom 3 There are four points.
4. Axiom 4 No three points are on the same line.
5. Definition Two lines l and m are parallel if there is no point x such that x is on l
and x is on m.
6. Theorem There are at least two distinct lines.
Proof. By axiom 3, there are three distinct points x, y, and z. By axiom 1, There is a
line l1 through x and y and there is a line l2 through y and z. By axiom 4, x, y, z are not
on the same line. Thus, lines l1 and l2 are distinct.
Axioms of Natural Numbers
Undefined terms: set of numbers N = {1, 2, 3, ...} with the property that if n, m ∈ N
then n + m ∈ N and nm ∈ N.
1. Axiom 1 1 belongs to N : there is a number 1 such that 1 ∗ n ∈ N for any n ∈ N.
2. Axiom2 There is no number n such that n + 1 = 1.
3. Axiom 3 If S is a subset of N with the property that for any n ∈ S, n + 1 ∈ S, and
1 ∈ S, then S = N.
7
Axiom 3 is the basis of Mathematical Induction.
Direct proof of the statement ∀x(P(x) → Q(x)). Start with x in the domain of P(x),
and assume P(x) is True. Show that Q(x) is True.
Theorem 1. For all real numbers x with x > 1, we have x2 > 1.
Multiply x > 1 by x.
x2 > x > 1.
Thus, x2 > 1.
Definition 1. An integer x divides and integer y (x|y) if there is an integer k such that
y = kx.
Prove.
Theorem 2. For all integers a, b, c if a|b and a|c, then a|(b + c).
Definition 2. An integer n is a perfect square if there is an integer k such that n = k2 .
Give a direct prove of
Theorem 3. If n is a perfect square, then n + 2 is not a perfect square.
The proposition ∀x(P(x) → Q(x)) is equivalent to ∀x(¬Q(x) → ¬P(x)). To prove
∀x(P(x) → Q(x)) by contraposition, start by assuming that ¬Q(x) is True and show
that ¬P(x) is true.
Theorem 4. For any integer n, if n2 is even the n is even.
8
Theorem 5. For any positive real numbers x and y, if
then x 6= y.
√
xy does not equals (x + y)/2,
Suppose that we want to prove that p is True. Suppose also that there is a proposition r such that
¬p → r ∧ ¬r.
Since the implication is always False, it follows that ¬p is False, i.e. p is True.
To prove that p is True by contradiction start with by assuming p is False and find
a contradiction.
Definition 3. A number a is called rational if there are two integers m, n such that
q=
m
.
n
If a number is not rational it is called irrational.
Prove by contradiction.
√
Theorem 6. 2 is a irrational number.
If the theorem is in the form ∀x(P(x) → Q(x)), then to do a proof by contradiction
you start by assuming ¬(∀x(P(x) → Q(x))) is True, or
¬(∀x(P(x) → Q(x))) ≡ ¬(∀x(¬P(x) ∨ Q(x))) ≡ ∃x(P(x) ∧ ¬Q(x)).
Prove the next theorem, first by contraposition, and then by contradiction.
Theorem 7. If n is odd, then 3n + 2 is odd.
9
1. Prove that if n is a perfect square, then n + 2 is not a perfect square.
2. Prove by contrapositive and then by contradiction that if m and n are integers and
mn is even the m is even or n is even.
3. Prove by contradiction that there is no rational number r such
r3 + r + 1 = 0.
4. Proving Equivalences Prove that for any integer n, n2 is even if and only if
3n + 2 is even. The statement of this kind is equivalent to
∀n((“n2 is even” → “3n + 2 is even” ) ∧ (“3n + 2 is even” → “n2 is even” ).
4
Lecture 4
Sets
Definition 4. Set is a unordered collection of elements.
Examples:
A = {1, 2, 9, 6, 4},
B = {a, b, c}.
Let P(x) be a predicate with domain U. Truth Set of P(x) is a set of x from the domain
U, such that P(x) is True.
10
Notation: “x is an element of A” is written as x ∈ A; “x is not an element of A” is
written as x 6∈ A.
Set builder notation:
A = {x– real number | x + 3 ≥ 0},
defines a set of real numbers with the property x + 3 ≥ 0.
Special sets:
1.
2.
3.
4.
N{0, 1, 2, 3...} – the set of natural numbers;
Z = {0, ±1, ±2, ±3...} – the set of integers;
Q the set of rational numbers;
R the set of real numbers (rational and irrational) numbers.
Definition 5. Sets A and B are equal if they consist of the same elements. We write:
A = B.
Set A is a subset of B if
(x ∈ A) → (x ∈ B).
We write A ⊂ B.
Set A is a proper subset of B, if
(A ⊂ B) ∧ (∃x(x ∈ A ∧ x 6∈ B)).
A set with no elements is called the empty set: 0.
/
A set with one element is called a singleton: {a}, {3}.
Two sets A and B are equal if and only if A ⊂ B and B ⊂ A.
Definition 6. The power set P(S) is a set consisting of all subsets of S, including the
empty set.
Let S = {1, 2, 3}. List all elements of P(S).
P(S) = {0,
/ {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
Let S be a set of n elements. How many elements does PS have?
Answer: 2n .
11
Set Operations.
Consider the subsets of some set U (“an universe”).
• Union of A and B:
A ∪ B = {x ∈ U | x ∈ A ∨ x ∈ B};
• Intersection of A and B:
A ∩ B = {x ∈ U | x ∈ A ∧ x ∈ B};
• Complement of A:
A = {x ∈ U | x 6∈ A};
• Set difference:
A \ B = {x ∈ U | x ∈ A ∧ x 6∈ B}.
Show that A ∩ B = A \ B.
Show that A ∪ B = A ∩ B.
Representing sets using Venn diagrams.
Some properties of sets.
1. A ∪ B = B ∪ A;
2. A ∪ (B ∪C) = (A ∪ B) ∪C;
3. A ∩ B = B ∩ A;
4. A ∩ (B ∩C) = (A ∩ B) ∩C;
5. A ∩ (B ∪C) = (A ∩ B) ∪ (A ∩C);
6. A ∪ (B ∩C) = (A ∪ B) ∩ (A ∪C);
7. De Morgan’s laws. A ∩ B = A ∪ B, A ∪ B = A ∩ B.
12
Proving properties of sets using predicates. Let P(x) and Q(x) be predicates such
that the truth set of P(x) is A and the truth set of Q(x) is B.
A ∩ B = Truth Set of P(x) ∧ Q(x),
A ∪ B = Truth Set of P(x) ∨ Q(x),
A = Truth Set of ¬P(x),
B = Truth Set of ¬Q(x)
Then,
A ∩ B = Truth Set of ¬(P(x) ∧ Q(x) = Truth Set of ¬P(x) ∨ ¬Q(x) = A ∪ B.
5
Lecture 6
Functions.
Definition 7. A function from set A to set B is an assignment to every element of A an
element of B. A is called the domain of f , B – co-domain of f .
Notation:
f : A → B,
f (a) = b,
a ∈ A, b ∈ B.
A function can be described by a table, a diagram, or a formula.
Definition 8. The range of f (image of f ) is the set of elements B such that for every
y ∈ B, there is x ∈ A and f (x) = y.
Im( f ) = {y ∈ B | ∃x((x ∈ A) ∧ ( f (x) = y))}.
Definition 9. A function f is said to be one-to-one or injective if
∀a∀b(( f (a) = f (b)) → (a = b)),
with domain A for a, b.
A function f from A to B is said to be onto or surjective if
∀b∃a( f (a) = b),
with domain A for a and domain B for b.
13
Determine if functions x2 , and 3x + 5 from R to R are one-to-one or onto.
Definition 10. A function f from A to B is one-to-one correspondence or bijection if
it is one-to-one and onto.
Let f be a function from {a, b, c, d} to {1, 2, 3, 4}, with f (a) = 4, f (b) = 2, f (c) =
1, f (d) = 3. Is f bijection?
Definition 11. Let f be a bijection from A to B. The inverse function of f is a function
from B to A such that assigns to a element b ∈ B an element a ∈ A such that
f (a) = b.
Notation:
f −1 (a) = b.
Note that
∀a∀b(( f −1 (b) = a) ↔ ( f (a) = b)).
A bijection is also called an invertible function, because we can define its inverse
f −1 . A function is called not invertible otherwise.
Let f be a function from A to B and g is a function from B to C. The comoposition
of f and g is a function h from A to C such that
∀a(h(a) = f (g(a)).
Notation: the composition is denoted by f ◦ g(a).
For functions f (x) = x2 and g(x) = 3x + 5 from R to R find f ◦ g and g ◦ g.
Note that f ◦ g and g ◦ f not necessarely equal, even if they are well defined.
If f is a bijection from A to B then for all a ∈ A and forall b ∈ B,
f −1 ◦ f (a) = a,
14
f ◦ g(b) = b.
Cardinality
Let A and B be two sets with finite number of elements. The number of elements
in A and B is denoted by |A| and |B|, respectively. |A| is also called cardinality of set
A.
1. If f is injective from A to B then
|A| ≤ |B|.
2. If f is surjective from A to B then
|A| ≥ |B|.
3. If f is a bijection (one-to-one correspondence) then
|A| = |B|.
There are sets with inifinit number of elements. The cardinality of the set of positive
integers is called countable.
Definition 12. A set A is said to be countable if it is either finite or there is one-to-one
correspondence between A and the set of positive integers.
1. The set of all positive even (odd) numbers is countable. The one-to-one correspondence f (n) = 2n ( f (n) = 2n − 1).
2. The set of all integers is countable. Make a list {0, 1, −1, 2, −2, 3, −3...} or use
a bijection.
n/2
n is even
f (n) =
−(n − 1)/2 n is odd
is one-to-one correspondence.
15
3. The set of all positive rational numbers is countable. We use Cantor diagonalization argument to show this.
4. The set of all rational numbers is countable.
Let h(n) be a bijection from positive integers to the set of positive rational numbers. Define

n is even
 h(n/2)
−h((n − 1)/2) n is odd, n 6= 1
f (n) =

0
n = 1.
5. The set of all real numbers is not countable.
6. The set [0, 1] is not countable.
Theorem 8. If A and B are countable then A ∪ B is countable.
Proof. First reduce the theorem to the case that A and B are disjoint:
A ∪ B = (A ∩ B) ∪ (A ∩ B) ∪ (A ∩ B).
Then consider three cases: both A, B are finite; one of them is finite; both infinite
countable sets.
In each case make a list of all elements.
16
Number Theory
Recall that if n and d are two positive integers, d|n (d divides n) if there is an integer
k such that n = dk.
Find the number of integers divisible by d that do not exceed n.
A positive number that is divisible by d can be writen kd. Thus, we’re looking for
the number of integers such that
0 < dk ≤ n,
or 0 < k ≤
n
.
d
Thus, the answer is: the largest integer not exceeding n/d. It is called the floor function:
bn/dc.
Theorem 9. Let a, b, c be integers. Then
1. if a|b and a|c then a|(b + c);
2. if a|b then a|bc for all integers c;
3. if a|b and b|c then a|c.
Give a direct proof of this theorem.
Theorem 10 (The Division Algorith). Let a be an integer and d a positive integer.
Then, there are unique integers q and r, with
0 ≤ r < d,
a = dq + r.
a is called divident, d –divisor, q–quotient, r–remainder.
q=a
div d,
r = a mod d.
17
6
Lecture 7
Modular Arithmetic
Definition 13. If a, b be integers and m is a positive integer. a is congruent to b modulo
m, if m divides (a − b) :
a ≡ b mod m ↔ m|(b − a).
Theorem 11. a ≡ b mod m if and only if
a
mod m = b
mod m.
Which of the numbers 80, 103, −29 is congruent to 5 modulo 17?
Theorem 12. Integers a, b are congruent modulo m, if and only if there an integer k,
such that
a = b + km.
Theorem 13. If
a ≡ b mod m,
c≡d
mod m,
then
a+c ≡ b+d
mod m,
ac ≡ bd
mod m.
Examples: 9 ≡ 4 mod 5 and 11 ≡ 1 mod 5. So,
20 ≡ 5
99 ≡ 4
mod 5,
Ceasar cipher.
18
mod 5.
Assign numbers 0 to 25 to the letters of the alphabet. Encrypt each letter in a secret
message to be sent by the function
f (p) = p + 3
LOV E MAT H → 11 14 21 4
mod 26.
12 0 19 0 → ORY H PDW K.
To decrypt, use the inverse function
f −1 (p) = p − 3
mod 26.
Decrypt the message: EOXH MHDQV.
Answer: BLUE JEANS.
Primes and Greatest Common Divisors.
Definition 14. A positive integer p is called a prime if its only divisible by 1 and itself.
A positive integer p, which is not a prime is called a composite number.
Examples: 11 is a prime, 12 = 4 × 3 = 22 × 3 is composite.
Theorem 14. The Fundamental Theorem of Arithmetics. Every positive integer greater
than 1 can be written uniquely as a prime or as the product of two or more primes where
the prime factors are written in nondecreasing order.
Examples: 50 = 2 × 52 , 121 = 112 , 143 = 11 × 13, 81 = 3 × 27 = 32 × 9 = 33 × 34 .
Theorem 15. There are infinitely many primes.
Give a proof by contradiction.
19
Theorem
16. If n is a composite integer, then n has a prime divisor less than or equal
√
to n.
Give a proof by contradiction.
Proof. Let√
n be a composite
number. Then n = a × b, where 1 < a < n √
and b > 1. Then
√
either a ≤ n or b ≤ n. Thus√n has a positive divisor not exceeding n. Then, it has
a prime divisor not exceeding n.
Show that 97 is a prime: consider primes not exceeding
not divisible by none of them. So, 97 is a prime.
√
97 < 10 : 2,3,5,7. 97 is
Theorem 17. Golbach’s Conjecture. Open problem. Every integer n > 2 is the sum of
two primes.
Definition 15. Let a, b be two integers not both zeros. The largest integer d such that
d|a and d|b is called the greatest common divisor of a and b :
d = gcd(a, b).
Example: gcd(25, 35) = 5, gcd(25, 11) = 1.
Definition 16. The integers a and b are relatively prime if gcd(a, b) = 1.
Finding gcd.
Giving factorizations
a = p1a1 pa22 ...pann ,
min{a ,b }
b = pb11 pb22 ...pbnn ,
min{a ,b }
n n
1 1
the gcd(a, b) = p1
...pn
.
Example: 120 = 23 × 3 × 5, 500 = 22 × 53 .
gcd(120, 500) = 22 × 5 = 20.
The Eucleadean Algorithm
20
Theorem 18. Let a = bq + r for integers a, b, q, r. Then
gcd(a, b) = gcd(b, r).
To find gcd(a, b) start by dividing the largest number by smallest:
a = bq1 + r1 .
If r1 6= 0, divide
b = r1 q2 + r2 .
Keep dividing until the remainder is zero:
rn−2 = rn−1 qn + rn ,
rn−1 = rn qn+1 .
The last non-zero remainder rn = gcd (a, b).
Find gcd (144, 233).
Theorem 19. gcd (a, b) as a linear combination. If a, b are positive integers, then there
exist integers s,t such that
gcd (a, b) = s × a + t × b.
Prove the theorem using the Eucleadean Algorithm.
Express as a linear combination gcd (9, 11), gcd (21, 55).
21
7
Lecture 8
Find gcd’s and express them as linear combinations.
1. gcd (17, 22). Answer: 1.
2. gcd (24, 36). Answer: 12.
3. gcd (91, 287). Answer: 7.
Theorem 20. If a, b, c are positive integers with gcd (a, b) = 1, and a|(bc), then a|c.
Proof. Express gcd as a linear combination of a, b.
Theorem 21. If p is prime and p|(a1 a2 ...an ), then p|ai , for some i.
Proof. Give a direct proof using the previous theorem.
Theorem 22. Uniqueness of the prime factorization. The prime factorization of an
integer n is unique (up to the order in which the factors are written).
Proof. Give a proof by contradiction, starting with two different factorizations of number n. Then use theorem 21
Theorem 23. Let m be a positive integer and let a, b, c be integers. If
(ac ≡ bc mod m) ∧ (gcd (a, b) = 1) ,
then
a≡b
mod m.
22
Proof. Give a direct proof, using the result of theorem 20.
8
Lecture 9
Linear Congruences
Definition 17. A congruence of the form
ax ≡ b
mod m
is called a linear congruence.
Definition 18. An integer ā such that āa ≡ 1 mod m, is called an inverse of a modulo
m.
Theorem 24. If a and m are relatively prime integers and m > 1, then an inverser of a
modulo m exists. The inverse is unique modulo m.
Proof. Use the representation of gcd as a linear combination.
Problem
Find an inverse of 2 modulo 17. Answer x = 9.
Find an inverse of 144 modulo 233. Answer x = 89.
Note: the inverse not unique. In the first problem, x = 9 + 17k is an inverser for
any integer k.
23
Solve the congruence:
2x ≡ 7
mod 17.
• Check that 2 and 17 are relatively prime: gcd (2, 17) = 1.
• Find the inverse of 2 modulo 17: x = 9.
• Multiply the congruence by 9 and simplify:
9 × 2x ≡ 9 × 7
mod 17
x ≡ 63
mod 17
x ≡ 12
mod 17.
• List of all solutions: x = 12 + 17k, k – any integer.
The Chinese Remainder Theorem
Chinese mathematician Sun-Tsu asked:
There are certain things whose number is unknown. When divided by 3, the remainder is 2; when divided by 5, the remainder is 3; when divided by 7, the remainder
si 2. What is that number.
We’re trying to solve the system of linear congruences:
x≡2
mod 3
x≡3
mod 5
x≡2
mod 7
Theorem 25. The Chinese Remainder Theorem Let m1 , m2 , ..., mn be pairwise relatively prime positive integers and a1 , a2 , ..., an any integers. Then, the system
x ≡ a1
mod m1
x ≡ a2
mod m2
...
x ≡ an
mod mn
has a solution, unique modulo m = m1 × m2 × ... × mn .
Proof. Let m = m1 × m2 × ... × mn and define
Mk =
24
m
.
mk
• Show that gcd (mk , Mk ) = 1.
It follows that Mk has an inverse modulo mk . Call it yk :
Mk yk ≡ 1
mod mk .
• Show that
x = a1 M1 y1 + a2 M2 y2 + ... + an Mn yn
is a solution to ALL congruences.
• Show that solution is unique modulo m.
Lets solve Sun-Tsu puzzle: m = 3 × 5 × 7 = 105.
Problem
Show that
M1 = 35, M2 = 21, M3 = 15.
y1 = 2, y2 = 1, y3 = 1.
x = 233 ≡ 23
mod 105.
Problem
Using the direct substitution verify that x = 23 is a solution to the Sun-Tsu puzzle.
The Chinese Remainder Theorem implies that any number a, such that
0≤a<m
is uniquely represented by n remainders
(a1 , a2 , ..., an ),
0 ≤ ai < mi , i = 1..n.
Let b be another number 0 ≤ b < m, given by remainders:
(b1 , b2 , ..., bn ),
0 ≤ bi < mi , i = 1..n.
25
Suppose that a × b < m, then, the product a × b is represented by the remainders
(a1 b1
mod m1 , a2 b2
mod m2 , ..., an bn
mod mn ),
since for any i,
(ai = a
mod mi ,
bi = b mod mi ) ⇒ (ai bi = ab mod mi ) .
This is used to
• perform operations with numbers larger than a computer can handle;
• to split the computation of the operation into several simplier operations that can
be done in parallel.
Problem
List the remainder represention of all integers less then 15, using the factorization
15=3*5.
Compute the remainder representation of 6+5.
Use the solution of the Chinese Remainder Theorem to recover result 6+5=11.
Using pairwiser relatively prime numbers 95, 97,98,99 we can operate with numbers less than 95 ∗ 97 ∗ 98 ∗ 99 = 8.940393 ∗ 107 .
9
Lecture 11
More examples for solving congruencies
26
Solve the congruence
15x2 + 19x ≡ 5
This is equivalent to
15x2 + 19x + 6
mod 11.
≡ 0 mod 11, or
(3x + 2)(5x + 3) ≡ 0
mod 11.
Thus (why?),
3x + 2 ≡ 0
mod 11,
∨ 5x + 3 ≡ 0
3x ≡ −2
mod 11,
∨ 5x ≡ −3
mod 11.
Then,
mod 11.
Check that 4 × 3 ≡ 1 mod 11, and 9 × 5 ≡ 1 mod 11. Then
x ≡ −8 ≡ 3
mod 11,
x ≡ −27 ≡ 6
mod 11.
or
Set of solutions x ∈ {3 + k11}, or x ∈ {6 + k11}.
Not all congruencies have solutions:
2x ≡ 5
mod 6
does not have a solution. Show this.
Fermat’s Little Theorem
Theorem 26. If p is prime and a is an integer not divisible by p, then
a p−1 ≡ 1
mod p.
For any integer a,
ap ≡ a
mod p.
Proof. First, show that no two integers in the set a, 2a, 3a, ..., (p − 1)a are congruent
modulo p. Then, the set of p − 1 remainders from the division by p coincide with the
the set of numbers 1, 2, ..., p − 1. By multiplying all numbers and remainders we obtain
that
a p−1 (p − 1)! ≡ (p − 1)! mod p.
Since gcd(p, (p − 1)!) = 1, (p − 1)! has an inverse modulo p. Then, by multiplying the
congruence by the inverse we get:
a p−1 ≡ 1
Problem
27
mod p.
Show that the second statement of the theorem follows from the first.
Problem
Use Fermat’s Little theorem to find 7121 mod 13.
Divide 121 = 10 × (13 − 1) + 1. Then
7121 ≡ 710×(13−1) × 7 ≡ 7
mod 13.
The Principle of Mathematical Induction
Let P(n) be a predicate on the set of natural numbers. We’re interested in establishing that
∀nP(n)
is True.
The Principle of Math. Induction is an equivalent proposition
P(1) ∧ ∀k (P(k) → P(k + 1)) ≡ ∀nP(n).
To show that P(n) is True for all n, show that
• BASIS STEP:
P(1) is True;
• INDUCTIVE STEP: Assuming that P(k) is True show that
P(k + 1) is True.
Problem
28
Show that for any positive integer n,
1 + 2 + ... + n =
n(n + 1)
.
2
For any positive integer n,
n
∑ k2k = (n − 1)2n+1 + 2.
i=1
For any integer n > 1,
n! < nn .
For any positive integer n,
3 | n3 + 2n.
Find and prove the formula for the sum
1
1
1
+
+ ... +
.
1×2 2×3
n(n + 1)
Let A1 , A2 , ..., An and B1 , B2 , ..., Bn be sets such that
Ai ⊂ Bi ,
i = 1..n.
Prove that
∪ni=1 Ai ⊂ ∪ni=1 Bi .
Prove that for any positive n,
1 × 2 × 3 + 2 × 3 × 4 + ... + n(n + 1)(n + 2) =
n(n + 1)(n + 2)(n + 3)
.
4
Prove that for any positive integer n,
1 + 3 + 5 + ... + (2n − 1) = n2 .
Prove that for all non-negative integers n,
5 | (7n − 2n ).
Strong Mathematical Induction
29
The Strong Mathematical Induction is the equivalence of propositions:
P(1) ∧ ∀k ((P(1) ∧ P(2) ∧ ... ∧ P(k)) → P(k + 1)) ≡ ∀nP(n).
Problem
Prove the Fundamental Theorem of Arithmetics: any integer n ≥ 2 is either
prime or a product of primes.
The Fibonacci numbers are defined by the recurrence relation:
1
n = 1, 2
F(n) =
F(n − 1) + F(n − 2) n > 2.
Problem
Prove the formula for nth Fibonacci number F(n) :
(9.1)
F(n) =
αn − β n
,
α −β
√
1+ 5
α=
,
2
√
1− 5
β=
.
2
Hint: α, β are the roots of x2 = x + 1.
Prove Lamé’s Theorem: let a ≥ b be two positive integers. Then, the number of
operations n needed to find gcd (a, b), is less than 1 + 5 log10 b.
The formula in (9.1) is an example of recursively defined function. The definition
has Basis step and Recursive Step that defines values of function from already known
values.
Recursive definitions are very common in Mathematics. They are used to define
functions, objects, algorithms.
Because the structure of the recursive definitioins is similar to the structure of Math.
Induction Principle, the later is often used to prove properties of the recursively defined
objects.
Consider the following definition.
Definition 19. A set of full binary trees is defindeby by:
Basis Step: A single vertex (root) is a full binary tree.
Recursive Step: If T1 , T2 are disjoint full binary trees, there is a full binary tree T1 · T2 , consisting
of a root (a vertex) r and the edges connecting the roots fo each of the roots of
the left subtree T1 , and the right subtree T2 .
30
Problem
Draw several full binary trees using the definition.
Definition 20. The height h(T ) of a full binary tree is defined recursively by:
Basis Step: If T is a single root, h(T ) = 0.
Recursive Step: If T = T1 · T2 then
h(T ) = 1 + max{h(T1 ), h(T2 )}.
Definition 21. Let n(T ) be a number of vertices’s in a full binary tree T. If T is a single
root, then n(T ) = 1. If T = T1 · T2 , then
n(T ) = n(T1 ) + n(T2 ) + 1.
Theorem 27. If T is a full binary tree, then
n(T ) ≤ 2h(T )+1 − 1.
Proof. Proof by Structural Induction.
Recursive Algorithms
The example of a recursive algorithm is a solution of the Hanoi Tower puzzle.
The number of moves needed to solve the puzzle with n discs satisfies the recurrence relation
Hn = 2Hn−1 + 1, H1 = 1.
Find the solution of this recurrence relation.
Answer: Hn = 2n + 1.
Solving Linear Recurrence Relations
31
Definition 22. A linear homogeneous recurrence relation of degree k is recurrence
relation
an = c1 an−1 + ... + ck an−k ,
(9.2)
where ck 6= 0.
Examples
The recurrence from the Hanoi Tower puzzle:
Hn = 2Hn−1 + 1,
is a non-homogeneous linear relation of order 1. The corresponding homogeneous relation is
Hn = 2Hn−2 .
Theorem 28. Solutions of (9.2) are uniquely defined by k initial data:
a0 = C0 , a1 = C1 , ..., ak−1 = Ck−1 .
Proof. Give a proof by Math. induction, starting with two solutions an and bn of the
same recurrence relation with the same initial conditions.
Definition 23. The characteristic equation for (9.2) is the polynomial equation
rk − c1 rk−1 − ... − ck = 0.
The solutions of the characteristic equations are called characteristic roots.
Consider a second degree recurrence relation
an = c1 an−1 + c2 an−2
and its characteristic equation
r2 − c1 r − c2 = 0.
32
Theorem 29. If the characteristic equation has two distinct roots r1 , and r2 , then any
solution of the recurrence relation equals
an = α1 r1n + α2 r2n ,
for some α1 , α2 . And, conversely, the above formula, for any α1 , α2 defines a solution
of the recurrence relation.
Proof. Give a proof of this theorem.
Problem
Solve the Fibonacci recurrence relation.
Theorem 30. If the characteristic equation has a single root r then any solution of the
recurrence relation equals
an = α1 rn + α2 nrn ,
for some α1 , α2 . And, conversely, the above formula, for any α1 , α2 defines a solution
of the recurrence relation.
Consider a kth degree recurrence relation
an = c1 an−1 + c2 an−2 + ... + ck an−k
and its characteristic equation
rk − c1 rk−1 − ... − ck = 0.
Theorem 31. If the characteristic equation has k distinct roots r1 , ..., rk the set of all
solutions of the recurrence relation is described by the formula
an = α1 r1n + ... + αk rkn ,
for arbitrary numbers α1 , ..., αk .
Example
Solve the relation
an = 6an−1 − 11an−2 + 6an−3
with initial conditions
a0 = 2, a1 = 5, a2 = 15.
Roots of the characteristic equation are: 1,2,3.
Answer: an = 1 − 2n + 23n .
Linear Non-homogeneous Recurrence Relations
33
Definition 24. A recurrence relation
an = c1 an−1 + ... + ck an−k + F(n),
with ck 6= 0, for a given function F(n) is called linear non-homogeneous recurrence
relation of order k.
Theorem 32. If anp is a particular solution of the non-homogeneous recurrence relation, then the set of all solutions of the non-homogeneous recurrence relation equals
an = ahn + anp ,
where ahn is any solutions of the corresponding homogeneous recurrence relation.
Examples
Find all solutions of the relation
Hn = 2Hn−1 + 1.
Find all solutions of the relation
an = 5an−1 − 6an−2 + 7n .
Answer: an = α1 3n + α2 2n + (49/20)7n .
The method of undetermined coefficients for non-homogeneous recurrence relations
The following theorem describes a method for finding a particular solution anp of
a recurrence relation.
Theorem 33. Suppose that function
F(n) = sn (bl nl + ... + b1 n + b0 ).
If s is not the root of the characteristic equation, there is a particular solution
anp = sn (βl nl + ... + b1 n + β0 ),
for some numbers β0 , ..., βl .
If s is a root of the characteristic equation of multiplicity m, then there is a
particular solution
anp = nm sn (βl nl + ... + b1 n + β0 ),
for some numbers β0 , ..., βl .
34
Write the arithmetic progression an = ∑nk=1 k as a non-homogeneous recurrence
relation of degree 1 and find the solution.
Answer: an =
n(n+1)
2 .
Various Problems
• Solve the recurrence relation:
an = 7an−1 − 10an−2 ,
a0 = 2, a1 = 1.
• Find a general solution of the recurrence relation
an = 2an−1 + 2n .
• In how many ways can 2xn rectangular checkerboard be tiled using 1x2 and 2x2
pieces?
Hint: obtain a recurrence relation an = an−1 + 2an−2 , a1 = 1, a2 = 3.
35
Review for Test 2
You may use calculators on this test. Don’t forget to bring a blue book.
1. True or False:
175 ≡ 22
mod 17.
2. Find the prime factorization of the number 1400.
3. Use the Euclidean algorithm to find gcd (203, 101), gcd (34, 21).
4. Let m be a positive integer and let a, b, c be integers. Show that if a ≡ b mod m,
then
a − c ≡ b − c mod m.
5. Find an inverse of 55 modulo 89.
6. Solve a linear congruency 55x ≡ 34 mod 89. Use the answer from the previous
problem.
7. Use Fermat’s little theorem to find 231002 mod 41.
8. Show that 3n < n! whenever n is an integer and n ≥ 7.
9. Prove that
2n−1
∑ (2i + 1) = 3n2 ,
i=n
when n is a positive integer.
10. Suppose that the only currency you have are 3-dollar and 10-dollar bills. Show
that any amount greater than 17 dollars can be made from a combination of these
bills.
36
Counting Techniques
Counting is a very common problem. There are several rules that we will discuss.
Types of counting
1. Addition Rule Let A, B be two disjoint sets:
A ∩ B = 0.
/
Then,
|A ∪ B| = |A| + |B|.
On a single day, a restaurant served 25 people for lunch and 37 people for dinner.
How many different customers the restaurant served, if non of the customer had
lunch and dinner.
Answer: 37+25=62.
On a single day, a restaurant served 25 people for lunch and 37 people for dinner.
How many different customers the restaurant served, if 8 people had both lunch
and dinner.
Answer: 25+37-8=54.
2. The last problem is an example of inclusion-exclusion principle of counting.
Let A, B be two sets not necessarily disjoint. Then
|A ∪ B| = |A| + |B| − |A ∩ B|.
3. The inclusion-exclusion principle for 3 sets. Let A, B,C be sets then
|A ∪ B ∪C| = |A| + |B| + |C| − |A ∩ B| − |A ∩C| − |B ∩C| + |A ∩ B ∩C|.
In a group of 100 students, 50 take a Math class, 12 take a Chem. class and 8
take a Phys. class. 6 take both a Math and a Chem. class, 4 take both Math and
Phys class, 3 take Chem and Phys class, and 2 take all three classes. Find the
number of students that take at least one class.
Answer: Use the inclusion-exclusion principle:
50 + 12 + 8 − 8 − 6 − 4 + 2 = 54.
4. This problem can also be solved using Venn Diagram.
5. Another way to solve it: set a set of equations for the number of students in
disjoint sets.
Product Rule.
1. Let A, B be two sets. The Cartesian product A × B is a set of all pairs (a, b),
where a ∈ A, and b ∈ B.
37
2. The number of elements in A × B :
|A × B| = |A||B|.
How many different words of length 4 can be made from the alphabet (a, b, c, d, e, f , g)
Answer: 74 .
How many different words of length 4, where the first symbols are any of the
letters (a, b, c, d) and the last two are any numbers 0, 1, ..., 9.
Answer: 42 102 = 800.
How many different words of length 4 can be made from the alphabet (a, b, c, d, e, f , g)
if no two adjacent letters are the same.
Answer: 7 · 63 .
How many nonempty string of at most lenght 4 can be formed from the alphabet
(a, b, c, d, e, f , g).
Answer: 7 + 72 + 73 + 74 .
Permutations
1. The number of ways to form an ordered list (arrangement) of r distinct elements
from a set of n elements equals:
P(n, r) =
n!
.
(n − r)!
How many words of length 4 can be formed from the alphabet (a, b, c, d, e, f , g)
if a word should contain only distinct letters.
Answer: P(7, 4).
What is the number of ways to choose birthdates for 10 people if no two people
should have a birthday on the same date.
Answer: P(365, 10).
2. Drawing balls from a box with and without replacement. A box contains 4 balls
numbered from 1 to 4. You select a ball from the box, record its number and
then return it to the box. You do this 3 times. How many different arrangements
of balls numbers are there?
Answer: 43 .
Solve the problem, assuming that you don’t return the ball to the box after you
draw it.
Answer: P(4, 3).
Combinations
38
1. The number of ways to form an unordered list (combination) of r distict element
from a set of n elements equals:
n!
n
=
.
C(n, r) =
r
r!(n − r)!
A baseball team has 24-man roster. How many different ways are there to choose
a group of nine players to start the game?
Answer: C(24, 9) = 1, 307, 504.
You select 3 balls from a box containing 4 balls without the replacement. How
many different combinations are there?
Answer: C(4, 3) = 4.
A box contains 4 red balls and 5 black balls. How many different combinations
that contain 3 red balls and 3 black balls are there?
Answer: C(4, 3)C(5, 3) = 40.
How many different committees of size 10, that contain 5 men and 5 women, can
be chosen from a set of 15 men and 20 woman?
Answer: C(15, 5)C(20, 5).
How many different ways are there to rearrange the letters in the word:
SSSSFFFFFSSFSF
Answer: C(14, 7).
How many solutions are there to the equation
x1 + x2 + x3 + x4 + x5 = 13,
if all xi ’s are non-negative integers.?
You need 13 counting sticks and 4 plus signs to separate them: for example
x1 = 0, x2 = 0, x3 = 3, x4 = 0, x5 = 10 corresponds to
+ + ||| + +||||||||||
There are C(13 + 4, 4) to select places for plus signs among 13 + 4 = 17 places.
Thus, the number of solutions equals
17
.
4
The Binomial Coefficients and The Binomial Theorem
1. Prove the following theorem by induction. Let j, k be non-negative integers such
that j +k = n. The coefficient of a j bk term in the expansion of (a+b)n , is C(n, j).
39
2. The binomial theorem:
n
n k n−k
ab .
(a + b) = ∑
k=0 k
n
Counting Using Functions
Pigeonhole Principle
40
Review problems for Test 3
1. Prove that a set with n elements has n(n − 1)/2 subsets containing exactly 2
elements, whenever n ≥ 2.
2. Prove that 6 divides n3 − n whenever n ≥ 0.
3. Prove that if h > −1 then
(1 + h)n ≥ 1 + nh.
4. Solve the recurrence relation
an = −6an−1 − 9an−2 ,
n ≥ 2,
a0 = 3, a1 = − 3.
Answer: an = (3 − 2n)(−3)n .
5. Solve the recurrence relation
an+2 = −4an+1 + 5an ,
n ≥ 0,
a0 = 2, a1 = − 8.
Answer: an = − (−5)n + 3.
6. How many different messages can be transmitted in n microseconds using three
different signals if one signal requires 1 microsec., the other 2 signals require 2
microsec. for each transmittal, and a signal in a message is followed immediately
by the next signal?
Answer: (1/3)(−1)n + (2/3)2n .
7. A model for the number of lobsters caught per year is based on the assumption
that the number of lobsters caught in a year is the average of the number caught
in the two previous years. Find the recurrence relation for the number of lobsters
Ln . Find Ln if 100,000 lobster were caught in year 1 and 300,000 lobsters were
caught in year 2.
Answer: Ln = (800, 000/3)(−1/2)n + (700, 000/3).
8. Find all solutions of the recurrence relation an = −5n−1 − 6an−2 + 42 · 4n . Find
the solution of this relation with a1 = 56 and a2 = 278.
Answer: an = α(−2)n + β (−3)n + 4n+2 . an = (−2)n + 2(−3)n + 4n+2 .
9. Find all solutions of the recurrence relation
an = 6an−1 − 12an−2 + 8an−3 + n2n .
Hint: the characteristic equation has a single root r = 2 of multiplicity 2. The
particular solution will have form n3 2n (β1 n + β2 ).
41