Discrete Structures

# Lecture Notes, 22 Nov 2010

 Last Update: 22 November 2010 Note: or material is highlighted

### §§7.1–7.2: Recurrence Relations (cont'd)

1. Thm 1 (p. 462):

Let C0, C1N be constants.

Let a0 = C0 and a1 = C1 be the initial conditions for a recurrence relation;
i.e., the first 2 terms of a sequence.

Let c1, c2R be such that an = c1an–1 + c2an–2 is the recurrence relation.

Let r1 ≠ r2 be 2 distinct roots of the "characteristic equation"

r² – c1r – c2

of the recurrence relation.

Then:

(∃α1, α2R)(∀n ∈ N)[an = α1r1n + α2r2n]

• i.e.) the sequence defined recursively
in terms of initial conditions and a recurrence relation
can be computed non-recursively
using the formula in terms of αi and ri

• This is a non-constructive existence claim!

• We need an algorithm to show how to find the αi

2. Procedure (i.e., algorithm) for solving a (linear homogeneous) recurrence relation
(of degree 2 with constant coefficients):

• I/P: recurrence relation an = c1an–1 + c2an–2

1. Set up the characteristic equation:

r² – c1r – c2

2. Solve the characteristic eqn for r1, r2

1. if r1 = r2,
then begin O/P "no solution"; halt end
else goto (2b)

2. Use:

–b + √(b² – 4ac)
r1 = ______________
2a

and

–b – √(b² – 4ac)
r2 = ______________
2a

where ar² + br + c = 0

i.e.)

a = 1
b = –c1
c = –c2

–c1 + √(c1² – 4c2)
r1 = ______________
2

and

–c1 – √(c1² – 4c2)
r2 = ______________
2

3. Find α1, α2 such that an = α1r1n + α2r2n:

• r1 & r2 were computed in step 2

1. Use initial conditions to produce 2 simultaneous eqns in 2 unknowns:

1. a0 = α1r10 + α2r20 = α1 + α2 (!)

2. a1 = α1r11 + α2r21 = α1r1 + α2r2

2. Solve these for α1 & α2

• Note: α1 = a0 – α2 (from 3(a)(i))

∴ a1 = (a0 – α2)r1 + α2r2 (from 3(a)(ii))
= a0r1 – α2r1 + α2r2
= a0r1 + α2(r2 – r1)

∴ α2(r2 – r1) = a1 – a0r1

∴ α2 = (a1 – a0r1) / (r2 – r1)

• …which is why r1 ≠ r2 !

∴ α1 = a0 – α2 = a0 – (a1 – a0r1) / (r2 – r1)
= (a0r2 – a0r1 + a0r1 – a1) / (r2 – r1)
= (a0r2 – a1) / (r2 – r1)

• O/P: explicit formula for an, namely:

an = α1r1n + α2r2n

3. As an example, let's solve the Fibonacci recurrence relation:

1. f0 = 0
f1 = 1

fn = fn–1 + fn–2

0,1,1,2,3,5,…

2. Solution:

1. Char Eqn: r² – c1r – c2 = 0

• What are c1, c2 s.t. fn = c1fn–1 + c2fn–2?

• Answer: c1 = c2 = 1

• ∴ char eqn is: r² – r – 1 = 0

Digression:

• Consider a "golden rectangle":

—allegedly the most aesthetically pleasing rectangle:

• The front of the Parthenon has the shape of a golden rectangle.

• Index cards come in golden rectangles: 3×5; 5×8 (note the Fibonacci numbers!)

• The "golden ratio" (see the picture of the golden rectangle, above) is:

r + 1      r
_____ = _
r         1

∴ r² = r + 1
∴ r² – r – 1 = 0  [does that look familiar?]

2. Solve for r:

• r = (1 ± √(1 + 4))/2 = (1 ± √5)/2

• This is (these are?) the golden ratio(s):

• √5 = 2.236067977…
• (1+√5)/2 =   1.6180339885…
• (1–√5)/2 = –0.6180339885…
• Also: the reciprocal of (1+√5)/2 = 0.6180339885…

• Weird!

3. Find α1, α2 s.t. fn = α1r1n + α2r2n :

• Let r1 = (1+√5)/2 & r2 = (1–√5)/2

• f0 = 0 = α1r10 + α2r20 = α1 + α2

• f1 = 1 = α1r11 + α2r21

= α1((1+√5)/2) + α2((1–√5)/2)

• Solve:

• 0 = α1 + α2
• ∴ α1 = –α2

• 1 = α1((1+√5)/2) + α2((1–√5)/2)

• ∴ 1 = –α2((1+√5)/2) + α2((1–√5)/2)

= α2( (–1–√5)/2 + (1–√5)/2 )

= α2( (–1–√5+1–√5)/2 )

= α2( (–2√5)/2 )

= –α2√5

• ∴ α2 = –1/√5

• ∴ α1 =   1/√5

4. ∴ fn = (1/√5)((1+√5)/2)n – (1/√5)((1–√5)/2)n

4. Another example:

1. A long time ago, I discovered that if you fold a piece of paper in ½, then fold the top half back, then fold it ¼ of the way, then fold it back and fold it 3/8 of the way, and so on (see Fig. 1, below), the edge of the paper winds up 1/3 of the way from the edge!

1. More precisely, fold it according to the following directions:

2. The question is: Where does B end up?

And the answer is: 1/3 of the way from the edge!

The puzzle is: How does a sequence of foldings-in-half yield the number 1/3?

2. For the use of continuous math (i.e., limits) to prove this, see:

3. Here's the sequence of folds, expressed recursively:

a0 = 0 (paper begins unfolded, at one edge, or 0")
a1 = ½ (first fold moves the edge ½, to middle of paper)

an = (an–1 + an–2)/2

(each subsequent fold moves the edge to the average of its previous two positions)

= ½an–1 + ½an–2

• 0, ½, ¼, 3/8, 5/16, 11/32, …

• The curious feature is that each term in the sequence has a denominator that is a power of 2,
yet the limit of the folds is 1/3.

Where did the "3" come from?

4. Let's solve this recurrence relation:

• I/P: an = ½an–1 + ½an–2

1. Char Eqn: r² – ½r – ½

2. Solve for r:

• r = (½ ± √(¼ + 4*½))/2
= (½ ± √(¼ + 2))/2
= (½ ± √(9/4))/2
= (½ ± 3/2)/2
∈ {1, –½}

• i.e.) r1 = 1 & r2 = –½

3. Solve for α:

• a0 = 0 = α1 + α2

∴ α2 = –α1

• a1 = ½ = 1*α1 + (–½*α2) = α1 – α2/2

∴ ½ = α1 + α1/2 = 3α1/2

∴ 1 = 3α1

∴ α1 = 1/3  [there's the 1/3!!!]

∴ α2 = –1/3

• O/P:

an = α1r1n + α2r2n
= (1/3)*1n + (–1/3)*(–½)n =      1/3 – (1/3)*(–½)n      = (1/3)(1 – (–½)n)

• (As n gets bigger, the –½n gets smaller and smaller;
in the limit it goes to 0, so the limit of the sequence is 1/3)

1. A final example, to be continued next time…

Consider this sequence:

a0 = C0
a1 = C1

an = 3an–1 – 2an–2, ∀ n ≥ 2

Try it! Use the algorithm to show that an = 2n – 1, as suggested in the table in the previous lecture.

(answer will be given in the next lecture)