About a recurrence problem

51 Views Asked by At

We have two kind of signals which differ in length.

The first lasts 1ms.

The second lasts 2ms.

How many different messages that lasts 6ms can we sand?

This is the recurrent problem I am trying to solve.

Let $P_{n}$ be the number of messages we can send.

If we receive 1 signal , its - 1 ms , if we receive 2nd signal its -2ms. There are disjunctive term so we could write it down as

$$P_{n}=P_{n-1} + P_{n - 2 }$$

By this definition we could write starting condition.

$P_{1} = 1$ (we can have only one message with length 6ms and that is 1*1st signal)

$P_{2} = 2$ (2* 1st signal or 1* 2nd signal)

By the formula we could express the signal with length 3 e.g

$P_{3} = P_{2} + P_{1} = 2 + 1 = 3$

But we can have only 2 kind of messages with length 3, = 3* 1st or 1* 1st + 1 * 2nd signal.

Which already indicates the formula I have came up with is wrong so using this formula to calculate the number of messages with length of 6ms would result in wrong answer.

So I assume my understanding of this concept is wrong. How could I understand the problem such as this and where is mistake in my concept? I appreciate all help. Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

The recurrence $p_n=p_{n-1}+p_{n-2}$ with $p_1=1$ and $p_2=2$ solve the problem.

See that if a message has lenght $n$ then:

1) if the last sign has length $1$ms then we get $p_{n-1}$ possibilities;

2) if the last sing has length $2$ms then we get $p_{n-2}$ possibilities.

So,

$$p_n=p_{n-1}+p_{n-2}$$

BTW:

$p_3=3$, in fact, if the signal takes $3$ms we have the possibilities:

$(1ms,1ms,1ms), (1ms,2ms),(2ms,1ms)$