MIT6_042JS10_lec32_sol

# MIT6_042JS10_lec32_sol - Massachusetts Institute of...

This preview shows pages 1–3. Sign up to view the full content.

Massachusetts Institute of Technology 6.042J/18.062J, Spring ’10 : Mathematics for Computer Science April 26 Prof. Albert R. Meyer revised April 26, 2010, 1303 minutes Solutions to In-Class Problems Week 12, Mon. Problem 1. The famous mathematician, Fibonacci, has decided to start a rabbit farm to ﬁll up his time while he’s not making new sequences to torment future college students. Fibonacci starts his farm on month zero (being a mathematician), and at the start of month one he receives his ﬁrst pair of rabbits. Each pair of rabbits takes a month to mature, and after that breeds to produce one new pair of rabbits each month. Fibonacci decides that in order never to run out of rabbits or money, every time a batch of new rabbits is born, he’ll sell a number of newborn pairs equal to the total number of pairs he had three months earlier. Fibonacci is convinced that this way he’ll never run out of stock. (a) Deﬁne the number, r n , of pairs of rabbits Fibonacci has in month n , using a recurrence rela- tion. That is, deﬁne r n in terms of various r i where i < n . Solution. According to the description above, r 0 = 0 and r 1 = 1 . Since the rabbit pair received at the ﬁrst month is too young to breed, r 2 = 1 as well. After that, r n is equal to the number, r n 1 , of rabbit pairs in the previous month, plus the number of newborn pairs, minus the number, r n 3 , he sells. The number of newborn pairs equals to the number of breeding pairs from the previous month, which is precisely the total number, r n 2 , of pairs from two months before. Thus, r n = r n 1 + ( r n 2 r n 3 ) . (b) Let R ( x ) be the generating function for rabbit pairs, R ( x ) ::= r 0 + r 1 x + r 2 x 2 + · . Express R ( x ) as a quotient of polynomials. Solution. Reasoning as in the derivation of the generating function for the orginal Fibonacci num- bers, we have R ( x ) = r 0 + r 1 x + r 2 x 2 + r 3 x 3 + r 4 x 4 + ··· . xR ( x ) = r 0 x r 1 x 2 2 r 2 x 3 3 r 3 x 4 4 − ··· . x 2 R ( x ) = r 0 x r 1 x r 2 x − ··· . x 3 R ( x ) = + r 0 x 3 + r 1 x 4 + ··· . R ( x )(1 x x 2 + x 3 ) = r 0 + ( r 1 r 0 ) x + ( r 2 r 1 r 0 ) x 2 + 0 x 3 + 0 x 4 + ··· . = 0 + 1 x + 0 x 2 . Creative Commons 2010, Prof. Albert R. Meyer .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Solutions to In-Class Problems Week 12, Mon. so
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/27/2011 for the course CS 6.042J taught by Professor Prof.albertr.meyer during the Spring '11 term at MIT.

### Page1 / 7

MIT6_042JS10_lec32_sol - Massachusetts Institute of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online