You are on page 1of 6

MATH OLYMPIAD LESSONS

COMBINATORICS


Regarding solutions to the problems posed in the article and any comments, corrections or suggestion, contact me:
Kamal Lohia (kamallohia@totalgadha.com)
www.totalgadha.com www.totalgadha.com/rmo

Fibonacci Recursion As a tool to counting
In daily life we see so many people around us doing math on fingers something
what this cute girl in the picture is doing. May be such people arent so well
acquainted with modern day electronic gadgets, which can make their task easier.
But this is quite sure that people such as fruit vendors, street hawkers etc can
count on their fingers at a lightening speed. For example, when I asked the price of
brinjal and my fruit vendor replied, Rs16 per kg. I ordered for a kg and he gave
me an option, either buy the brinjal worth Rs10 or Rs20. Before I could even
decide, he was ready with his weights. I randomly said, Give me for Rs10. I was
not even done with my calculations and he handed over my packet. On my way
back home, after finishing with my mental calculator, I was amazed how quick and
accurate he was with numbers.

This made me realize that tough problems may have simpler solutions. We just
need to look around for.



In most of the counting problems we use binomial coefficients and other combinatory tools. But recursion can act
as a wonderful tool to solve tough problems. In the 13
th
century, the Italian mathematician Leonardo Fibonacci
studied the following (not too realistic) exercise:

Its easy to figure out the answer for smaller n. Farmer has 1 rabbit in the 1
st
month and 1 rabbit in 2
nd
month as
rabbit has to be 2 months old before starting to reproduce. In 3
rd
month farmer has 2 rabbits and in 4
th
month he
has 3 rabbits as first rabbit has delivered another. After fourth month second rabbit also starts reproducing so
two new rabbits get added. Thus in 5
th
month, he has 5 rabbits.

We can easily calculate the number of rabbits in n
th
month now, if we realize that number of new rabbits added in
n
th
month is same the number of rabbits who are at least 2 months old or who were present there two months
ago. In other words If F
n
denotes the number of rabbits in n
th
month, then w have for n 2,
F
n+1
= F
n
+ F
n-1

We already know that F
1
= 1, F
2
= 1, F
3
= 2, F
4
= 3 and F
5
= 5. If we set F
0
= 0, then above equation will be
valid for n = 1 also. Now any term of the following sequence can be determined easily:
MATH OLYMPIAD LESSONS
COMBINATORICS


Regarding solutions to the problems posed in the article and any comments, corrections or suggestion, contact me:
Kamal Lohia (kamallohia@totalgadha.com)
www.totalgadha.com www.totalgadha.com/rmo

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987
The numbers in this sequence are called Fibonacci Numbers. And any pattern of integers which follow the above
equation can be termed as Fibonacci Sequence.

Lets see some examples of Fibonacci in daily math life:

A staircase has 10 steps. You walk up taking one or two at a time. How many ways can you go up?
For one step only we see that there is one way. If there are two steps we can go up in two ways i.e. 1 + 1 or 2.
If there are three steps we can go up in three ways i.e. 1 + 1 + 1, 1 + 2 or 2 + 1. Now can you guess the
number of ways for four steps? No it is not four rather five i.e. 1 + 1 + 1 + 1, 1 + 1 + 2, 1 + 2 + 1, 2 + 1 + 1 or
2 + 2.
Now lets think logically and apply reverse count. If there are a
n+1
number of ways to go up to n + 1 steps, then
these number of ways can be separated in two categories;
one in which first step was single i.e. remaining n steps can be covered in a
n
ways,
second in which first step was double i.e. remaining n 1 steps can be taken in a
n-1
ways. So we can
safely write now that,
a
n+1
= a
n
+ a
n-1

If you look closely this is the same equation as we obtained above for Fibonacci Sequence. We know that a
1
= 1,
a
2
= 2. So the pattern can easily be obtained as
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
No points for guessing that a
10
= 89.

TG Tower has 10 floors each need to be painted with either pink or yellow color. But no two adjacent
floors are to be colored pink. In how many ways the tower can be painted?
Again applying the logical reverse count let a
n+1
be the number of ways to paint the n + 1 floors. These include
the ways
when first floor was painted pink i.e. next floor has to be yellow and remaining n 1 floors can be painted
in a
n-1
ways,
and when first floor was painted yellow i.e. remaining n floors can be painted in a
n
ways. So we have got
the recursion as
a
n+1
= a
n
+ a
n-1

with a
1
= 2, a
2
= 3. So the pattern can easily be obtained as
2, 3, 5, 8, 13, 21, 34, 55, 89, 144
And the required number of ways of painting is 144.

All 10-digit natural numbers are formed by using digit 1 or 2. How many of these numbers have two
consecutive 1s?
Lets count first that how many ten digit natural numbers dont have two consecutive ones. If I replace the
numeral 1 with pink and 2 with yellow of above question, I have already calculated the number of 10 digit
numbers with no two consecutive 1s which is 144. As total 10 digit numbers formed by using digit 1 or 2 is 2
10
=
1024, so the required numbers are 1024 144 = 880.

A fair coin is tossed 10 times. Let
x
y
be the probability that no two consecutive tosses show tails
where x and y are natural numbers such that HCF(x, y) = 1. Find x + y.
MATH OLYMPIAD LESSONS
COMBINATORICS


Regarding solutions to the problems posed in the article and any comments, corrections or suggestion, contact me:
Kamal Lohia (kamallohia@totalgadha.com)
www.totalgadha.com www.totalgadha.com/rmo

You must be able to do this one easily now. I am leaving this for my intellectual audiences fun.

There are 10 line segments of different integer lengths increasing from 1 meter to n meter. What is
the smallest value of n such that no three line segments from the ten can be chosen to make a
triangle?
This is a special use of Fibonacci. We know that sum of any two sides of a triangle must be greater than the third
side other wise the three sides cannot form a triangle. So the 10 smallest lengths can easily be obtained as:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89
We have got our answer with n = 89.

A postman delivers letters to the nineteen houses on the west side of Chaurangi lane. The postman
notices that no two consecutive houses ever get letters on the same day. How many different
combinations of letter delivery are possible?
Lets reframe the question as making 19 - digit number formed using digits 1 and 2 only with no two consecutive
1s. Here 19 - digit number represents 19 houses while 1 denotes letter posted and 2 denote letter not posted to
a particular house. We are going to get the same recursion again i.e.
a
n+1
= a
n
+ a
n-1

with a
1
= 2, a
2
= 3. So the pattern can easily be obtained as
2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946
And the answer is a
19
= 10946.

In how many ways a 2 10 rectangle can be tiled by using 2 1 or 2 2 tiles?
Lets try to solve this one again by reverse count. Let a
n
be the number of ways of tiling a 2 n rectangle. This
include the ways when first tile is 2 1 in vertical orientation (as below) i.e. remaining rectangle can be tiled in
a
n-1
ways.

And it include the ways when first tile is 2 2 (as shown) i.e. remaining rectangle can be tiled in a
n-2
ways.

Also it include the ways when first 2 1 tile was in horizontal orientation (see figure) i.e. remaining rectangle can
be tiled in a
n-2
ways.

Thus the recursion can be obtained as
a
n
= a
n-1
+ 2a
n-2

with a
1
= 1, a
2
= 3. Pattern is:
1, 3, 5, 11, 21, 43, 85, 171, 341, 683
MATH OLYMPIAD LESSONS
COMBINATORICS


Regarding solutions to the problems posed in the article and any comments, corrections or suggestion, contact me:
Kamal Lohia (kamallohia@totalgadha.com)
www.totalgadha.com www.totalgadha.com/rmo

Required number of ways is a
10
= 683.

By now you must have understood how to create a recursion and use this tool to solve somewhat how to handle
problems.

Coming back to original Fibonacci Sequence, lets study some properties:
To define a Fibonacci Sequence, we need first two terms as all other terms can be obtained in terms of
these two terms with the relation
F
n+1
= F
n
+ F
n-1

How to find the n
th
term of the original Fibonacci Sequence i.e. 0, 1, 1, 2, 3, 5?
If we disregard first few terms then any Fibonacci behaves as a geometric progression (GP) with a
common ratio close to 1.6 or Golden ratio i.e.
5 1
2
+
. This can be easily checked by taking the terms of
Fibonacci in GP as T
n
= ar
n

So using the recursion, we have T
n+1
= T
n
+ T
n-1

That means, ar
n+1
= ar
n
+ ar
n-1
=> r
2
= r + 1 => r =
1 5
2
+
or
1 5
2


We have T
n
= a
n
1 5
2
| |
+
|
|
\
or T
n
= a
n
1 5
2
| |

|
|
\
both of which will satisfy the above recursion but they do not
give the original Fibonacci. Lets see that difference of these two sequences also satisfy the recursion.
i.e. T
n+1
T
n+1
= (T
n
+ T
n-1
) (T
n
+ T
n-1
) = (T
n
T
n
) + (T
n-1
T
n-1
)
So lets try to equate T
n
T
n
with F
n
so as to find the formula for n
th
term of Fibonacci.
T
0
T
0
= 0 = F
0
(satisfying)
T
1
T
1
= a 5 = 1 = F
1
if a =
1
5

T
2
T
2
= 1 = F
2
(satisfying)
Eureka! We have got it now.
F
n
=
1 1 5 1 5
2 2
5
n n
( ( ( (
| | | | | | | | | | | | | | | |
+ + + +
( ( ( (
| | | | | | | |
| | | | | | | |
( ( ( (
\ \ \ \ \ \ \ \



How to find sum of any Fibonacci Sequence?
S
n
= F1 + F
2
+ F
3
+ F
4
+ + F
n

S
n
= F
1
+ F
2
+ F
3
+ F
4
+ + F
n

Subtracting the two expressions we get,
0 = F
1
+ F
2
+ [F
2
+ F
3
+ + F
n-1
] F
n-1
- F
n
, or
S
n
= F
1
+ F
2
+ F
3
+ F
4
+ + F
n
= F
n-1
+ F
n
F
2

Finally we have,
S
n
= F
n+1
F
2

MATH OLYMPIAD LESSONS
COMBINATORICS


Regarding solutions to the problems posed in the article and any comments, corrections or suggestion, contact me:
Kamal Lohia (kamallohia@totalgadha.com)
www.totalgadha.com www.totalgadha.com/rmo

Sum of squares of n terms of any Fibonacci Sequence:
F
1
2
+ F
2
2
+ F
3
2
+... + F
n
2
= F
1
2
+ {F
1
F
2
+ F
2
2
} + F
3
2
+... + F
n
2
- F
1
F
2
= F
1
2
+ {F
2
F
3
+ F
3
2
} + + F
n
2
-
F
1
F
2
= F
1
2
+ F
n
F
n+1
- F
1
F
2
.
If F
1
= 0 or F
1
= F
2
, then
F
1
2
+ F
2
2
+ F
3
2
+... + F
n
2
= F
n
F
n+1


Now some experimental results, which can be verified by mere calculations:
Pattern of unit digit in any Fibonacci Sequence of positive integers repeat after maximum of 60 terms.
Pattern of last two digits in any Fibonacci Sequence of positive integers repeat after maximum of 300
terms.
Pattern of last three digits in any Fibonacci Sequence of positive integers repeat after maximum of 1500
terms.
Now do some questions:
1. The increasing sequence of positive integers a
1
, a
2
, a
3
: has the property that
a
n+2
= a
n
+ a
n+1
for all n 1
If a
7
= 120, then a
8
is:

2. What is the sum of the series: 2
2
+ 4
2
+ 6
2
+ 10
2
+ 16
2
+... + 754
2
+ 1220
2
?

3. Without actually adding, find the sum 3 + 11 +14 + 25 ++ 1851 + 2995.

4. How many 10 digit natural numbers formed by digits 1 and 2 only are there which do not have
221 at any place?

5. In how many ways a 2 10 rectangle can be tiled by using 2 1 or L-shaped dominoes?

6. There are two urns, one is full of water and the other is empty. On the first stage, half of the
content of urn I is passed into urn II. On the second stage 1/3 of the content of urn II is
passed into urn I. On stage three, 1/4 of the content of urn I is passed into urn II. On stage
four 1/5 of the content of urn II is passed into urn I, and so on. What fraction of water remains
in urn I after the 2010
th
stage?

7. Twelve people are seated around a circular table. In how many ways can six pairs of people
engage in handshakes so that no arms cross? (Nobody is allowed to shake hands with more
than one person at once.)

A special case or use of recursion is derangement. See the below examples:

In how many ways can six couple dance in pairs so that no person dances with his or her spouse?

In how many ways can six letters be delivered to different addresses so that no letter reaches its
desired place?
MATH OLYMPIAD LESSONS
COMBINATORICS


Regarding solutions to the problems posed in the article and any comments, corrections or suggestion, contact me:
Kamal Lohia (kamallohia@totalgadha.com)
www.totalgadha.com www.totalgadha.com/rmo


In how many ways Mr. Black, Mr. White, Mr. Red, Mr. Blue, Mr. Green and Mr. Orange can each wear a
cap from six black, white, red, blue, green and orange colored ones such that no person is wearing
cap of same color as his name?

In how many ways a 2 6 rectangle can be tiled with six different types of 1 1 tiles with two of each
type available? It is given that each of the two 1 6 rectangle contain all the six types of tile and no
two same tile share an edge.
All of the above questions are asking for same thing that a particular item must not be associated with its
partner. Lets take the general case We have a
1
, a
2
, , a
n
which are partners of b
1
, b
2
, , b
n
respectively. Now
we are to pair them in such a way that no two partners are in same group. Lets call it derangement and D
n
be
the number of derangements of n pairs.
Now it can be easily observed that D
1
= 0, D
2
= 1, D
3
= 2.
Number of derangements for n pairs i.e. D
n
includes the ways
when a
1
is associated with b
i
(where i can be selected from 2 to n in (n 1) ways) and a
i
is associated
with b
1
i.e. remaining n 2 pairs can be deranged in D
n-2
ways.
when a
1
is associated with b
i
(where i can be selected from 2 to n in (n 1) ways) and a
i
is not
associated with b
1
i.e. remaining n 1 pairs can be deranged in D
n-1
ways.
So here we go with our recursion as follows:
D
n
= (n 1)[D
n-1
+ D
n-2
]
Now lets try to derive a formula for D
n
, we have D
n
= (n 1)[D
n-1
+ D
n-2
]
=> D
n
nD
n-1
= (-1)[D
n-1
(n 1)D
n-2
] = (-1)
2
[D
n-2
(n 2)D
n-3
] = = (-1)
n-2
[D
2
2D
1
] = (-1)
n-2
= (-1)
n

So dividing by n!, we have
1
( 1)
! ( 1)! !

n
n n
D D
n n n

Similarly,
1
1 2
( 1)
( 1)! ( 2)! ( 1)!



=

n
n n
D D
n n n

2
3 2
( 1)
( 2)! ( 3)! ( 2)!



=

n
n n
D D
n n n

:::::::::::::::::::::::::::
2
2 1
( 1)
2! 1! 2!

=
D D

Adding all the above equations we have,
1 2 2
1
( 1) ( 1) ( 1) ( 1)
...
! 1! ! ( 1)! ( 2)! 2!


= + + + +

n n n
n
D D
n n n n


I hope all of you can solve above questions easily. Also I am sure you will be having a new perspective to view
abnormal counting problems.
Good luck!