Novice in Recurrence Relations

Click For Summary

Homework Help Overview

The discussion revolves around understanding recurrence relations, specifically in the context of counting ternary strings that contain two consecutive zeros. The original poster expresses confusion about the derivation of recurrence relations and the implications of using previous terms in the sequence.

Discussion Character

  • Exploratory, Assumption checking, Conceptual clarification

Approaches and Questions Raised

  • The original poster attempts to clarify the meaning of terms like an-1 and how they relate to the overall recurrence relation. They question how to derive these terms and when to stop, as well as the validity of initial conditions. Other participants suggest considering different interpretations of the problem regarding the placement of zeros in the strings.

Discussion Status

Participants are actively engaging with the original poster's questions, providing insights into the nature of recurrence relations and the assumptions that may affect the problem. There is a recognition of multiple interpretations of the problem, and some guidance has been offered regarding the structure of valid ternary strings.

Contextual Notes

There is uncertainty regarding the specific rules governing the ternary strings, particularly about the number of pairs of consecutive zeros allowed. Participants suggest verifying assumptions with an instructor to clarify the problem's constraints.

juki_inla
Messages
2
Reaction score
0
I am totally new to this area, and have some major trouble understanding how recurrence relations were derived from the problems, what to do and what's not. Really appreciate any guidance!For example: Give a Ternary String (containing only 0s, 1s, or 2s), we have to find out the recurrence relations of number of ternary string that contains 2 consecutive 0s.

Given solution:
String starting from 1--- an-1
String starting from 2--- an-1
=2*an-1
String starting from 01-- an-2
String starting from 02-- an-2
=2*an-2
String starting from 00-- an-2
=3n-2

an= 2*an-1 + 2*an-2+3n-2

My troubles are:
1) an-1. Can I safely understand it as the previous term we are working with before we get an

2) How do we derive these an-1, an-2 and so on? Until when/which previous terms should I stop?

3) Does that mean that anytime we use the previous terms, the initial condition [whether given or not] we have to assume it is true? For in this case, an-1
is working already with a ternary string of 2 consecutive zeros?

Thanks in advance!
 
Physics news on Phys.org
Have you learned about generating functions yet?
 
1) an-1. Can I safely understand it as the previous term we are working with before we get an

Yes. Since in the first and second case you haven't violated any rules and placed a 0 right before the next slot, you can place any arbitary n-1 length valid ternary word, which is:
an-1.

2) How do we derive these an-1, an-2 and so on? Until when/which previous terms should I stop?

There's nothing to derive from here. Once you have the equation, you have the reccurrence formula. You stop when you find all the cases.

3) Does that mean that anytime we use the previous terms, the initial condition [whether given or not] we have to assume it is true? For in this case, an-1
is working already with a ternary string of 2 consecutive zeros?

Don't think of a recurrence relation like that. All it's saying is that the number of n-length ternary strings has some relationship with the number of (n-1)-length, and (n-2)-length ternary strings. You're not fixing a particular string. Obviously though, this only works for n>2, since a0 is undefined according to your problem.

Now to the actual problem...

juki_inla said:
Given solution:
String starting from 1--- an-1
String starting from 2--- an-1
=2*an-1
String starting from 01-- an-2
String starting from 02-- an-2
=2*an-2
String starting from 00-- an-2=3n-2

an= 2*an-1 + 2*an-2+3n-2

The first two look fine. However, the last one is not. You cannot follow 00 with an arbitrary valid ternary string. For instance, if you allow this, you can have 000_______, which is not valid. Try creating subcases for 00 and let's see what you get.

P.S. The way I interpreted the problem was that a valid word has only 1 pair of consecutive zero's, and no other rules. If this assumption is false, let me know.
 
Last edited:
gb7nash said:
1) an-1. Can I safely understand it as the previous term we are working with before we get an

Yes. Since in the first and second case you haven't violated any rules and placed a 0 right before the next slot, you can place any arbitary n-1 length valid ternary word, which is:
an-1.

2) How do we derive these an-1, an-2 and so on? Until when/which previous terms should I stop?

There's nothing to derive from here. Once you have the equation, you have the reccurrence formula. You stop when you find all the cases.

3) Does that mean that anytime we use the previous terms, the initial condition [whether given or not] we have to assume it is true? For in this case, an-1
is working already with a ternary string of 2 consecutive zeros?

Don't think of a recurrence relation like that. All it's saying is that the number of n-length ternary strings has some relationship with the number of (n-1)-length, and (n-2)-length ternary strings. You're not fixing a particular string. Obviously though, this only works for n>2, since a0 is undefined according to your problem.

Now to the actual problem...


The first two look fine. However, the last one is not. You cannot follow 00 with an arbitrary valid ternary string. For instance, if you allow this, you can have 000_______, which is not valid. Try creating subcases for 00 and let's see what you get.

P.S. The way I interpreted the problem was that a valid word has only 1 pair of consecutive zero's, and no other rules. If this assumption is false, let me know.

Wow, thanks for the reply!

Nope, have not learned generating functions before.

If I am not wrong, the problem allow for string as long as there were 2 consecutive zeros.

However, let me try to apply what I had understand based on your assumptions

If only 1 pair of consecutive zeros is allowed in the string,

We should have the only following cases:

an-3: 001, 002 = 2an-3
an-4: 1001, 1002, 2001, 2002 = 4an-4

an = 2an-1 + 2an-2 + 2an-3 + 4an-4

Will that be correct?
 
juki_inla said:
If I am not wrong, the problem allow for string as long as there were 2 consecutive zeros.

You might want to verify with your professor what it is. I was thinking about this problem somemore and depending on what it is, the problem can be easy or hard.

For example:

If the assumption is that you can have 1 pair of adjacent 0's and no other zeros anywhere, then the problem isn't that hard. e.g. 100231 is valid while 100203 is not.

If the assumption is that you can have any number of zeros, as long as one pair of adjacent zeros exist, then the problem isn't that hard either. e.g. 0000000 is valid.

If the assumption is that you can only have 1 pair of adjacent zeros, but can allow other zeros as long as they're not adjacent, then the problem is a bit more difficult. e.g. 00102320 is valid while 002003 is not.

I can't tell which one it is and I don't want to lead you the wrong way. If someone knows, I'm all ears.
 

Similar threads

Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
5K