Recurrences 2008. 1. 11 : 1 Chapter 3. Growth of function Chapter 4. Recurrences.
Recurrences, Part 1 - CEMC€¦ · Recurrences, Part 1 Troy Vasiga Centre for Education in...
Transcript of Recurrences, Part 1 - CEMC€¦ · Recurrences, Part 1 Troy Vasiga Centre for Education in...
Recurrences, Part 1
Troy Vasiga
Centre for Education in Mathematics and ComputingFaculty of Mathematics, University of Waterloo
cemc.uwaterloo.ca
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Outline
• Short biography of the speaker
• Recursion
• Why recursion is good
• Work on problems
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Short biography of the speaker
• Academic background:• B.Math (Computer Science and Combinatorics and
Optimization, Double Degree), UW, 19• M.Math (Combinatorics and Optimization) [thesis topic:
“α-resolvable designs of block size 4”], UW, 19• B.Ed, UBC, 19• Ph.D (Computer Science) “Error detection and correction in
number-theoretic algorithms”, UW, 20
• Current Position:• Lecturer, David R. Cheriton School of Computer Science• Associate Director, Centre for Education in Mathematics and
Computing
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Short biography of the speaker
• Academic life• teach (mostly) first- and second-year CS courses (CS 115, 116,
135, 241)• coordinate the Canadian Computing Competition (organize
problem creation, publication of results, communication withteachers, select Stage 2 invitees, train and supervise theCanadian IOI team)
• do lots of school visits (elementary and secondary schools inOntario, Malaysia, Singapore, China, Hong Kong)
• reviewer and grader for other math competitions (Euclid,CIMC/CSMC)
• sit on or chair various CS committees (UndergraduateRecruiting, Outreach, Scholarship committees)
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Short biography of the speaker
• Non-academic life• bicycle to work every day (yes, every day)• enjoy working out at the gym regularly• enjoy travel (through work and outside of work)• love playing Uno, Sleeping Queens, and Clue and reading with
daughter Natalie• love dinner and movies with lovely wife Krista• enjoy hanging out with neighbourhood friends
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursion
• Definition: see Recursion
• Real Definition:
Defining a function/structure using thefunction/structure itself in the definition
• To repeat something, you must recurse
• A better definition of recursion:
if you don’t understandrecursion, see recursion.
• Notice that recursion requires a base case as well as recursivecases.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursion
• Definition: see Recursion
• Real Definition:
Defining a function/structure using thefunction/structure itself in the definition
• To repeat something, you must recurse
• A better definition of recursion: if you don’t understandrecursion, see recursion.
• Notice that recursion requires a base case as well as recursivecases.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Natural Recursion
Why is recursion good?
• Easier to determine what the function does
• A natural way of seeing the world
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursion Examples: Babushka Dolls
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursion Examples: Shells
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursion Examples: The spiral of life
• I was created by my parents• My parents were created by their parents
• My grandparents were created by their parents• ....
• Base case?
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursive space filling: M. C. Escher
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recursive space filling: M. C. Escher
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Recurrence relations in sequencesA sequence a0, a1, a2, ... can be specified recursively by giving
• base cases (aka “initial conditions”)
• a recursive definition
For example, we could have:
a0 = 0
a1 = 5
as the base cases and
an = 2an−1 − an−2
We would like to solve this: that is, find a closed form (ideally, anumber or formula depending on n) for an.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 =
0
a1 = 5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 =
5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 =
2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 = 2(5)− 0 = 10
a3 =
2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 =
2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 =
2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
“Guess” and checkWrite out the first few terms, and try to find a pattern.
a0 = 0
a1 = 5
a2 = 2(5)− 0 = 10
a3 = 2(10)− 5 = 15
a4 = 2(15)− 10 = 20
a5 = 2(20)− 15 = 25
It looks like the closed form for this recurrence is:
an = 5n
But we would like to prove it!WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis
• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction
• there is a variant known as weak induction where we assumethe result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1
• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Mathematical InductionMathematical induction is the mirror image of recursion.
When we try to prove a result using induction, we need to do threethings:
1. show the result holds for the base case(s): this is usually, butnot always, easy
2. assume the result holds for all values ≤ k for some k which isat least as big as the base case(s)
• this step is known as the inductive hypothesis• when we make this hypothesis, we are using strong induction• there is a variant known as weak induction where we assume
the result holds only for one particular value of k
3. show the result holds for k + 1• this step is called the inductive step
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0.
If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.
Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.
Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.
We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.
We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5
= 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Our first inductive proofProve: If a0 = 0, a1 = 5 and an = 2an−1 − an−2, then an = 5n forall n ≥ 0.
Proof: By (strong) mathematical induction.If n = 0, then 5n = 0 = a0. If n = 1, then 5n = 5 = a1.Thus, the result holds for the base cases.Assume that for all values of n such that n ≤ k , the result holds.That is, for any n ≤ k , we know that an = 5n.We now prove the result for n = k + 1.We need to show that ak+1 = 5(k + 1). But, we know that
ak+1 = 2ak − ak−1
= 2(5k)− 5(k − 1)
= 10k − 5k + 5
= 5k + 5 = 5(k + 1)
which proves the result.WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Exercise
Suppose you have:
a0 = 1
an = 2an−1 + 1
(This is sometimes known as the Tower of Hanoi recurrence).Find a closed form, and prove that it is correct using mathematicalinduction.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 =
2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 =
2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 =
2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 =
2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Start with some values:
a0 = 1
a1 = 2(1) + 1 = 3
a2 = 2(3) + 1 = 7
a3 = 2(7) + 1 = 15
a4 = 2(15) + 1 = 31
We conjecture that an = 2n+1 − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.
We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Proof of closed formWe only have one base case:
a0 = 1 = 2(0+1) − 1
Assume that for all n ≤ k (k ≥ 0), we have an = 2n+1 − 1.We need to show that the result holds when n = k + 1.
ak+1 = 2ak + 1
= 2(2k+1 − 1) + 1
= 2k+2 − 2 + 1
= 2k+2 − 1
which proves the result.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Formalizing a formula
Guessing a closed form seems like a not very extendible idea, evenfor very “simple” things like:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
A recurrence is called linear if each term of a sequence defined bythe recurrence is linear function (i.e., only multiplied by a constantor has a constant added) of earlier terms in the sequence.So, something like qn = (qn−1)2 + 4 is not a linear recurrence, butall the other recurrences we have seen so far are linear.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Formalizing a formula
Guessing a closed form seems like a not very extendible idea, evenfor very “simple” things like:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
A recurrence is called linear if each term of a sequence defined bythe recurrence is linear function (i.e., only multiplied by a constantor has a constant added) of earlier terms in the sequence.So, something like qn = (qn−1)2 + 4 is not a linear recurrence, butall the other recurrences we have seen so far are linear.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Formalizing a formula
Guessing a closed form seems like a not very extendible idea, evenfor very “simple” things like:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
A recurrence is called linear if each term of a sequence defined bythe recurrence is linear function (i.e., only multiplied by a constantor has a constant added) of earlier terms in the sequence.
So, something like qn = (qn−1)2 + 4 is not a linear recurrence, butall the other recurrences we have seen so far are linear.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Formalizing a formula
Guessing a closed form seems like a not very extendible idea, evenfor very “simple” things like:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
A recurrence is called linear if each term of a sequence defined bythe recurrence is linear function (i.e., only multiplied by a constantor has a constant added) of earlier terms in the sequence.So, something like qn = (qn−1)2 + 4 is not a linear recurrence, butall the other recurrences we have seen so far are linear.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
More formalism
A linear homogeneous recurrence relation of degree k is a relationof the form
an = c1an−1 + c2an−2 + . . .+ ckan−k
where each ci is a real number and ck 6= 0.
Such a recurrence must include k initial conditions:
a0 = V0 a1 = V1 . . . ak = Vk
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
More formalism
A linear homogeneous recurrence relation of degree k is a relationof the form
an = c1an−1 + c2an−2 + . . .+ ckan−k
where each ci is a real number and ck 6= 0.Such a recurrence must include k initial conditions:
a0 = V0 a1 = V1 . . . ak = Vk
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .
That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Characteristic equationLet’s suppose that the closed form to a recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
looks likean = rn
for some constant r .That would mean:
rn = c1rn−1 + c2rn−2 + · · ·+ ck rn−k
which we could rewrite as:
rn − c1rn−1 − c2rn−2 − · · · − ck rn−k = 0
and then we could divide both sides by rn−k to get:
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
This is the characteristic equation of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A helpful theorem
Suppose we have the characteristic equation
rk − c1rk−1 − c2rk−2 − · · · − ck = 0
for the recurrence
an = c1an−1 + c2an−2 + · · ·+ ckan−k
and there are solutions r1, r2, . . . rm to the characteristic equation.Then, an = α1rn1 + α2rn2 + · · ·+ αmrnm satisfies the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using this theoremRecall the Fibonacci recurrence:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
The characteristic equation is:
r2 − r − 1 = 0.
Using the quadratic formula we get:
r =1±
√(−1)2 − 4(1)(−1)
2
=1±√
5
2
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using this theoremRecall the Fibonacci recurrence:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
The characteristic equation is:
r2 − r − 1 = 0.
Using the quadratic formula we get:
r =1±
√(−1)2 − 4(1)(−1)
2
=1±√
5
2
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using this theoremRecall the Fibonacci recurrence:
f0 = 0
f1 = 1
fn = fn−1 + fn−2
The characteristic equation is:
r2 − r − 1 = 0.
Using the quadratic formula we get:
r =1±
√(−1)2 − 4(1)(−1)
2
=1±√
5
2
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solving the Fibonacci recurrence
Thus, we know that
fn = α1
(1 +√
5
2
)n
+ α2
(1−√
5
2
)n
What to do next?Notice that we haven’t used our initial conditions: those will helpus solve for α1 and α2.
f0 = α1 + α2 = 0
which means that α2 = −α1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solving the Fibonacci recurrence
Thus, we know that
fn = α1
(1 +√
5
2
)n
+ α2
(1−√
5
2
)n
What to do next?
Notice that we haven’t used our initial conditions: those will helpus solve for α1 and α2.
f0 = α1 + α2 = 0
which means that α2 = −α1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solving the Fibonacci recurrence
Thus, we know that
fn = α1
(1 +√
5
2
)n
+ α2
(1−√
5
2
)n
What to do next?Notice that we haven’t used our initial conditions: those will helpus solve for α1 and α2.
f0 = α1 + α2 = 0
which means that α2 = −α1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solving the Fibonacci recurrence
Thus, we know that
fn = α1
(1 +√
5
2
)n
+ α2
(1−√
5
2
)n
What to do next?Notice that we haven’t used our initial conditions: those will helpus solve for α1 and α2.
f0 = α1 + α2 = 0
which means that α2 = −α1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using the second base caseWe know:
f1 = α1
(1 +√
5
2
)+ α2
(1−√
5
2
)= 1
but we also know that α2 = −α1 from the previous page.
So, we have
α1
(1 +√
5
2
)− α1
(1−√
5
2
)= 1
which implies
α1
(1 +√
5
2− 1−
√5
2
)= 1
and so α(2√5
2
)= 1, which implies α1 = 1√
5.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using the second base caseWe know:
f1 = α1
(1 +√
5
2
)+ α2
(1−√
5
2
)= 1
but we also know that α2 = −α1 from the previous page.So, we have
α1
(1 +√
5
2
)− α1
(1−√
5
2
)= 1
which implies
α1
(1 +√
5
2− 1−
√5
2
)= 1
and so α(2√5
2
)= 1, which implies α1 = 1√
5.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using the second base caseWe know:
f1 = α1
(1 +√
5
2
)+ α2
(1−√
5
2
)= 1
but we also know that α2 = −α1 from the previous page.So, we have
α1
(1 +√
5
2
)− α1
(1−√
5
2
)= 1
which implies
α1
(1 +√
5
2− 1−
√5
2
)= 1
and so α(2√5
2
)= 1, which implies α1 = 1√
5.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using the second base caseWe know:
f1 = α1
(1 +√
5
2
)+ α2
(1−√
5
2
)= 1
but we also know that α2 = −α1 from the previous page.So, we have
α1
(1 +√
5
2
)− α1
(1−√
5
2
)= 1
which implies
α1
(1 +√
5
2− 1−
√5
2
)= 1
and so α(2√5
2
)= 1, which implies α1 = 1√
5.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using the second base caseWe know:
f1 = α1
(1 +√
5
2
)+ α2
(1−√
5
2
)= 1
but we also know that α2 = −α1 from the previous page.So, we have
α1
(1 +√
5
2
)− α1
(1−√
5
2
)= 1
which implies
α1
(1 +√
5
2− 1−
√5
2
)= 1
and so α(2√5
2
)= 1, which implies α1 = 1√
5.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Solution
Thus, the Fibonacci sequence has closed form:
fn =1√5
(1 +√
5
2
)n
− 1√5
(1−√
5
2
)n
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Golden ratio
Notice that if we have a and b satisfying:
a + b
b=
a
b
then ab = ϕ, where
ϕ =1 +√
5
2.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Golden ratio
Notice that if we have a and b satisfying:
a + b
b=
a
b
then ab = ϕ, where
ϕ =1 +√
5
2.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.
The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get
(r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.
Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.
Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!
Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:
If there is a root ri with multiplicity m + 1 (i.e., (r − ri )m+1 is a
factor), thenrni , nrni , . . . n
mrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Theorem isn’t exact enough yetRecall:an = 2an−1 + an−2 with a0 = 0 and a1 = 5.The characteristic polynomial is:
r2 − 2r − 1 = 0
which you can solve by factoring to get (r − 1)2 = 0.Thus, r = 1 is a solution.Problem: an = α1(1)n + α2(1)n for FIXED α1 and α2 has nosolution!Fortunately, we can augment our theorem:If there is a root ri with multiplicity m + 1 (i.e., (r − ri )
m+1 is afactor), then
rni , nrni , . . . nmrni
are all solutions of the recurrence.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using this updated theorem
Since (r − 1)2 = r2 − 2r − 1, in our recurrence, r = 1 hasmultiplicity 2.
Thus, we know that
an = α101n + α11n1n
which meansan = α10 + α11n
and we know a0 = 0, so α10 = 0.Also, we know a1 = 5 and so 5 = α11.Thus, an = 5n, as we proved earlier.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using this updated theorem
Since (r − 1)2 = r2 − 2r − 1, in our recurrence, r = 1 hasmultiplicity 2.Thus, we know that
an = α101n + α11n1n
which meansan = α10 + α11n
and we know a0 = 0, so α10 = 0.
Also, we know a1 = 5 and so 5 = α11.Thus, an = 5n, as we proved earlier.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
Using this updated theorem
Since (r − 1)2 = r2 − 2r − 1, in our recurrence, r = 1 hasmultiplicity 2.Thus, we know that
an = α101n + α11n1n
which meansan = α10 + α11n
and we know a0 = 0, so α10 = 0.Also, we know a1 = 5 and so 5 = α11.Thus, an = 5n, as we proved earlier.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1.
But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!
Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.
For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is
r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.
The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c.
Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we get
c = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1,
and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING
A few words on non-homogeneous linear recurrencesWe have seen an = 2an−1 + 1 with (a0 = 1) has closed forman = 2n+1 − 1. But, this is non-homogeneous!Trick: Solve the homogeneous equation, hn, and then try to figureout what the additional term is, in terms of n, as bn, thenan = hn + bn.For this recurrence, hn = 2hn−1 is easily seen to be hn = 2n sincethe characteristic equation is r = 2.The constant term is 1 in an, so we guess that bn = c for someconstant c. Therefore,
bn = 2bn−1 + 1
and if bn = c , we getc = 2c + 1
which gives c = −1, and thus (after verifying) our recurrence isan = 2n − 1.
WWW.CEMC.UWATERLOO.CA | The CENTRE for EDUCATION in MATHEMATICS and COMPUTING