 Welcome back to our lecture series, Math 31-20, Transition to Advanced Mathematics for Students at Southern Utah University. As usual, I'll be your professor today, Dr. Andrew Misseldine. We are in the middle of our discussion of the principle of mathematical induction, which was introduced in the lecture 19. Induction is all about proving the truth values for a sequence of statements. That is, if we have a statement for each natural number, induction allows us to approve that for every natural number, the statement holds to be true. We do this by looking at a base case, and then with our inductive hypothesis, we assume it holds for the kth position, and then we argue that the kth position implies that the k plus one position is also true, and hence, induction shows that it's true for all natural numbers. So induction is useful for proving sequences of statements to be true. And so in this lecture, I actually want to delve into this idea of a sequence leading to the notion of recursion, which is sort of like the other side of this induction statement. Induction, you typically start small and go big, as opposed to recursion, you sort of are big and then move backwards. And I'll make that more explicit in just a second. So let's first make sure we understand what a sequence is. A sequence is an infinite list of numbers, indexed by a set of natural numbers. Now, we've talked about lists before in this lecture series. Typically, we're talking about finite lists, which may have, they may be ordered, maybe they're unordered, maybe they have repetition, maybe they don't have repetition. This was an important problem for combinatorics, but a sequence is gonna be a list of an infinite list. So it goes on forever and ever and ever. And typically it'll be denoted, it'll be indexed by the set of natural numbers, but a subset of the natural numbers might be very appropriate. For example, instead of using the set of natural numbers, which includes zero, one, two, three, four, et cetera, maybe only indexed using the positive integers, because it could be that this number zero itself might be problematic, like if you look at the harmonic sequence, for example, but that doesn't matter too much. We just have a subset of natural numbers that index here, typically we start with zero, or one, depending on the circumstance there. And there's basically two ways that one typically describes a sequence, because after all a sequence, you can think of the mathematics of a pattern. Some, a pattern is established and we wanna describe that pattern. We wanna understand and study that pattern. And so the two ways that we typically describe a sequence is well, the first is that we'd have a general term. That is we have like a formula for the nth position of the sequence. So let me offer you a few examples here. Suppose we have the sequence right here, one comma one third, comma one ninth, comma one 27th, comma one over 81. So each of the terms in the sequence looks like it's one over a power of three. You could rewrite the first one as one over one, where of course one is the zero power, three is the first power, nine is the second power, 27 is the third power, 81 is the fourth power. So in general, we could describe the terms of this sequence as the nth power of one third, like so. And so we have a term for every natural number right there. And so this describes our general term, the generic term of the sequence looks something like that. Now I do wanna mention that this first sequence right here is an example of what we call a geometric sequence. Geometric sequences are extremely important sequences. You do some study of these in calculus, for example. And basically geometric sequence is kind of like a exponential function. The general term will look exponential for a geometric sequence. We can give another definition recursively later on, but we'll just stick with that right now. Consider the following, the next sequence right here, we could take the sequence negative one, one, three, five, seven, 11, 13. This is the sequence of odd integers for which we can describe the general term as two in minus one. This is actually an example of a more generic family, a more general family, what we call arithmetic sequences. Arithmetic sequences kind of are sequences that behave like linear functions. They'll have a formula that looks something like this, two in minus one. Now in this situation, I did start my sequence with the zero with term right here being negative one. If that was somewhat unnatural, it might make sense to just start with the n equals one and only look at positive integers because maybe we only want the positive, we only want the positive odd integers in that situation. But be aware that any sequence that starts with one up to a change of index could also start with zero and vice versa. So the difference between starting up one and starting at negative one is somewhat of an arbitrary distinction. It might change how the formula looks, but after all, if we were to change our sequence to do something like the following, cn equals two n plus one, like so. That would start at one, then three, then five, but then your index would be n equals zero, n equals one, et cetera. So if you want your sequence to start at zero, you can do so. If you want your index set to be the entire set of natural numbers, you can always do so. It honestly comes down to convenience at that point. Another sequence we could consider the sequence of squares, zero, one, four, nine, 16, 25, 36, 49, et cetera. The general term would just be n squared in such a situation. What about this sequence right here? E comma e squared over two, e cubed over three, e to the fourth over four, e to the fifth over five. When you look at that pattern right there, the first one could be rewritten to be e to the one over one. The general term would look like e to the n over n. And so this is definitely a situation where the index set makes more sense to be the positive integers as opposed to the entire set of natural numbers because as the formula requires division by n, really can't divide by zero. That would be problematic. But then of course, like I said before, we could always rewrite this. So instead of that, our formula could look like e to the n plus one over n plus one. That way n could be drawn from any natural number, zero included. Now of course, it makes the formula a little bit more complicated, but it then allowed us to start at zero. So that really comes down to style at that point, right? Do I want to do the whole set of natural numbers and have a slightly more complicated formula or do you want a more simpler formula and just have a more restrictive index set? It's perfectly fine. You can do either one, not a big deal. And then one other example here, let's take an example of what we call an alternating sequence because the signs change between positive, negative, positive, negative, positive, negative. So it was positive, negative, positive, negative, positive. So here we have the alternating harmonic sequence right here. The harmonic sequence is the sequence of terms of the form one over n. And again, generally, that'll be indexed by just the positive integers because we don't want to divide by zero. It's alternating because it has this negative factor in there. So negative one to a power. But this is where things get a little bit awkward here. If you want to start being positive and then move to negative or depending on, you might have to have an n plus one as opposed to an n. Remember that even powers of negative one are positive and odd powers of negative one are, odd powers are negative. And so if you want the series to start, the sequence to start with a positive term, but your index is odd, you have to switch it to an even number. And so that can make it a little bit awkwardness, but we can deal with it no big deal. So again, I wanted to mention this alternating sequence has an important family of sequences worth mentioning. Many of these we probably have seen in previous classes, maybe like calculus too, for example, it's a common place where these sequences might have found the light of day. Now, the general term is a really good way of describing a sequence, but it turns out another very useful way of describing a sequence is the notion of recursion. That is we can define a sequence recursively. A recursive sequence means that the terms in a sequence are actually determined by previous terms. So predecessors help you determine what the elements of a sequence are gonna be. So let me give you an example of such a recursive sequence. For which case, let's take a sequence. We're gonna write the first couple of terms in the sequence. We're gonna take S sub zero and we're gonna say that's equal to one. You can think of this as the seed of the recursive sequence. Sometimes people refer to it as the initial case, the initial term. Another term that's very common to use here, especially with its respect to induction, this can be referred to as the base case. Like I said, at the beginning of this video, recursion and induction are basically doing the same thing, even though they look a little bit differently. And as such, you have to have some initial value to get the sequence started. And this serves as the same reason that we checked the base case and an induction proof right here. So you have some initial value, some base case that you have to deal with. And so this tells you how the sequence gets started. And then you have some type of, what we call recursive relation. So an equation that tells you how the next term in the sequence is defined using its predecessor. So when you're at the nth term of the sequence, you compute this by taking four times the previous term in the sequence. So if I wanna start listing terms in the sequence, I can do so. The first term should be pretty easy because it was given to us explicitly. So S sub zero is equal to one. Now to compute S one by the recursive formula, what we do is we're gonna take four times S zero. Now S zero was itself one. So you get four times one, which is equal to one. Then for the next term S two, this is computed as four times S one. As we just computed S one is itself four, four times four is equal to 16. So that's the next term in the sequence. If I want to do S three, S three is equal to four times S two, which S two was 16. Four times 16 is then gonna equal 64. And if we do one more of these, S four is equal to four times S three. S three was 64. So we're gonna get four times 64, which gives us 256. Now at this point in the sequence, we might be starting to recognize a pattern. Because when I look at these terms, one, four, 16, 64, 256, these appear to be powers of four. You have the zero with power of four. I should say, sorry, this is the zero with power of four. This is four to the first. This is four squared. This is four cubed. This is four to the fourth. And so it's very reasonable to conjecture that the general form of this sequence is SN equals four to the N. And one can actually prove such a thing. This is an example of a geometric sequence, again. And it turns out that geometric sequences can be defined recursively. Because if you take this recursive relation right here and rewrite it, what this tells you is that SN divided by SN minus one is equal to four. And this is often referred to with the geometric sequence as the common ratio. So a geometric sequence is typically defined recursively. And so that the ratio of consecutive terms in this geometric sequence is always the same number. Hence why we call it the common ratio. And so this sequence always grows by a factor of four. And that's gonna have the consequence that you can argue that if it recursively always grows by a factor of four, you're gonna have this exponential growth right here. And this gives us an example of a geometric sequence. And so a sequence could be defined recursively, but it's possible that you can change from recursive definition into a, probably not that one, into a general term. And that can be very useful because the major hiccup about recursion is that if I wanna calculate the 100th term of my sequence, well, sure it's gonna be four times the 99th term. But if I don't know that yet, I'm gonna get four times the 98th term. In some respects, you have to move backwards. Like that's what I was saying earlier. If you're at the 100th term, you have to then calculate the 99 term, the 98, 99, 97. You have to know all these previous terms in order to calculate the 100th term if you do it recursively. Of course, if you have a general formula, then we know that the 100th term will just be four to the 100th power. We don't need all the predecessors if we have the general term. But again, it does make sense to use a recursive sequence here because it depends on the previous term, sort of like a dynamical system. The next term is dependent upon its previous term. Let's look at another example of recursive sequence that we've actually explored already in this lecture series. Let's take, for example, the factorial sequence. We defined it using the term inology. Well, we first said that zero factorial is equal to one. That sort of felt like an exception because the general formula was something more like the following in factorial equals n times n minus one times n minus two. And then you continue down all the way down to three times two times one. And so we had to treat zero factorial as if it was somewhat different because this formula didn't seem to apply. You can't take all the product of numbers from zero down to one. You have to go up to one from zero. But it turns out the factorial sequence has a very natural recursive formula. Zero factorial equals one, like we mentioned. And then for the general term, what you do is you take n factorial and that's equal to n times n minus one factorial. So you just take n times the previous factorial there. And so if we were to compute terms in this sequence, well, you get zero factorial, which is equal to one. That's our base case. You get one factorial. By the recursive formula, this is gonna be one times zero factorial. Zero factorial is one. So you get one times one, which is one. Then for the next one here, two factorial. This by recursion is two times one factorial. One factorial is equal to one. So you end up with a two right there. If we do three factorial, this is the same thing as three times two factorial. Two factorial, of course, is equal to two. And so we get three times two, which is equal to six. Let's do a few more here. Four factorial is the same thing as four times three factorial. Three factorial is equal to six, in which case four factorial is 24 in that situation. We'll do one more example here. Five factorial, recursively five factorial is the same thing as five times four factorial. Four factorial turned out to be 24. And five times 24 is then 120. And so, yes, the factorial sequence itself is recursive. And we can often go back and forth between a recursive version of a sequence and a non-recursive version. There are advantages and strengths and disadvantages to both the approaches. All right, I probably want to refer in this video, definitely. I want to refer to the most famous of all recursive sequences. And this is what's known as the Fibonacci sequence. So the Fibonacci sequence is important for many reasons, but for our purposes, there's actually a cool thing about the Fibonacci sequence. Unlike the other sequences we've seen so far, the Fibonacci sequence actually has two base cases. So we have F zero is equal to zero. We also have that F one is equal to one. And we take those two base cases. And why do we need two base cases here? And it turns out for the Fibonacci sequence, the recursion in play here actually depends on the two immediate predecessors. So if we want to calculate the nth term of the Fibonacci sequence, we actually take the sum of the n minus one term and the n minus two term. So we take the sum of the two previous Fibonacci numbers and that then gives you the next Fibonacci number here. And that's why we need these two base cases because I need zero and one established so I can do two. Two will be the sum of F zero, F one. And so let's see exactly that. So using this recursive relation, we can then compute the first couple terms of the Fibonacci sequence. So the F zero term we definitely should be able to get because it was provided to us. Likewise F one, there's no failure we can make there because we don't have to compute anything that was told to us, but what about F two? Well, like I mentioned earlier, F two is going to equal the sum of F one plus F zero for which F one was one, F zero is zero. So the sum in which case is one, okay? F three, F three by definition is F two plus F one. And so we end up with two plus one, which is equal to three. We get F four, which is F three plus F two. So we end up with three plus two, which is equal to five. F five would equal F four plus F three, which is equal to five plus three, which is equal to eight. And with this, we can keep on going and going, F six is in the sum of the previous two terms. We get eight plus five, which is equal to 13 in that situation. We can do F seven, F seven is going to equal 13 plus eight, which is going to give us 21. And we can keep on going and going and going. If we look at the terms in our sequence, we get zero, one, one, two, three, five, eight, 13, 21. These are the ones we've done so far. The next one, you would take 21 plus 13, which is 34. You would then, for the next one, you would take 34 plus 21, which is 55. You would then get for the next one, you would take 55 plus 34, which is 89. And for the next one, you would take 89 plus 55, which is 144. And you would keep on going and going and going. And so the Fibonacci sequence, it's very famous for lots of reasons. One, for example, it's connection to the golden ratio. And again, there's a lot of interesting applications to applications of the Fibonacci sequence, none of which we'll go into right now in this conversation right here. But this Fibonacci sequence has this very simple, very simple recursion involves two of the previous terms, like I said, very famous sequence. Now, if you're more curious, is it possible to come up with a non-recursive formula for the Fibonacci sequence? It turns out you can. The method of developing this formula, this is known as Binier's formula, goes beyond the scope of this lecture series. But it turns out you can show that the nth term of the Fibonacci sequence is equal to one plus the square root of five over two raised to the nth power. Just so you're aware, this number right here is that golden ratio that I mentioned earlier. This shows you one of the connections. Then you have to subtract from it the conjugate of the golden ratio also raised to the nth power and then divide that thing by the square root of five. And so it's like, wow, that's a pretty fun number right now. I mean, this is an irrational number. This is also an irrational number. This is an irrational number. And sure enough, as you start taking this to natural number exponents, this will always turn out to be whole numbers and in fact reproduces this sequence right here. In some situations, the general formula might be so complicated that it's actually not as practical as the recursion itself. Now by all means, if you're looking for like F to the, you know, very large power, right? Like 10,000 or something like that. Maybe this would be advantageous to you but also the recursion sounds so bad after all. But like I said, Binier's formula right here, how one actually proves this, we're not gonna spend much time talking about it but be aware that finding the general formula of a recursive sequence in general can be a very difficult thing. But honestly, how does one prove anything about a recursive sequence at all? Cause after all, if each of these terms depend on their predecessors, how can I say anything about the general term if I don't know anything about the predecessors? Well, we have to investigate who the predecessors are, what properties they are there. And this is actually where we connect to what we've been talking about. Proving things about recursive sequences typically comes down to induction because much like an induction proof, a recursive sequence has the similar structure. We have some type of base case or base cases if there's multiple things. And then this recursion is kind of like our inductive step there that if we know something about the predecessors, we know the predecessors have the property, then the recursive relation then means that that property is then given to the next term of the sequence as well. So let me show you an example of such a thing. Let's provide a proof by induction of a property about the Fibonacci numbers. So consider the following sum. If you take the sum of F1 plus F2 plus F3 all the way up to Fn, this is equal to Fn plus two minus one. So these each F's are the Fibonacci numbers. So if you take the first Fibonacci number plus the second Fibonacci number plus the third Fibonacci number, add that up to the nth Fibonacci number. That is to say, if you take the sum of all the Fibonacci numbers up to Fn, that's actually equal to the n plus second Fibonacci number minus one. You'll notice in this sum I omitted the F0 here. That's because it's zero itself. But if you feel dissatisfied by that in my sum, I did include k equals zero. So it's in there, but clearly adding zero doesn't do much. We can very easily prove this by induction about the Fibonacci sequence here. So note, we wanna check the base case. So I'm gonna check the case when in itself equals zero. So if you take the sum where k ranges from zero to zero of F sub k, the only term you get there is F0, which of course is equal to zero. On the other hand, if you take Fn plus two minus one, if n equals zero, you're looking at F2 minus one. As we showed previously, F2 is itself one, one minus one is equal to zero. And so this proves the base case that this sum property does start somewhere. It starts at k equals zero. So for the sake of induction, we're gonna assume that the sum of F1 through Fk is equal to Fk plus two minus one. That's our inductive hypothesis. Now we wanna consider what happens if we take our sum and we add up F1 all the way up to Fk plus one. Fk plus one is the term after Fk. Fk is where we made our assumption for the sake of induction there. Now, because of the previous inductive hypothesis there, we know that the sum of the first k terms is equal to Fk plus one, Fk plus two minus one, excuse me. And so we can reduce that formula or that is we can apply the inductive hypothesis to get this equality right here. But then I'm gonna rearrange terms. So I'm gonna put Fk plus one plus Fk plus two minus one. So stick the negative one by itself and put the two Fibonacci numbers together. Now wait a second, I have two Fibonacci numbers. These are consecutive Fibonacci numbers by the recursion of Fibonacci numbers. Fk plus one plus Fk plus two is equal to Fk plus three. And let me emphasize here that Fk plus three, K plus three is actually K plus one plus two. So for the instance of K plus one as our index, this then satisfies the formula. We've completed the inductive step and therefore the formula follows by induction. And so what I've been wanna illustrate here with this Fibonacci sequence and this proof is that recursion and induction basically are the same thing. They're two sides of the same coin. We can define sequences using recursion and we can improve things about that recursion using induction. So anytime someone does something with recursion, they're using the principle of mathematical induction, whether they know it or not. And anytime you do anything with induction, you honestly could change it into an argument using recursion. The two notions from the mathematical point of view are completely equivalent, recursion and induction.