00:01
So here we have where we're going to let a sub n represent the number of ternary strings.
00:16
Okay, and so ternary means 0, 1, or 2 rather than the binary, which is just a 0 or 1, that do not contain or are without consecutive zeros or consecutive ones.
00:30
And of course this is of length n.
00:39
Okay, so to encapsulate a sub -n, we'll do it in a few cases.
00:44
So first case is this string could start with a two.
00:49
Okay, then the remaining digits would be n -1 long, and there would be then a n -minus -one ways for that string to be without the double zeros or double -ones.
01:05
Alternatively, if it starts with a zero or a one, we could then consider the case where we have, say, the beginning has n minus 1 minus k, alternating zeros and ones, which are followed by a 2, and then is followed by then n minus k different strings.
01:45
Things.
01:48
Okay.
01:48
And so in this case, there are going to be a to the n minus n minus k ways to get a stream without the double zeros or double ones.
02:13
Okay, but we can reduce this a little bit.
02:15
This is just going to end up being a to the k.
02:19
But we need to consider, this would be the case where it's the zero, but the same thing for when it starts with a one, right? so, would also be a sub k.
02:28
So it's going to end up being two times a subk to represent where it starts as a 0 and alternates, so 0 -1, or the case where it starts with a 1 and alternates 1 -0 -1.
02:44
Okay, so our third case then is where we contain no 2s at all.
02:51
Okay, and in that case, it just alternates.
02:54
So it's either starting with a 0 and then going 1 -0 until n or or it goes one zero one zero all the way until n and there are exactly two ways for that occur which i just enumerated so a so a sub n is going to be equal to the sum of these three cases then right so that that a of n is equal to a of n minus one okay and to be clear this second case runs for k between zero and n minus 2 okay and why it goes up to n minus 2 right we we have put a 2 in here and we are also assuming that this first digit is either a 0 or 1 so that removes two elements from our length n uh so that is the maximum that it could be there okay so if that's the case then a sub n is equal to a and minus 1 plus 2 times a and minus 2 right so to do this for every value of k plus 2 times a and minus 3 all the way up to 2 times a not and then plus our last one here which is just a 2.
04:41
So we go to the next page because while what i wrote is our recurrence relation, it's not written in the most convenient form, right? so this requires us to sum up from every single previous case.
05:02
And if you are looking at large values of n, that could be pretty cumbersome.
05:14
I forgot some of the 2s in there.
05:16
A .0 plus 2.
05:17
Okay, so if we consider for n minus 1, if we just put n minus 1 in the place where you see ends everywhere, right? what we'd get is that a of n minus 1 is equal to a .n minus 2 plus 2 an minus 3.
05:42
So we're going to do a little bit of some sort of wizardry to get this simple, which i don't think.
05:51
Is really obvious.
05:54
So we're going to subtract the two equations from each other, right? so we'll, on the left -hand side, get a of n minus a -n -minus -a -n -minus 1.
06:05
But then on the right -hand side, by subtracting these two equations, we get something very simple...