Find a recursion formula for combinatorial problem. Let C_n be the number of sequences with a length of n, which their elements belong to {0,1,2}, and they don't contain the following sequences: 11,21. Find a recursion formula with starting conditions for C_n.

MMDCCC50m

MMDCCC50m

Answered question

2022-11-05

Find a recursion formula for combinatorial problem
Let C n be the number of sequences with a length of n, which their elements belong to {0,1,2}, and they don't contain the following sequences: 11,21. Find a recursion formula with starting conditions for C n .

Answer & Explanation

Aliya Moore

Aliya Moore

Beginner2022-11-06Added 17 answers

Step 1
If the last digit is a 0 or a 2, any sequence of length n 1 works before that, and if the last digit is a 1, the rest of the sequence has to end in a 0, which in turn means that the first n 2 digits have to form an arbitrary valid sequence. From there we immediately arrive at the recursive formula C n = 2 C n 1 + C n 2 .
Now as promised the more complicated approach considering the first digit: Let x n ( k ) denote the number of sequences of length n that start with the digit k, obviously we have C n = x n ( 0 ) + x n ( 1 ) + x n ( 2 ) . Let's find recursive formulas for the x n ( k ) . For k = 0, we have
x n ( 0 ) = x n 1 ( 0 ) + x n 1 ( 1 ) + x n 1 ( 2 ) = C n 1
since a 0 can be added to every sequence of length n 1. For k = 1 and k = 2, the rest of the sequence may not start with a 1, so we have
x n ( 1 ) = x n ( 2 ) = x n 1 ( 0 ) + x n 1 ( 2 ) .
Step 2
Now we put this together and calculate a formula for C n :
C n = x n ( 0 ) + x n ( 1 ) + x n ( 2 ) = C n 1 + 2 ( x n 1 ( 0 ) + x n 1 ( 2 ) ) = C n 1 + x n 2 ( 0 ) + x n 2 ( 1 ) + x n 2 ( 2 ) + x n 1 ( 0 ) + 2 x n 1 ( 2 ) = C n 1 + x n 1 ( 1 ) + x n 2 ( 1 ) + x n 1 ( 0 ) + x n 1 ( 2 ) + x n 1 ( 2 ) = 2 C n 1 + x n 2 ( 1 ) + x n 2 ( 0 ) + x n 2 ( 2 ) = 2 C n 1 + C n 2 .

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?