Recursive Sequences - Black Hills State University

Finding recurrence relations
Solving recurrence relations
Recursive Sequences
Dan Swenson, Black Hills State University
February 2012
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Outline
Finding recurrence relations
The elf problem
Regions in the plane
Solving recurrence relations
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep, then 2
stairs again on his second footstep,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep, then 2
stairs again on his second footstep, then 1 stair on his third
footstep, and then he’d be at the top.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep, then 2
stairs again on his second footstep, then 1 stair on his third
footstep, and then he’d be at the top. That would be one way to
climb the stairs.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep, then 2
stairs again on his second footstep, then 1 stair on his third
footstep, and then he’d be at the top. That would be one way to
climb the stairs.
Or, he could climb 1 stair, then 2 stairs, then 1 stair, then 1 stair–
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep, then 2
stairs again on his second footstep, then 1 stair on his third
footstep, and then he’d be at the top. That would be one way to
climb the stairs.
Or, he could climb 1 stair, then 2 stairs, then 1 stair, then 1 stair–
that would be another way.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
An elf is climbing a staircase. With each footstep, he can climb
either 1 stair or 2 stairs.
Question: if there are 5 stairs total, in how many ways can he
climb the stairs?
For example, he could climb 2 stairs on his first footstep, then 2
stairs again on his second footstep, then 1 stair on his third
footstep, and then he’d be at the top. That would be one way to
climb the stairs.
Or, he could climb 1 stair, then 2 stairs, then 1 stair, then 1 stair–
that would be another way.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2),
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
What if there were 4 stairs?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
What if there were 4 stairs?
3 stairs?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
What if there were 4 stairs?
3 stairs?
Dan Swenson, Black Hills State University
6 stairs?
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
What if there were 4 stairs?
3 stairs?
6 stairs?
50 stairs?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
What if there were 4 stairs?
3 stairs?
50 stairs?
Dan Swenson, Black Hills State University
6 stairs?
OH NO!
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Answer: 8 ways:
(2, 2, 1), (2, 1, 2), (2, 1, 1, 1), (1, 2, 2), (1, 2, 1, 1),
(1, 1, 2, 1), (1, 1, 1, 2), (1, 1, 1, 1, 1).
Whew!
What if there were 4 stairs?
3 stairs?
50 stairs?
6 stairs?
OH NO!
We might need a better method of counting than just writing
down all the solutions, or we’re going to be here awhile!
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Before we go further, let’s set up some notation:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Before we go further, let’s set up some notation: Rather than
saying “the number of ways to climb n stairs” over and over, let’s
just call this number an .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Before we go further, let’s set up some notation: Rather than
saying “the number of ways to climb n stairs” over and over, let’s
just call this number an .
So a5 = the number of ways to climb 5 stairs,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Before we go further, let’s set up some notation: Rather than
saying “the number of ways to climb n stairs” over and over, let’s
just call this number an .
So a5 = the number of ways to climb 5 stairs,
a8 = the number of ways to climb 8 stairs, etc.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following: How will the
elf finish his climb?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following: How will the
elf finish his climb?
He can finish with either a 1 or a 2.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following: How will the
elf finish his climb?
He can finish with either a 1 or a 2.
What if we try to split up the counting:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following: How will the
elf finish his climb?
He can finish with either a 1 or a 2.
What if we try to split up the counting:
First we try to count the climbs where he ends with a 1. Then we
count the climbs where he ends with a 2.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following: How will the
elf finish his climb?
He can finish with either a 1 or a 2.
What if we try to split up the counting:
First we try to count the climbs where he ends with a 1. Then we
count the climbs where he ends with a 2.
These cases account for all possible climbs, so we won’t miss any
by counting this way.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Problem: Find an = the number of ways for the elf to climb a
staircase with n stairs.
One way to think about this problem is the following: How will the
elf finish his climb?
He can finish with either a 1 or a 2.
What if we try to split up the counting:
First we try to count the climbs where he ends with a 1. Then we
count the climbs where he ends with a 2.
These cases account for all possible climbs, so we won’t miss any
by counting this way.
And, there isn’t any overlap between these two cases, so we won’t
count any climb twice.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1. So it’s equal to the
number of ways to climb 5 stairs,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1. So it’s equal to the
number of ways to climb 5 stairs, which we called a5 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1. So it’s equal to the
number of ways to climb 5 stairs, which we called a5 .
Similarly, the number of ways to climb 6 stairs, ending with a 2,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1. So it’s equal to the
number of ways to climb 5 stairs, which we called a5 .
Similarly, the number of ways to climb 6 stairs, ending with a 2, is
the same as the number of ways to climb 6 − 2 = 4 stairs:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1. So it’s equal to the
number of ways to climb 5 stairs, which we called a5 .
Similarly, the number of ways to climb 6 stairs, ending with a 2, is
the same as the number of ways to climb 6 − 2 = 4 stairs: you
need to climb 4 stairs, and then make a 2-stair step.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
For example, suppose we want to find a6 , the number of ways to
climb 6 stairs. We split it up as:
(number of ways to climb 6 stairs, ending with a 1)
+ (number of ways to climb 6 stairs, ending with a 2).
Now, what is the number of ways to climb 6 stairs, ending with a
1? Well, to climb 6 stairs ending with a 1 means you have to climb
5 stairs in some way, then follow that with a 1. So it’s equal to the
number of ways to climb 5 stairs, which we called a5 .
Similarly, the number of ways to climb 6 stairs, ending with a 2, is
the same as the number of ways to climb 6 − 2 = 4 stairs: you
need to climb 4 stairs, and then make a 2-stair step. So there are
a4 ways to do this.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
The important equation
Therefore
a6 = a5 + a4 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
The important equation
Therefore
a6 = a5 + a4 .
That was for the case where n = 6. In general,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
The important equation
Therefore
a6 = a5 + a4 .
That was for the case where n = 6. In general,
an = an−1 + an−2 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
The important equation
Therefore
a6 = a5 + a4 .
That was for the case where n = 6. In general,
an = an−1 + an−2 .
The red equation is called a recurrence relation.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 =
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 =
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 =
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3 = 8.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3 = 8.
a6 =
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3 = 8.
a6 = a5 + a4
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3 = 8.
a6 = a5 + a4 = 8 + 5
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3 = 8.
a6 = a5 + a4 = 8 + 5 = 13.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Let’s use the recurrence relation to calculate an for n = 1 through
n = 6:
a1 = 1,
a2 = 2.
a3 = a2 + a1 = 2 + 1 = 3.
a4 = a3 + a2 = 3 + 2 = 5.
a5 = a4 + a3 = 5 + 3 = 8.
a6 = a5 + a4 = 8 + 5 = 13.
So we’re getting the Fibonacci sequence! (What would a0 be?)
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
A new question: Suppose you take a piece of paper and draw 4
lines, so that every line intersects every other line (but no 3 lines
intersect at a common point). Into how many regions have you
divided the paper?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
A new question: Suppose you take a piece of paper and draw 4
lines, so that every line intersects every other line (but no 3 lines
intersect at a common point). Into how many regions have you
divided the paper?
Naturally, it would be better if we had a way of solving the
problem for a general number of lines instead of just 4:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
A new question: Suppose you take a piece of paper and draw 4
lines, so that every line intersects every other line (but no 3 lines
intersect at a common point). Into how many regions have you
divided the paper?
Naturally, it would be better if we had a way of solving the
problem for a general number of lines instead of just 4: that way
we won’t have to redo the whole problem if someone comes along
and changes the 4 to a 7 or something.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
A new question: Suppose you take a piece of paper and draw 4
lines, so that every line intersects every other line (but no 3 lines
intersect at a common point). Into how many regions have you
divided the paper?
Naturally, it would be better if we had a way of solving the
problem for a general number of lines instead of just 4: that way
we won’t have to redo the whole problem if someone comes along
and changes the 4 to a 7 or something.
Let’s try to find a recurrence relation for bn = the number of
regions made by n lines (all intersecting, no 3 lines meeting at a
common point).
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Now suppose we’ve got 2 intersecting lines drawn and we draw a
third.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Now suppose we’ve got 2 intersecting lines drawn and we draw a
third.
According to the problem, we’re supposed to draw it so that it
intersects each of the other 2 lines (but not at the point where the
first two lines intersect).
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Now suppose we’ve got 2 intersecting lines drawn and we draw a
third.
According to the problem, we’re supposed to draw it so that it
intersects each of the other 2 lines (but not at the point where the
first two lines intersect).
What happens to our 4 regions when we draw the third line?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Now suppose we’ve got 2 intersecting lines drawn and we draw a
third.
According to the problem, we’re supposed to draw it so that it
intersects each of the other 2 lines (but not at the point where the
first two lines intersect).
What happens to our 4 regions when we draw the third line?
Clearly, it splits some of the regions into 2,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Now suppose we’ve got 2 intersecting lines drawn and we draw a
third.
According to the problem, we’re supposed to draw it so that it
intersects each of the other 2 lines (but not at the point where the
first two lines intersect).
What happens to our 4 regions when we draw the third line?
Clearly, it splits some of the regions into 2, increasing the number
of regions on the page.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We know what happens if n = 1: drawing 1 line divides the page
into 2 regions. Similarly, drawing 2 lines divides the paper into 4
regions. So, b1 = 2 and b2 = 4.
Now suppose we’ve got 2 intersecting lines drawn and we draw a
third.
According to the problem, we’re supposed to draw it so that it
intersects each of the other 2 lines (but not at the point where the
first two lines intersect).
What happens to our 4 regions when we draw the third line?
Clearly, it splits some of the regions into 2, increasing the number
of regions on the page. But how many regions get split?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
When we draw the third line, we go for a while before intersecting
anything. During this time, we’re splitting one region into 2.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
When we draw the third line, we go for a while before intersecting
anything. During this time, we’re splitting one region into 2.
Then after we intersect the first line, for a while we’re between
intersections. During this time we’re splitting another region.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
When we draw the third line, we go for a while before intersecting
anything. During this time, we’re splitting one region into 2.
Then after we intersect the first line, for a while we’re between
intersections. During this time we’re splitting another region.
Finally, after the last intersection, we split one more region.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
When we draw the third line, we go for a while before intersecting
anything. During this time, we’re splitting one region into 2.
Then after we intersect the first line, for a while we’re between
intersections. During this time we’re splitting another region.
Finally, after the last intersection, we split one more region.
Before, between and after: we split 3 different regions,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
When we draw the third line, we go for a while before intersecting
anything. During this time, we’re splitting one region into 2.
Then after we intersect the first line, for a while we’re between
intersections. During this time we’re splitting another region.
Finally, after the last intersection, we split one more region.
Before, between and after: we split 3 different regions, increasing
the number of regions by a total of 3.
Thus b3 = b2 + 3
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
When we draw the third line, we go for a while before intersecting
anything. During this time, we’re splitting one region into 2.
Then after we intersect the first line, for a while we’re between
intersections. During this time we’re splitting another region.
Finally, after the last intersection, we split one more region.
Before, between and after: we split 3 different regions, increasing
the number of regions by a total of 3.
Thus b3 = b2 + 3 = 4 + 3 = 7.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions, and splits each region it goes
through.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions, and splits each region it goes
through.
So b4 = b3 + 4
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions, and splits each region it goes
through.
So b4 = b3 + 4 = 7 + 4 = 11.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions, and splits each region it goes
through.
So b4 = b3 + 4 = 7 + 4 = 11.
In general, the nth line will pass through and split n regions,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions, and splits each region it goes
through.
So b4 = b3 + 4 = 7 + 4 = 11.
In general, the nth line will pass through and split n regions, so we
have the recurrence relation bn = bn−1 + n.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
Now let’s add a fourth line in. This line will go for a while without
hitting anything, splitting one region. Then it will cross its first
line, then its second line, then its third line, then it will go off into
the distance.
Before, between, between, after. We see that it crosses three lines,
meaning it goes through 4 regions, and splits each region it goes
through.
So b4 = b3 + 4 = 7 + 4 = 11.
In general, the nth line will pass through and split n regions, so we
have the recurrence relation bn = bn−1 + n.
Question: what should b0 be? Would that fit with our recurrence
relation and the values we’ve found so far?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
b1 = 2, b2 = 4, b3 = 7, b4 = 11,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
b1 = 2, b2 = 4, b3 = 7, b4 = 11,
b5 = b4 + 5
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
b1 = 2, b2 = 4, b3 = 7, b4 = 11,
b5 = b4 + 5 = 11 + 5
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
b1 = 2, b2 = 4, b3 = 7, b4 = 11,
b5 = b4 + 5 = 11 + 5 = 16,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
b1 = 2, b2 = 4, b3 = 7, b4 = 11,
b5 = b4 + 5 = 11 + 5 = 16,
b6 = b5 + 6 = 16 + 6 = 22,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
The elf problem
Regions in the plane
We have our recurrence relation bn = bn−1 + n, and our initial
value b0 = 1.
With this information, it’s no big deal to figure out how many
regions we get with 5, 6, 7, or more lines:
b1 = 2, b2 = 4, b3 = 7, b4 = 11,
b5 = b4 + 5 = 11 + 5 = 16,
b6 = b5 + 6 = 16 + 6 = 22,
b7 = b6 + 7 = 22 + 7 = 29, etc.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane. The recurrence relation
says b100 = b99 + 100,
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane. The recurrence relation
says b100 = b99 + 100, so we have to know b99 before we can find
b100 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane. The recurrence relation
says b100 = b99 + 100, so we have to know b99 before we can find
b100 . But then we need to know b98 before we can find b99 , and so
forth.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane. The recurrence relation
says b100 = b99 + 100, so we have to know b99 before we can find
b100 . But then we need to know b98 before we can find b99 , and so
forth. So we would need to go through the first 99 terms
one-by-one before we could get to b100 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane. The recurrence relation
says b100 = b99 + 100, so we have to know b99 before we can find
b100 . But then we need to know b98 before we can find b99 , and so
forth. So we would need to go through the first 99 terms
one-by-one before we could get to b100 .
Isn’t there an easier way?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
Recurrence relations are nice, but they have their limits.
For example, what if someone wanted to know how many regions
you get if you draw 100 lines in the plane. The recurrence relation
says b100 = b99 + 100, so we have to know b99 before we can find
b100 . But then we need to know b98 before we can find b99 , and so
forth. So we would need to go through the first 99 terms
one-by-one before we could get to b100 .
Isn’t there an easier way?
We want to solve the recurrence relation: this means finding a
formula for bn that doesn’t depend on the previous terms of the
sequence.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
b0 = 1
b1 = b0 + 1 = 1 + 1
b2 = b1 + 2 = (1 + 1) + 2
b3 = b2 + 3 = (1 + 1 + 2) + 3
b4 = b3 + 4 = (1 + 1 + 2 + 3) + 4
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
b0 = 1
b1 = b0 + 1 = 1 + 1
b2 = b1 + 2 = (1 + 1) + 2
b3 = b2 + 3 = (1 + 1 + 2) + 3
b4 = b3 + 4 = (1 + 1 + 2 + 3) + 4
So in general
bn = 1 + (1 + 2 + . . . + n)
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
b0 = 1
b1 = b0 + 1 = 1 + 1
b2 = b1 + 2 = (1 + 1) + 2
b3 = b2 + 3 = (1 + 1 + 2) + 3
b4 = b3 + 4 = (1 + 1 + 2 + 3) + 4
So in general
bn = 1 + (1 + 2 + . . . + n)
(n + 1)n
=1+
2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
b0 = 1
b1 = b0 + 1 = 1 + 1
b2 = b1 + 2 = (1 + 1) + 2
b3 = b2 + 3 = (1 + 1 + 2) + 3
b4 = b3 + 4 = (1 + 1 + 2 + 3) + 4
So in general
bn = 1 + (1 + 2 + . . . + n)
(n + 1)n
=1+
2
In particular, b100 = 1 +
(101)100
2
Dan Swenson, Black Hills State University
= 5051.
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
What about the elf problem? Can we solve the recurrence relation
an = an−1 + an−2 , with a0 = a1 = 1?
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
What about the elf problem? Can we solve the recurrence relation
an = an−1 + an−2 , with a0 = a1 = 1?
Here we make a complete guess: we guess that an = αn for some
constant α.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
What about the elf problem? Can we solve the recurrence relation
an = an−1 + an−2 , with a0 = a1 = 1?
Here we make a complete guess: we guess that an = αn for some
constant α.
Then
αn = αn−1 + αn−2
Dividing both sides by αn−2 gives
α2 = α + 1,
or α2 − α − 1 = 0.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
What about the elf problem? Can we solve the recurrence relation
an = an−1 + an−2 , with a0 = a1 = 1?
Here we make a complete guess: we guess that an = αn for some
constant α.
Then
αn = αn−1 + αn−2
Dividing both sides by αn−2 gives
α2 = α + 1,
or α2 − α − 1 = 0. We can solve this equation for α by using the
Quadratic Formula; we get
√
1± 5
α=
.
2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
So there are two α’s which might satisfy the recurrence relation.
To solve the recurrence relation, we revise our guess to include
both values:
1 + √ 5 n 1 − √ 5 n
+
.
an =
2
2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
So there are two α’s which might satisfy the recurrence relation.
To solve the recurrence relation, we revise our guess to include
both values:
1 + √ 5 n 1 − √ 5 n
+
.
an =
2
2
But this is not correct: for instance it says that
1 + √ 5 0 1 − √ 5 0
a0 =
+
= 1 + 1 = 2,
2
2
but we know a0 = 1, not 2.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
So there are two α’s which might satisfy the recurrence relation.
To solve the recurrence relation, we revise our guess to include
both values:
1 + √ 5 n 1 − √ 5 n
+
.
an =
2
2
But this is not correct: for instance it says that
1 + √ 5 0 1 − √ 5 0
a0 =
+
= 1 + 1 = 2,
2
2
but we know a0 = 1, not 2.
We revise our guess once more:
1 + √ 5 n
1 − √ 5 n
an = C1
+ C2
2
2
for some constants C1 and C2 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
So there are two α’s which might satisfy the recurrence relation.
To solve the recurrence relation, we revise our guess to include
both values:
1 + √ 5 n 1 − √ 5 n
+
.
an =
2
2
But this is not correct: for instance it says that
1 + √ 5 0 1 − √ 5 0
a0 =
+
= 1 + 1 = 2,
2
2
but we know a0 = 1, not 2.
We revise our guess once more:
1 + √ 5 n
1 − √ 5 n
an = C1
+ C2
2
2
for some constants C1 and C2 . Then we just need to solve for
those constants C1 and C2 .
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
To solve for C1 and C2 , we plug in two values of an that we know.
Let’s use the initial values a0 = a1 = 1:
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
To solve for C1 and C2 , we plug in two values of an that we know.
Let’s use the initial values a0 = a1 = 1:
1 + √ 5 0
1 − √5 0
1 = a0 = C1
+ C2
2
2
√
1 − √5 1
1 + 5 1
+ C2
1 = a1 = C1
2
2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
To solve for C1 and C2 , we plug in two values of an that we know.
Let’s use the initial values a0 = a1 = 1:
1 + √ 5 0
1 − √5 0
1 = a0 = C1
+ C2
2
2
√
1 − √5 1
1 + 5 1
+ C2
1 = a1 = C1
2
2
Since any number to the 0th power equals 1, this simplifies to
1 = C1 + C2
1 + √5 1 − √5 1=
C1 +
C2
2
2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
To solve for C1 and C2 , we plug in two values of an that we know.
Let’s use the initial values a0 = a1 = 1:
1 + √ 5 0
1 − √5 0
1 = a0 = C1
+ C2
2
2
√
1 − √5 1
1 + 5 1
+ C2
1 = a1 = C1
2
2
Since any number to the 0th power equals 1, this simplifies to
1 = C1 + C2
1 + √5 1 − √5 1=
C1 +
C2
2
2
This is just a system of two linear equations with two variables, C1
and C2 , so we should be able to solve it.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
It’s not much fun to solve this system of equations, but we can do
it. We get
5 + √5 5 − √5 C1 =
, C2 =
.
10
10
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
It’s not much fun to solve this system of equations, but we can do
it. We get
5 + √5 5 − √5 C1 =
, C2 =
.
10
10
So the final solution is
5 + √5 1 + √5 n 5 − √5 1 − √5 n
an =
+
.
10
2
10
2
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
It’s not much fun to solve this system of equations, but we can do
it. We get
5 + √5 5 − √5 C1 =
, C2 =
.
10
10
So the final solution is
5 + √5 1 + √5 n 5 − √5 1 − √5 n
an =
+
.
10
2
10
2
We test a few values in this formula, and we get
a0 = 1, a1 = 1, a2 = 2, a3 = 3, a4 = 5, a5 = 8, a6 = 13.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
It’s not much fun to solve this system of equations, but we can do
it. We get
5 + √5 5 − √5 C1 =
, C2 =
.
10
10
So the final solution is
5 + √5 1 + √5 n 5 − √5 1 − √5 n
an =
+
.
10
2
10
2
We test a few values in this formula, and we get
a0 = 1, a1 = 1, a2 = 2, a3 = 3, a4 = 5, a5 = 8, a6 = 13.
It’s a little remarkable that this formula actually gives integer
values at all, let alone the right values!
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
We can use this method to solve any recurrence relation where an
is written as a sum or difference of the previous terms:
an = cn−1 an−1 + cn−2 an−2 + . . . + cn−r an−r
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
We can use this method to solve any recurrence relation where an
is written as a sum or difference of the previous terms:
an = cn−1 an−1 + cn−2 an−2 + . . . + cn−r an−r
Guess an = αn and solve for α. This may give several different
values of α.
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
We can use this method to solve any recurrence relation where an
is written as a sum or difference of the previous terms:
an = cn−1 an−1 + cn−2 an−2 + . . . + cn−r an−r
Guess an = αn and solve for α. This may give several different
values of α. Then revise your guess to include all the different
values of α that you found:
an = C1 (α1 )n + C2 (α2 )n + . . . + Cr (αr )n
Dan Swenson, Black Hills State University
Recursive Sequences
Finding recurrence relations
Solving recurrence relations
We can use this method to solve any recurrence relation where an
is written as a sum or difference of the previous terms:
an = cn−1 an−1 + cn−2 an−2 + . . . + cn−r an−r
Guess an = αn and solve for α. This may give several different
values of α. Then revise your guess to include all the different
values of α that you found:
an = C1 (α1 )n + C2 (α2 )n + . . . + Cr (αr )n
and use the initial values to solve for the constants Ci .
Dan Swenson, Black Hills State University
Recursive Sequences