Novice in Recurrence Relations

In summary, the problem asks for a recurrence relation between the number of ternary strings that contain 2 consecutive zeros. The equation is an-1=2*an-1+2*an-2+3n-2. To find the recurrence relations, you need to find all the cases and stop when you find them.
  • #1
juki_inla
2
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
  • #2
Have you learned about generating functions yet?
 
  • #3
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:
  • #4
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?
 
  • #5
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.
 

FAQ: Novice in Recurrence Relations

1. What is a novice in recurrence relations?

A novice in recurrence relations is someone who is new to the concept of recurrence relations, which are mathematical equations that define a sequence of numbers based on previous terms in the sequence.

2. What are the key components of a recurrence relation?

The key components of a recurrence relation are the initial conditions, which define the first few terms in the sequence, and the recurrence equation, which describes how to calculate subsequent terms based on previous terms.

3. How is a novice in recurrence relations different from an expert?

A novice in recurrence relations is someone who is still learning about the concept and may not have a deep understanding of its applications and implications. An expert, on the other hand, has a thorough understanding of recurrence relations and can apply them to various problems and scenarios.

4. What are some common applications of recurrence relations?

Recurrence relations have many applications in various fields, including computer science, physics, and biology. They can be used to model population growth, analyze algorithms, and solve differential equations, among other things.

5. How can I improve my understanding of recurrence relations?

To improve your understanding of recurrence relations, it is important to practice solving problems and working with different types of recurrence equations. You can also read textbooks and articles on the subject, attend lectures or workshops, and collaborate with other experts in the field.

Back
Top