Finding a recurrence relation

In summary: In sum, it is a nice tool to have in the kit of anyone writing mathematics, even if you are not planning to teach, and it is the language of choice (along with Mathematica) used by the professional community.
  • #1
toothpaste666
516
20

Homework Statement


a) Find a rec. rel. for an, the number of sequences of length n formed by u's, v's, and w's with the subsequence vv not allowed.
b) Repeat part a) but now with the requirement that there is no subsequence uwv.

The Attempt at a Solution


a) the first letter in the sequence can be a u and then the rest of the sequence can be formed in an-1 ways, it can be a v with the rest of the sequence formed in an-1 ways or a w with the rest in an-1 ways. so an = an-1 + an-1 + an-1 = 3an-1 . But we haven't dealt with the restriction yet. we need to remove the ways where the sequence vv appears. which is choose the two v's and the rest of the sequence is formed in an-2 ways. so
an = 3an-1 - an-2

I am pretty sure this is right but the course website says the answer is an = 2an-1 + 2an-2 and I can't figure out why

b) this time we subtract off the ways that contain uwv. to find this number choose uwv and the rest of the sequence can be formed in an-3 ways so
an = 3an-1 - an-3

this one is apparently correct.
 
Physics news on Phys.org
  • #2
toothpaste666 said:
we need to remove the ways where the sequence vv appears. which is choose the two v's and the rest of the sequence is formed in an-2 ways. so
an = 3an-1 - an-2

I am pretty sure this is right but the course website says the answer is an = 2an-1 + 2an-2 and I can't figure out why
The website is correct. Some of the sequences that are removed when you deduct a(n-2) sequences have already been removed because they have 'v' in position 2 and 3.
I think it's easier to do by adding (number of valid n-long sequences starting with u) + (number of valid n-long sequences starting with w) + (number of valid n-long sequences starting with v)

where 'valid' means 'containing no 'vv' subsequences.
 
  • Like
Likes toothpaste666
  • #3
For (a), I think you have the right idea by fixing the first letter. Take a sequence of length ##n## with no vv subsequence.
If it starts with either u or w, then the rest of the word is a sequence of length ##n-1## that have no vv subsequence
If it starts with a v, then the following letter is either u or w, and the rest of the word is a sequence of length ##n-2## that have no vv subsequence.
Adding these cases together, you get ##a_n = 2 (a_{n-1} + a_{n-2})##
 
  • Like
Likes toothpaste666
  • #4
I see others have already responded, but here's how I got that the course website was right. We agree there are 2an-1 strings if you use a u or a w as the first letter you are tacking on. But if you want to tack on a v, you cannot have a v as the first letter of the n-1 string, so you must ask an independent question-- how many strings of length n-1 do not start with v and do not have vv anywhere in them? So that means look back to the n-2 strings and count all those up, and tack on either a u or a w, so that means you have 2an-2 of those. So 2an-1 + 2an-2 is correct.

Part (b) seems straightforward, does it not?
 
  • Like
Likes toothpaste666
  • #5
toothpaste666 said:

Homework Statement


a) Find a rec. rel. for an, the number of sequences of length n formed by u's, v's, and w's with the subsequence vv not allowed.
b) Repeat part a) but now with the requirement that there is no subsequence uwv.

The Attempt at a Solution


a) the first letter in the sequence can be a u and then the rest of the sequence can be formed in an-1 ways, it can be a v with the rest of the sequence formed in an-1 ways or a w with the rest in an-1 ways. so an = an-1 + an-1 + an-1 = 3an-1 . But we haven't dealt with the restriction yet. we need to remove the ways where the sequence vv appears. which is choose the two v's and the rest of the sequence is formed in an-2 ways. so
an = 3an-1 - an-2

I am pretty sure this is right but the course website says the answer is an = 2an-1 + 2an-2 and I can't figure out why

b) this time we subtract off the ways that contain uwv. to find this number choose uwv and the rest of the sequence can be formed in an-3 ways so
an = 3an-1 - an-3

this one is apparently correct.

Please either use parentheses or the subscript facility found in the menu ribbon at the top of the input page. As written you have said ##a_n = 3 a_n - 1##, which cannot be what you mean. If you mean
a(n) = 3 a(n-1), you need parentheses, just like I have written; alternatively, you can use the "##x_2##" button at the top of the input panel to get an= 3an-1.

It is vital that you get in the habit of doing this, because there will be cases in which you have something like ##a_n = 2 a_{n-1} - 1##, and if you write that the way you have been doing up to now it would read as an = 2 an-1-1, which of course, means that ##a_n = 2 a_n - 2##, which is not what we want.
 
  • Like
Likes toothpaste666
  • #6
Thank you everyone

I just want to test the subscript feature
an-1
 
  • #7
toothpaste666 said:
Thank you everyone

I just want to test the subscript feature
an-1

Good. Even better would be to learn LaTeX, which has a partial implementation in this forum. It is faster and easier to use than the "formula/symbol" ribbon at the top of the input page, and it produces much prettier results: ##a_{n-1}##, for example. Another nice aspect is that there are extensive free packages available on-line for downloading to your own machine; I use MikTeX, but many people use LyX (which is almost like using MS Word, but produces LaTeX files and compiles and typsets using the TeX package).
 

1. What is a recurrence relation?

A recurrence relation is a mathematical relationship that describes how a term in a sequence or a function depends on its previous terms. It is typically used to recursively define a sequence or function.

2. Why is finding a recurrence relation important?

Finding a recurrence relation is important because it allows us to express a sequence or function in a concise and recursive form, making it easier to compute and analyze. It also provides a deeper understanding of the underlying mathematical patterns and relationships.

3. What are some common methods for finding a recurrence relation?

Some common methods for finding a recurrence relation include using guess and check, using a table to find patterns, using algebraic manipulation, and using a recursive definition.

4. Can a recurrence relation only have one solution?

No, a recurrence relation can have multiple solutions. In fact, there can be infinitely many solutions for a given recurrence relation. It is important to specify additional constraints or initial conditions to find a unique solution.

5. How do you determine the initial conditions for a recurrence relation?

The initial conditions for a recurrence relation can be determined by using the first few terms of the sequence or function and plugging them into the recurrence relation. These initial conditions will serve as the base cases for the recursive definition.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
261
  • Calculus and Beyond Homework Help
Replies
4
Views
313
  • Calculus and Beyond Homework Help
Replies
6
Views
954
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
Replies
8
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
602
  • Calculus and Beyond Homework Help
Replies
1
Views
715
  • Set Theory, Logic, Probability, Statistics
Replies
13
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
2K
Replies
3
Views
2K
Back
Top