De Chapter 3
De Chapter 3
De Chapter 3
(1) y1 = 1, y2 = -1
or equivalently
Then
y3 = 5y2 - 6y2 = 5(-1) - 6(1) = -11
(3) y4 = 5y3 - 6y2 = 5(-11) - 6(-1) = -49
y5 = 5y4 - 6y3 = 5(-40) - 6(-11) = -179
etc.
The conditions in (1) are called initial conditions (IC) and the equation in (2) is
called a recurrence relation (rr) or a difference equation (E).
Given a rr with IC, the sequence is determined and you can write as many
successive terms as you like. The aim of the topic is to find a formula for the nth
term yn. This process is called solving the rr. For example we will soon show that
the solution to the rr in (2) with the IC in (1) is yn = -3n + 22n.
For example,
3yn + yn-4 = 0
The rr
yn+10 = yn+5 - yn+4
can be rewritten as
yn+6 = yn+1 - yn
Until IC are specified, a rr has many solutions. A general solution to an nth order
rr is a solution containing n arbitrary constants (to ultimately be determined by n
IC).
example 1
Show that
yn = -3n2 - n - 2
Substitute the supposed solution into the lefthand side of the rr to see if it
works.
y y y
n+2 n+1 n
= 18n2 + 2
example 2
Let
Sn = 12 + 22 + 32 + ... + n2,
i.e, Sn is the sum of the first n squares. Suppose you want a formula for Sn.
You know that
Sn
so
The (nonhomog) rr in (6) together with the IC S1 = 1 determines Sn and later in the
chapter you''ll be able to solve the rr and find the formula for Sn
page 3 of Section 3.1
superposition rule
If un is a solution of ayn+2 + byn+1 + cyn = fn
f by hypothesis g by hypothesis
n n
Aun + Bvn
The superposition rule for the rr means that the response to a sum of inputs is
the sum of the separate responses and tripling an input for instance will triple the
response. Linear rr's corresponds to systems where physical superposition holds.
complex superposition
If
ayn+2 + byn+1 + cyn = fn + ign
has sol
un + ivn
In other words, the real part of the sol goes with the real part of the forcing
function and the imag part of the sol goes with the imag part of the forcing
function.
proof
Suppose un + ivn is a sol to ayn+2 + byn+1 + cyn = fn + ign Then
Collect terms:
The left side can't equal the right side unless the real parts are equal and the
imag parts are equal. So
So
un is a sol to ayn+2 + byn+1 + cyn = fn
and
vn is a sol to ayn+2 + byn+1 + cyn = gn QED
In other words, the real and imag parts of a complex homog sol are real homog
sols.
2. Write the recurrence relation for the sum Sn of the first n integers. In other
words, if Sn = 1 + 2 + 3 + ... + n, write a rr (plus IC) satisfied by Sn.
3. Find the order of the rr 6yn+7 - 2yn+5 + 3yn+4 = 0; i.e., how many IC do you
need to get started.
6. If un and vn are sols of 3yn+4 + 5yn+1 - 2yn = sin n then what are the
following sols of.
7. If un and vn are solutions to ayn+2 + byn+1 + cyn = 0, what are the following
solutions of. (a) un + vn (b) 6un (c) un - vn
or equivalently to solve
a2 + b + c = 0
The solution to the rr depends on the type of roots so there are cases.
n n
If = 1, 2 then yn = A 1 + B 2
n n
If = 1, 1 then yn = A 1 + Bn 1 (step up by n)
n n
If = a bi, then the gen complex solution is yn = A 1 + B 2.
To get the general real sol, find the mag r and angle of either
root, say of a + bi. Then a general real sol is
example 1
If = -2,5 then yn = A(-2)n + B 5n.
semiproof
To get solutions to ayn+2 + byn+1 + cyn = 0 try yn = n to see what values of ,
if any, make it work. We have
a2 + b + c = 0 (divide by n)
case 3 Suppose = 3 3i. Then as in the other cases, (3 + 3i)n and (3 - 3i)n
are (complex) sols and A(3 + 3i)n + B(3 - 3i)n is a gen (complex) solution. To get
real sols, use the complex superposition principle and take the real and imag parts
of the complex solutions (3 + 3i)n and (3 - 3i)n. First write the complex solutions
so that their real and imag parts are evident.
3 + 3i has mag 3 2 and angle
4
3 - 3i has mag 3 2 and angle -
4
n n
(3 - 3i)n = (3 2)n (cos - i sin )
4 4
n n
The real parts are both (3 2)n cos and the imag parts are (3 2)n sin .
4 4
This gives three real solutions but only two ''independent'' sols, namely
n n
(3 2)n cos and (3 2)n sin
4 4
n n
C (3 2)n cos + D (3 2)n sin QED
4 4
page 3 of Section 3.2
example 2
Find a general solution to yn+2 + 3yn+1 + 2yn = 0.
We have 2 + 3 + 2 = 0
( + 2)( + 1) = 0
= -2, -1
So
yn = A(-2n) + B(-1)n
example 3
Find a gen solution to yn+2 + 4yn = 0.
2 i
The characteristic equ is 2 + 4 = 0 so = 2i.
r=2 =/2
The number 2i has mag 2 and angle /2 (Fig 1) so
n n
yn = 2n (A cos + B sin ) FIG 1
2 2
warning
n n
1. If = 2i then the gen real homog sol is 2n (A cos + B sin ) WITHOUT an
2 2
i in it.
Don't confuse this with the fact that the polar form of (2i)n is
n n
2n(cos + i sin ) WITH an i.
2 2
2. If = -2 then the solution includes (-2)n. Don't mistakenly write this as -2n
which actually means -(2n).
3. The characteristic equ for yn+2 + 4yn = 0 is 2 + 4 = 0, not 2 + 4 = 0.
example 4
Find the general solution to a homog rr if = -1 i3
2
r =
1 + 3 = 2 and = arctan[-1, 3] = -1 + i 3
3
So
2n 2n
yn = 2n (A cos + B sin )
3 3 FIG 2
warning
3 which is - .
In example 4, is not arctan
-1 3
See arctan[x,y] versus arctan y/x in Section 1.3.
= 2, 3, -4
= 2, 2, 2, 2, 5
= 3i, 3i
The number 3i has r = 3, = so
2
n n n n
yn = 3n(A cos + B sin ) + n3n(C cos + D sin ) (step up by n)
2 2 2 2
We have
2 - 5 + 6 = 0, (-3)(-2) = 0, = 3,2
So a gen sol is
yn = A3n + B2n
1 = 3A + 2B
-1 = 9A + 4B
Solve the system of two equations in A and B to get A = -1 , B = 2. Then the final
sol is
yn = -3n + 22n
warning
If you are solving a homog differential equation and m = -2 2i then
If m = -2,-4 and it's a differential equation then y = Ae-2x + Be-4x but if it's a
recurrence relation then yn = A(-2)n + B(-4)n
Don't mix up the two types of problems
6. If the auxiliary equation of a homog linear rr with constant coeffs has the
following roots, find a general (real) solution.
(a) -3,4,4, - 3 i (b) 1, 2, 3, 2i, 2i
7. The Fibonacci sequence begins with y0 = 0, y1 = 1 and from then on each term is
the sum of the two preceding terms. Find a formula for yn.
8. Suppose a sequence begins with 2,5 and then each term is the average of the two
preceding terms.
(a) Find the fifth term by working your way out to it.
(b) Find a formula for the nth term.
(c) Find the fifth term again using the formula from part (b).
13. Solve by inspection and then solve again (overkill) with the methods of this
section.
14. Suppose y1 = 5, y2 = 7 and thereafter each term is the average of the two
surrounding terms.
(a) Write out some terms and see if you can find a formula for yn by guessing.
(b) Find a formula for yn by solving a rr.
page 1 of Section 3.3
Let hn be the general homog solution (i.e., the sol to ayn+2 + byn+1 + cyn = 0). This is
found with the method of the preceding section.
Let pn be any particular nonhomog sol (i.e., sol, with no constants, to the given
nonhomog rr). This section will show you how to do this.
Then
proof
hn + pn is a solution by superposition: hn produces 0 and pn produces fn so the
sum produces 0 + fn. Furthermore hn + pn is a general solution because it contains
the necessary arbitrary constants in the hn part.
I want to find a particular solution, denoted pn. There are several cases.
case 1 fn is a constant
Suppose fn = 6. Try pn = A
case 2 fn is a polynomial
Take the imag part if fn = 4 sin n. Take the real part if fn = 4 cos n
example 1
Find a general solution to yn+2 - 5yn+1 + 6yn = 4n.
hn = B 2n + C 3n
Then try
pn = A 4n
Substitute into the rr to see what value of A will make it work. You need
A 4n+2 - 5 A 4n+1 + 6A 4n = 4n
A 42 4n - 5A44n + 6A 4n = 4n
16A 4n - 20A 4n + 6A 4n = 4n
2A 4n = 4n
You need
1
2A = 1, A = 2 .
So
1
pn = 2 4n
example 2
Solve yn+2 - 5yn+1 + 6yn = n with IC y0 = 1, y1 = 2
2 - 5 + 6 = 0, = 2,3, hn = A 2n + B 3n
Now try
pn = Cn + D
Then
pn+1 = C(n+1) + D
pn+2 = C(n+2) + D
1 3
pn = 2 n + 4
Solve:
1
A = 0, B = 4
Final answer is
1 1 3
yn = 4 3n +
2
n + 4
warning
1.If the forcing function is n or 5n or -6n try pn = An + B, not just n. Similarly
if the forcing function is 3n2 or n2 + 3 or 9n2 + n, try pn = An2 + Bn + C, a
quadratic not missing any terms.
2. Determine the various constants at the appropriate stage. For a nonhomog rr with
IC, first find hn (containing constants) . Then find pn (the trial pn contains
constants but they must be immediately determined to get the genuine pn). The
general solution is yn = hn + pn (contains constants via the hn part). Use the IC to
determine the constants in the gen sol. Don't use the IC on hn alone in the middle of the
problem.
page 4 of Section 3.3
example 3
n
Solve yn+2 + 2yn+1 - 3yn = 10 sin with IC y0 = 2, y1 = 9
2
method 1 for pn
Switch to
1
2
ni
yn+2 + 2yn+1 - 3yn = 10 e
and try
1
2
ni
pn = D e
Take the imag part to get the particular sol for the original rr
1 1
pn = - cos 2 n - 2 sin 2 n
method 2 for pn
Try
n n
pn = A sin + B cos
2 2
1 1
A sin 2 (n+2) + B cos 2 (n+2) + 2 [ A sin (n+1) + B cos
1
2
1
2 ]
(n+1)
- 3
[ A sin 2
1
n + B cos n
] = 10 sin n
1
2
1
2
A
[ sin n2 cos + cos n2 sin ] + B[ cos n2 cos - sin n2 sin ]
-1 0 -1 0
+ 2A
[sin n2 cos 2 + cos n2 sin 2]
0 1
+ 2B
[cos n2 cos 2 - sin n2 sin 2]
0 1
n n
- 3A sin - 3B cos
2 2
1
= 10 sin 2 n
Collect terms:
n n 1
(2A - 4B) cos + (-4A - 2B) sin = 10 sin 2 n
2 2
n n
pn = -2 sin - cos
2 2
Finally
n n
yn = hn + pn = P(-3)n + Q - 2 sin - cos
2 2
So P = -2, Q = 5. Answer is
n n
yn = -2(-3)n + 5 -2 sin - cos
2 2
stepping up pn
Look at
ayn+2 + byn+1 + cyn = fn
There are some exceptions to the rules about what to try for pn
Suppose fn = 4 cos n (similarly for fn = 4 sin n).
case 4
3 3
If you're not using the complex exponential then ordinarily you would try
pn = A cos n + B sin n
3 3
If cos n and sin n are homog sols
3 3
footnote This happens if one of the 's is non-real with
1 1
mag 1 and angle /3, i.e., if the 's are 2 2
3 i.
1
1/2 Sqrt[3]
/3
1/2
try
pn = n(A cos n + B sin n) for the real method
3 3
or
example 4
Solve yn+2 - 4yn+1 + 4yn = 62n with y0 = 0, y1 = 0.
Ordinarily with forcing function 62n you try pn = C 2n. But since 2n and n 2n are
homog sols, step up to
pn = Cn2 2n
page 7 of Section 3.3
Then
pn+1 = C(n+1)2 2n+1 = C(n2 + 2n + 1) 22n = 2C(n2 + 2n + 1) 2n
3 3
To get y0 = 0 and y1 = 0 you need 0 = A, 0 = 2A + 2B + 2, A = 0, B = - 4.
Final answer is
3 3 2 n
yn = - 4 n 2n + 4
n 2
If 3n and n3n are both homog sols step up to pn = n2(An2 + Bn + C)3n etc.
But if sin n and cos n are homog sols then step up and try
and take the imag part. But if sin n and cos n are homog sols then step up and try
pn = n(An2 + Bn + C)ein
n n
(3) Suppose fn = 2n sin (similarly for 2n cos )
2 2
n n
pn = 2n (A sin + B cos )
2 2
n n
But if 2n sin and 2n cos are homog sols then step up and try
2 2
n n
pn = n2n (A sin + B cos )
2 2
Superposition rules still hold but the idea of solving a characteristic equ to get
hn doesn't apply anymore. It is not correct to solve the "characteristic equ"
n3 2 + n + 6 = 0 for and use hn = A 1n + B 2n
Furthermore, trying pn of a certain standard form doesn't necessarily work when the
coeffs are variable.
2
3. Nonlinear rr's such as yn+2 yn + yn = 5 or yn+2 + yn+1 _ yn = 2n.
In this case, superposition doesn't hold. Even if you could get hn and pn (which you
can't), the gen sol would not be yh + yp
The methods of this chapter are only for ayn+2 + byn+1 + cyn = fn
(plus similar equations of higher or lower order) where a,b,c are real constants.
1
(b) yn+2 + 2yn+1 - 15yn = 6n + 10 with IC y0 = 1, y1 = - 2
6. Given the following forcing functions and roots of the characteristic equ.
What pn would you try
forcing function fn 's
(a) n4 + 2n i
(b) n4 + 2 1,1,1,1,3
(c) 62n 2, 6
(d) 62n 3, 6
(e) 3n 3, 3
n
(f) 5 cos i
2
n
(g) 5 cos 2i
2
page 10 of Section 3.3
1 n
7. Solve 2yn+1 - yn = (2) with y1 = 2
1
8. Solve yn+2 - 2yn+1 + yn = 1 with y0 = 1, y1 = 2
Sn = 12 + 2 + ... + n2
Find a formula for Sn by writing a recurrence relation plus IC and solving it.
10. (a) For yn+2 - 3yn +1 + 2yn = 62n you have hn = A2n + B so for pn you should
step up and try pn = Cn 2n. What happens if you forget to step up and try pn = A 2n
(b) For 2yn+2 + 3yn+1 + 4yn = 18n you should try pn = An + B . What happens if you
violate warning 1 and try pn = An
yn+2 - 2yn+1 = 0.
Following the rules you would solve 2 - 2 = 0 and get = 0,2 so the gen sol is
yn = A 0n + B2n = B2n
And you suddenly lost one of your two constants (which you would need if you were
going to satisfy two IC). You've always led a good clean life. How could something
like this happen to you and what are you going to do about it.
8. (The tower of Hanoi) The game begins with n rings in increasing size on peg 1.
The idea is to transfer them all to peg 2 but never place a larger ring on top of a
smaller ring at any stage of the game. Rings may be moved temporarily to peg 3 (the
storage peg) as they eventually go from peg 1 to peg 2.
Let yn be the min number of moves required in a game with n rings; i.e., yn is the
min number of moves it takes to transfer n rings from a first peg to a second peg
when you have a third peg available for storage.