Saturday, November 13, 2010

Fibonacci's Rabbits

GEK1517 Tutorial 6 / Question 1.
Starting with the letter b, consider the rewriting rules
b → a; a → ab.
For example, the first few 'words' formed by the above rewriting rules are
b, a, ab, aba, abaab, abaababa, ...
Let C(n) be the number of letters in the n-th word (n is a positive integer). For instances [sic],
C(1) = 1, C(2) = 1, C(3) = 2, C(4) = 3, C(5) = 5, C(6) = 8, ...
Prove that
C(n+1) = C(n) + C(n-1)
for all integers n ≥ 2. (Caution: Math. induction may not work well here.)

Spoiler: Lecturer's solution is more elegant, so please bear with me here.

Let number of 'b's in n-th word: Bn.
Let number of 'a's in n-th word: An.

Because of the rewriting rules b → a; a → ab.
'b's in a word is generated only from 'a's in the previous word
∴ Bn = An-1
'a's in a word is generated from both 'a's and 'b's in the previous word.
∴ An = An-1 + Bn-1

Now total number of letters in n-th word is C(n)
Total number of letters in n-th word is sum of 'a's and 'b's.
∴ C(n) = An + Bn
now
C(n-1) = An-1 + Bn-1 = An
C(n+1) = An+1 + Bn+1

To show that C(n+1) = C(n) + C(n-1), express all terms in An and Bn.
C(n+1) = C(n) + C(n-1)
⇒ An+1 + Bn+1 (LHS)
= An + Bn + An = 2An + Bn (RHS)
∵ Bn = An-1,
Bn+1 = An.
∵ An = An-1 + Bn-1,
An+1 = An + Bn.
Sub back into LHS:
LHS = An + An + Bn
= 2An + Bn = RHS.

-- END OF DEMONSTRATION --

No comments:

Post a Comment