Results 1 to 8 of 8

Math Help - Recurrence relation problem

  1. #1
    Newbie
    Joined
    Dec 2008
    Posts
    8

    Recurrence relation problem

    Find a recurrence relation for the number of ternary strings (0 s, 1 s and 2 s) of length n that contain none of the strings 101, 202, 102, or 201. What are the initial conditions? Use the recurrence to compute the number of such sequences of length 5.

    I am trying this for the past 7 days. Please help me in solving this. help would be greatly appreciated.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by kkkkkk View Post
    Find a recurrence relation for the number of ternary strings (0 s, 1 s and 2 s) of length n that contain none of the strings 101, 202, 102, or 201. What are the initial conditions? Use the recurrence to compute the number of such sequences of length 5.
    Let a_n be the number of such strings of length n. Now think about how to construct a string of length n+1 by taking such a string, call it s, and adding an additional number at the end of s. If s ends in a 1 or a 2 then we can add any of 0,1,2 and still have an allowable string. But if s ends in a 0 we need to look at the last two elements of s. If they are 00, we can add anything and still have an allowable string. But if s ends in 10 or 20 then we have to add a 0 as the (n+1)th element.

    Another way to say that is that we can add a 0 to any string and still have an allowable string. But we have to be more careful about adding a 1 or a 2.

    So the number of strings of length n ending in a 0 is a_{n-1} and therefore the number ending in a 1 or a 2 is a_n-a_{n-1}.

    Now, how many strings of length n+1 are there? For each of the a_{n-1} n-strings ending in a 0 we can get three (n+1)-strings. For each of the a_{n-2} n-strings ending in 00 we can also get three (n+1)-strings. But for each of the a_{n-1} - a_{n-2} n-strings ending in x0 (where x = 1 or 2) we can only get one (n+1)-string. Take that information and make it into a recurrence relation.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Dec 2008
    Posts
    8
    thankyou for your great help

    I would appreciate it.

    But Finding the recurrence relation was a great difficulty. So, can you suggest me the sequence so that I can make a recurrence relation because I couldn't follow the sequence.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member
    Joined
    Oct 2008
    From
    Singapore
    Posts
    160
    Just to add : The initial conditions are :
    a1 = 3
    a2 = 9
    a3 = 23
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Dec 2008
    Posts
    8
    thanks for u r help. But I couldn't establish the recurrence relation. I tried some. They were working for 1 and 2 but not from 3. So, suggest a recurrence relation that would work for all
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Member
    Joined
    Oct 2008
    From
    Singapore
    Posts
    160
    If i am not wrong the recurrence relation is a_n = a_{n-1}+4a_{n-2}+2a_{n-3}.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by tester85 View Post
    If i am not wrong the recurrence relation is a_n = a_{n-1}+4a_{n-2}+2a_{n-3}.
    The relation I arrived at (following my previous hints) is a_n = 3a_{n-1}-2a_{n-2}+2a_{n-3}. With the initial conditions a_1=3, a_2=9, a_3=23, that gives the prediction a_4=57, which agrees with what I get by a direct count.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    Dec 2008
    Posts
    8
    thank u very much for u r help. I will appreciate it greatly.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Recurrence relation problem
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: November 8th 2011, 07:45 AM
  2. recurrence relation problem!
    Posted in the Discrete Math Forum
    Replies: 6
    Last Post: May 9th 2011, 05:54 PM
  3. Population recurrence relation problem.
    Posted in the Discrete Math Forum
    Replies: 5
    Last Post: January 14th 2011, 05:08 AM
  4. Recurrence Relation Problem...
    Posted in the Discrete Math Forum
    Replies: 5
    Last Post: October 10th 2010, 03:41 PM
  5. Recurrence Relation problem (URGENT)
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: May 20th 2010, 04:04 PM

Search Tags


/mathhelpforum @mathhelpforum