Recurrence Relation for Two Consecutive 0s in Ternary Strings

In summary, the recurrence relation for the number of ternary strings of length n that contain two consecutive 0s is a_n = 2a_{n-1} + 2a_{n-2} + 3^{n-2}, where a_n counts the number of ternary strings of length n that contain two consecutive 0s. However, there may be a different interpretation where the solution is a_n = 2a_{n-1} + 2a_{n-2} + 2^{n-2} if the number of isolated ones is not considered.
  • #1
Mr Davis 97
1,462
44

Homework Statement


Find a recurrence relation for the number of ternary strings of length n that contain two consecutive 0s.

Homework Equations

The Attempt at a Solution


Let ##a_n## count the number of ternary stings of length n that contain two consecutive 0s. Then, we can split the total number into mutually exclusive cases. If we start with 1 or 2, then we have ##a_{n-1}## in both cases. If we start with 01 or 02, then we have ##a_{n-2}## in both cases. If we start with 00, then we have ##3^{n-2}## possibilities for the other strings, since we already have two consecutive zeroes. Thus ##a_n = 2a_{n-1} + 2a_{n-2} + 3^{n-2}##.

However, apparently the solution is ##a_n = 2a_{n-1} + 2a_{n-2} + 2^{n-2}##. Is this correct or is mine correct?
 
Physics news on Phys.org
  • #2
Perhaps they mean exactly one instance of 00, rather than one or more instances of 00. Under the latter (former) interpretation you (they) are correct.
 
  • Like
Likes Mr Davis 97
  • #3
andrewkirk said:
Perhaps they mean exactly one instance of 00, rather than one or more instances of 00. Under the latter (former) interpretation you (they) are correct.
No, it still doesn't make the book answer correct. Even though there must be no more pairs of consecutive zeroes, there can still be isolated ones.
 

What is a recurrence relation for two consecutive 0s in ternary strings?

A recurrence relation is a mathematical equation that defines a sequence of numbers based on previous terms in the sequence. In the case of two consecutive 0s in ternary strings, the recurrence relation helps determine the number of ternary strings of length n that do not contain two consecutive 0s.

How is the recurrence relation for two consecutive 0s in ternary strings calculated?

The recurrence relation for two consecutive 0s in ternary strings is calculated using the following formula: T(n) = 2T(n-1) + T(n-2) - T(n-3), where T(n) represents the number of ternary strings of length n without two consecutive 0s. This formula is derived from the principle of inclusion-exclusion, which accounts for the overlapping cases in the sequence.

What is the significance of the recurrence relation for two consecutive 0s in ternary strings?

The recurrence relation for two consecutive 0s in ternary strings is significant because it allows us to efficiently compute the number of ternary strings without two consecutive 0s for any given length. This can be useful in various fields, such as computer science and cryptography, where ternary strings are commonly used.

What are some applications of the recurrence relation for two consecutive 0s in ternary strings?

The recurrence relation for two consecutive 0s in ternary strings has practical applications in various fields. For example, it can be used in the design of error-correcting codes, as well as in the analysis of algorithms and data structures. It can also be used in solving certain combinatorial problems, such as counting the number of ways to arrange objects with restrictions.

Are there any limitations to the recurrence relation for two consecutive 0s in ternary strings?

While the recurrence relation for two consecutive 0s in ternary strings is a useful tool, it does have some limitations. It can only be applied to ternary strings, and it may not give an accurate result for very large values of n due to potential rounding errors. Additionally, the recurrence relation assumes that the strings are of infinite length, which may not always be the case in practical applications.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
12
Views
2K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
Replies
5
Views
1K
  • Precalculus Mathematics Homework Help
Replies
14
Views
3K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
1
Views
2K
Replies
8
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • General Math
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
2K
Back
Top