Ternary String recursion relation

Click For Summary

Homework Help Overview

The discussion revolves around finding a recursion relation for the number of ternary strings (strings consisting of the digits 0, 1, and 2) that contain consecutive zeros (00) as a substring. The original poster expresses confusion regarding the derivation of the recursion relation and the reasoning behind specific terms in the equation.

Discussion Character

  • Conceptual clarification, Assumption checking

Approaches and Questions Raised

  • The original poster attempts to understand the reasoning behind the recursion relation, questioning why certain terms are included and how they relate to the length of the strings. They specifically inquire about the cases for strings starting with 1 and 00, and the implications of these cases on the overall count of strings with consecutive zeros.

Discussion Status

Some participants provide clarifications regarding the interpretation of the recursion relation and the meaning of the terms involved. There is an ongoing exploration of the assumptions made about the structure of the strings and the conditions under which consecutive zeros are counted. The discussion is active, with participants seeking to clarify misunderstandings and elaborate on the reasoning behind the equations.

Contextual Notes

Participants are navigating the complexities of defining the recursion relation based on specific string configurations and are questioning the assumptions about the presence of consecutive zeros in various cases. There is a focus on ensuring that all potential string configurations are considered in the derivation of the relation.

DorumonSg
Messages
61
Reaction score
0
I don't understand this at all I have the solution but no idea.

I am suppose to find the recursion relation for consecutive 0 in a ternary string(String that contains only 0, 1 and 2)

So the solution I have is :

Strings starting with 1 = an(The n is the small n for recursion) - 1
Strings startring with 2 = an - 1
Strings starting with 01 = an - 2
Strings starting with 02 = an - 2
Strings starting with 00 = 3^n-2

So the relation is an = 2an-1 + 2an - 2 + 3^n-2 for n >= 3

So how did they get the relation?

Why an - 1? What is the length of the String they base their calculations on?

Example :

I take Strings starting with 1, I can have 10, 11, 12, why an - 1? and not an - 3, all 3 do not have consecutive 0s?

Or if I take the length of the String as 3, I can have 100, 110, 101, 102, 111... so why -1? When I have so many other strings to minus off?

And also for 00,

Where did the 3^n come from?

This is so mind confusing.
 
Physics news on Phys.org
I think you misunderstand what the equations say. The idea is that we let a_n be the number of ternary strings of length n with 00 as a substring. Now if we have a string of length n starting with 1, then it contains consecutive 0 iff the remaining (n-1) characters do. Thus the number of such strings having consecutive 0s is equal to the number of strings of length (n-1) having consecutive 0s, i.e. a_{n-1} (which you wrote as an-1). Similar reasoning holds for the remaining cases. Note that the number of such strings starting with 00 is:
3^{n-2}
I think you may have interpreted the results as a_n-1 and 3^n-2 which is incorrect.
 
rasmhop said:
I think you misunderstand what the equations say. The idea is that we let a_n be the number of ternary strings of length n with 00 as a substring. Now if we have a string of length n starting with 1, then it contains consecutive 0 iff the remaining (n-1) characters do. Thus the number of such strings having consecutive 0s is equal to the number of strings of length (n-1) having consecutive 0s, i.e. a_{n-1} (which you wrote as an-1). Similar reasoning holds for the remaining cases. Note that the number of such strings starting with 00 is:
3^{n-2}
I think you may have interpreted the results as a_n-1 and 3^n-2 which is incorrect.

Hey wait... even if you say that n - 1 is because iff the consective string is 00... but what if the consecutive string is not 00? it doesn't take that into account?

Okie, but I don't understand why is it for 00 it is 3^{n-2}
 
Last edited:
DorumonSg said:
Hey wait... even if you say that n - 1 is because iff the consective string is 00... but what if the consecutive string is not 00? it doesn't take that into account?
I'm not sure exactly what you mean here. Could you elaborate? We are always looking for consequtive 0s (i.e. for 00).

Okie, but I don't understand why is it for 00 it is 3^{n-2}

3^{n-2} is the number of ternary strings of length (n-2). If we know the string starts with 00 we just want the last (n-2) characters to be arbitrary.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
2
Views
2K