Download presentation
Presentation is loading. Please wait.
Published byLauren Dennis Modified over 9 years ago
1
Week 6 - Friday
2
What did we talk about last time? Solving recurrence relations
4
This is a donkey made of toothpicks Move exactly one toothpick to make an identical donkey oriented in another direction
5
Student Lecture
7
Second-order linear homogeneous relations with constant coefficients are recurrence relations of the following form: a k = Aa k-1 + Ba k-2 where A, B R and B 0 These relations are: Second order because they depend on a k-1 and a k-2 Linear because a k-1 and a k-2 are to the first power and not multiplied by each other Homogeneous because there is no constant term Constant coefficients because A and B are fixed values
8
I'm sure you're thinking that this is an awfully narrow class of recurrence relations to have special rules for It's true: There are many (infinitely many) ways to formulate a recurrence relation Some have explicit formulas Some do not have closed explicit formulas We care about this one partly for two reasons 1. We can solve it 2. It lets us get an explicit formula for Fibonacci!
9
Which of the following are second-order linear homogeneous recurrence relations with constant coefficients? a) a k = 3a k-1 + 2a k-2 b) b k = b k-1 + b k-2 + b k-3 c) c k = (1/2)c k-1 – (3/7)c k-2 d) d k = d 2 k-1 + d k-1 d k-2 e) e k = 2e k-2 f) f k = 2f k-1 + 1 g) g k = g k-1 + g k-2 h) h k = (-1)h k-1 + (k-1)h k-2
10
We will use a tool to solve a SOLHRRwCC called its characteristic equation The characteristic equation of a k = Aa k-1 + Ba k-2 is: t 2 – At – B = 0 where t 0 Note that the sequence 1, t, t 2, t 3, …, t n satisfies a k = Aa k-1 + Ba k-2 if and only if t satisfies t 2 – At – B = 0
11
We can see that 1, t, t 2, t 3, …, t n satisfies a k = Aa k-1 + Ba k-2 if and only if t satisfies t 2 – At – B = 0 by substituting in t terms for a k as follows: t k = At k-1 + Bt k-2 Since t 0, we can divide both sides through by t k-2 t 2 = At + B t 2 – At – B = 0
12
Consider a k = a k-1 + 2a k-2 What is its characteristic equation? t 2 – t – 2 = 0 What are its roots? t = 2 and t = -1 What are the sequences defined by each value of t? 1, 2, 2 2, 2 3, …, 2 n, … 1, -1, 1, -1, …, (-1) n, … Do these sequences satisfy the recurrence relation?
13
An infinite number of sequences satisfy the recurrence relation, depending on the initial conditions If r 0, r 1, r 2, … and s 0, s 1, s 2, … are sequences that satisfy the same SOLHRRwCC, then, for any C, D R, the following sequence also satisfies the SOLHRRwCC a n = Cr n + Ds n, for integers n ≥ 0
14
Solve the recurrence relation a k = a k-1 + 2a k-2 where a 0 = 1 and a 1 = 8 The result from the previous slide says that, for any sequence r k and s k that satisfy a k a n = Cr n + Ds n, for integers n ≥ 0 We have these sequences that satisfy a k 1, 2, 2 2, 2 3, …, 2 n, … 1, -1, 1, -1, …, (-1) n, … Thus, we have a 0 = 1 = C2 0 + D(-1) 0 = C + D a 1 = 8 = C2 1 + D(-1) 1 = 2C – D Solving for C and D, we get: C = 3 D = -2 Thus, our final result is an = 3∙2 n – 2(-1) n
15
We can generalize this result Let sequence a 0, a 1, a 2, … satisfy: a k = Aa k-1 + Ba k-2 for integers k ≥ 2 If the characteristic equation t 2 – At – B = 0 has two distinct roots r and s, then the sequence satisfies the explicit formula: a n = Cr n + Ds n where C and D are determined by a 0 and a 1
16
Fibonacci is defined as follows: F k = F k-1 + F k-2, k ≥ 2 F 0 = 1 F 1 = 1 What is its characteristic equation? t 2 – t – 1 = 0 What are its roots? Thus,
17
So, we plug in F 0 = 1 and F 1 = 1 Solving for C and D, we get Substituting in, this yields
18
Our previous technique only works when the characteristic equation has distinct roots r and s Consider sequence a k = Aa k-1 + Ba k-2 If t 2 – At – B = 0 only has a single root r, then the following sequences both satisfy a k 1, r 1, r 2, r 3, … r n, … 0, r, 2r 2, 3r 3, … nr n, …
19
Our old rule said that if r 0, r 1, r 2, … and s 0, s 1, s 2, … are sequences that satisfy the same SOLHRRwCC, then, for any C, D R, the following sequence also satisfies the SOLHRRwCC a n = Cr n + Ds n, for integers n ≥ 0 For the single root case, this means that the explicit formula is: a n = Cr n + Dnr n, for integers n ≥ 0 where C and D are determined by a 0 and a 1
20
To solve sequence a k = Aa k-1 + Ba k-2 Find its characteristic equation t 2 – At – B = 0 If the equation has two distinct roots r and s Substitute a 0 and a 1 into a n = Cr n + Ds n to find C and D If the equation has a single root r Substitute a 0 and a 1 into a n = Cr n + Dnr n to find C and D
22
For example, we can define sets recursively To do so, we need three things: I. Base: A statement of that certain things are in the set II. Recursion: A set of rules saying how new objects can be shown to be in the set based on ones that are already known to be in the set III. Restriction: A statement that no objects belong to the set other than those coming from I and II
23
The set P of all strings of legal parenthesizations I. Base: () is in P II. Recursion: a. If E is in P, so is (E) b. If E and F are in P, so is E F III. Restriction: No configurations of parentheses are in P other than those derived from I and II
24
Even functions can be defined recursively The Ackermann function is famous because it grows faster than any algebraic function It is defined for all non-negative integers as follows: A(0,n) = n + 1 A(m,0) = A(m – 1, 1) A(m,n) = A(m – 1, A(m,n – 1)) Find A(1,2) I won't make you find A(4,4), because it is roughly
26
A set is a collection of elements The set is defined entirely by its elements Order doesn't matter Repetitions don't matter (but, in general, we write each element of set only a single time) Examples { 1, 4, 9, 25 } { 1 } is not the same as 1 { } is the empty set
27
For a finite set, we can write all of the elements inside curly braces For infinite sets, we don't have that luxury What's in each of the following sets? A = { x R | -3 < x < 4 } B = { x Z | -3 < x < 4 } C = { x Z + | -3 < x < 4 } D = { x Q | -3 < x < 4 }
28
Perhaps the simplest relationship between sets is the subset relationship We say that X is a subset of Y iff every element of X is an element of Y Notation X Y Examples: Is { 1, 2, 3 } { 1, 2, 3, 4 } ? Is { 1, 2, 3, 4 } { 1, 2, 3 } ? Is { 1, 2, 3 } { 1, 2, 3 } ? Is { } { 1, 2, 3 } ? Is { {1}, {2}, {3} } { 1, 2, 3 } ?
29
We say that X is a proper subset of Y iff every element of X is an element of Y, but there is some element of Y that is not an element of X Notation X Y Examples: Is { 1, 2, 3 } { 1, 2, 3, 4 } ? Is { 1, 2, 3, 4 } { 1, 2, 3 } ? Is { 1, 2, 3 } { 1, 2, 3 } ? Is { } { 1, 2, 3 } ? Is { {1}, {2}, {3} } { 1, 2, 3 } ?
30
Venn diagrams show relationships between sets They can help build intuition about relationships, but they do not prove anything Also, their usefulness is limited to 2 or 3 sets Beyond that, they become difficult to interpret Example: For X Y, there are 3 possibilities: X X Y Y X X Y Y X X Y Y
31
The idea of being an element of a set is strongly tied to the idea of one set being the subset of another These two relationships are different, however x X means that x is an element of X Y X means that Y is a subset of X Which of the following are true? 2 {1, 2, 3} {2} {1, 2, 3} 2 {1, 2, 3} {2} {1, 2, 3} {2} {{1}, {2}} {2} {{1}, {2}}
32
We say that two sets are equal if they contain exactly the same elements Another way of saying this is that X = Y iff X Y and Y X Examples: A = { n Z | n = 2p, p Z } B = the set of all even integers C = { m Z | m = 2q – 2, q Z } D = { k Z | k = 3r + 1, r Z } Does A = B? Does A = C? Does A = D?
33
We usually discuss sets within some superset U called the universe of discourse Assume that A and B are subsets of U The union of A and B, written A B is the set of all elements of U that are in either A or B The intersection of A and B, written A B is the set of all elements of U that are in A and B The difference of B minus A, written B – A, is the set of all elements of U that are in B and not in A The complement of A, written A c is the set of all elements of U that are not in A
34
Let U = {a, b, c, d, e, f, g} Let A = {a, c, e, g} Let B = {d, e, f, g} What are: A BA B A BA B B – A AcAc
35
There is a set with no elements in it called the empty set We can write the empty set { } or It comes up very often For example, {1, 3, 5} {2, 4, 6} = The empty set is a subset of every other set (including the empty set)
36
Two sets A and B are considered disjoint if A B = Sets A 1, A 2, … A n are mutually disjoint (or nonoverlapping) if A i A j = for all i j A collection of nonempty sets {A 1, A 2, … A n } is a partition of set A iff: 1. A = A 1 A 2 … A n 2. A 1, A 2, … A n are mutually disjoint
37
Given a set A, the power set of A, written P (A) or 2 A is the set of all subsets of A Example: B = {1, 3, 6} P (B) = { , {1}, {3}, {6}, {1,3}, {1,6}, {3,6}, {1,3,6}} Let n be the number of elements in A, called the cardinality of A Then, the cardinality of P (A) is 2 n
38
An ordered n-tuple (x 1, x 2, … x n ) is an ordered sequence of n elements, not necessarily from the same set The Cartesian product of sets A and B, written A x B is the set of all ordered 2-tuples of the form (a, b), a A, b B Thus, (x, y) points are elements of the Cartesian product R x R (sometimes written R 2 )
40
Inclusion of Intersection: For all sets A and B A B AA B A A B BA B B Inclusion in Union: For all sets A and B A A B B A B Transitive Property of Subsets: If A B and B C, then A C
41
The basic way to prove that X is a subset of Y 1. Suppose that x is a particular but arbitrarily chosen element of X 2. Show that x is an element of Y If every element in X must be in Y, by definition, X is a subset of Y
42
We want to leverage the techniques we've already used in logic and proofs The following definitions help with this goal: 1. x X Y x X x Y 2. x X Y x X x Y 3. x X – Y x X x Y 4. x X c x X 5. (x, y) X Y x X y Y
43
Theorem: For all sets A and B, A B A Proof: Let x be some element in A B x A x B x A Thus, all elements in A B are in A A B AA B A QED Premise Definition of intersection Specialization By generalization Definition of subset
44
NameLawDual Commutative A B = B AA B = B A Associative (A B) C = A (B C)(A B) C = A (B C) Distributive A (B C) = (A B) (A C)A (B C) = (A B) (A C) Identity A = AA U = A Complement A A c = UA A c = Double Complement(A c ) c = A Idempotent A A = AA A = A Universal Bound A U = UA = De Morgan’s (A B) c = A c B c (A B) c = A c B c Absorption A (A B) = AA (A B) = A Complements of U and U c = c = U Set Difference A – B = A B c
45
To prove that X = Y Prove that X Y and Prove that Y X
46
Theorem: For all sets A,B, and C, A (B C) = (A B) (A C) Proof: Let x be some element in A (B C) x A x (B C) Case 1: Let x A x A x B x A B x A x C x A C x A B x A C x (A B) (A C) Case 2: Let x B C x B x C x B x A x B x A B x C x A x C x A C x A B x A C x (A B) (A C) In all possible cases, x (A B) (A C), thus A (B C) (A B) (A C)
47
Let x be some element in (A B) (A C) x (A B) x (A C)x (A B) x (A C) Case 1: Let x A x A x B C x A (B C) Case 2: Let x A x A Bx A B x A x B x B x A C x A x C x C x B x C x B C x A x B C x A (B C) In all possible cases, x A (B C), thus (A B) (A C) A (B C) Since both A (B C) (A B) (A C) and (A B) (A C) A (B C), A (B C) = (A B) (A C) QED
48
Prove that, for any set A, A = Hint: Use a proof by contradiction
50
More on set theory Russell’s paradox
51
Homework 4 is due Monday Keep reading Chapter 6
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.