 Welcome to the screencast on recursively defined sequences. So we're going to be working with a particular mathematical object in this section called a sequence. So let's define what that is. In math, a sequence is just an infinite list of numbers that's written in order. So it's a very simple structure, but can have some interesting properties. For example, look at this first example here. The sequence 2, 4, 8, 16, 32, and so on forever. We use a sub n here to refer to the nth term. For example, this would be a1, the first term. That's a2, the second term, a3, a4, a5, and so on. So what we often want to do in working with sequences is describe what the nth term looks like. This one is pretty easy actually, if you think about it. The first term is 2, the second term is 4, the third term is 8, the fourth term is 16. It's pretty quick to see that the pattern here is that a sub n is 2 to the nth power. And that's a nice little closed form expression that just simply, you put in the n and it spits out what the nth term of the sequence is going to be. For example, a10 is going to be 1024. Sometimes we don't get as easily described of a sequence as we can. Like check out the second one here. a1 is 3, a2 is 3.1, a3 is 3.14, a4 is 3.141, there's a5, a6, and so on. So what is the nth term? It's kind of hard to describe that as a formula, but it's very easy to describe this in words. a n is simply the number pi taken out to n minus 1 decimal places. To n minus 1 decimal places. So that is a description of the nth term without exactly being a formula as such. And that's okay. Now let's take a look at a problem that's going to motivate a specific kind of sequence that's going to be quite easy to work with using our notions of induction. And this actually comes from every parent has gone through this before. You have a sick kid running a fever and so what you do is you give them acetaminophen. That's a drug that we all take for fevers and pain relief. It says on the box that a sick kid of this child's weight and age should get 320 milligrams of acetaminophen every four hours. During that four hour period, 80% of the medicine in this particular child is metabolized out of the child's body, so 20% remains. So how much medicine is left in the child's body after five four hour periods and that's pretty helpful to know. Let's suppose just to simplify things that there's only one dose given at the very beginning here and we're just going to let that sit through the child's body without giving any extra medicine. So without actually obeying the rules here, we're not going to actually give the child medicine every four hours. You're just going to give the kid one dose and see what happens. If a kid gets one dose of 320 milligrams of acetaminophen after five four hour periods is 20 hours, how much is going to be left? Well let's go off to some blank pages here and see what we have. So at the very beginning, after no four hour periods have passed, the child has 320 milligrams of acetaminophen in her system because that's the initial dose. So I'm going to keep track here. Here's the amount that's remaining and here I'm going to put after how many four hour periods have passed. After no four hour periods have passed, there has been no metabolization. I still have 320 milligrams. Now after one four hour period has passed, after one four hour period, how much is left over? Well, according to the problem statement, there's 20% that's left over. So 320 times 20%, that's 0.2, is 64 milligrams. So if we don't give any more medicine, which is the assumption that we're making here, after one four hour period, the child has metabolized out 80% of the drug but retains 20% and that's this much, 64. After another four hour period, after two four hour periods, let's abbreviate there, how much is left? Well it's going to be 20% of what was previously remaining, 20% of that 64, so 64 milligrams and 20% of that is going to remain, that's 12.8 milligrams. After three four hour periods, how much is going to be left? Well, 12.8 times 20%, 20% of whatever was there in the first place, that's 2.56 milligrams. We're almost there, after four four hour periods, how much is left? Well, again, we're going to take the amount that was left, whatever was left at the end of the previous four hour period, that's 2.56 milligrams and multiply that by 20% because that's according to her specs, according to her weight, that's what she keeps. So that's 0.512 milligrams and finally, at the end of the fifth four hour period, we're going to have 0.512 times 20% left and that's finally, the answer here is 0.1024 milligrams. So basically, virtually nothing left in her system after that point, which is why under normal conditions, you would keep giving the kid medicine every four hours because it would boost her levels of Tylenol. Sorry, acetaminophen, I think I back up into her bloodstream. But if you didn't administer any more drug during this time, that's how much would be left over. Now, what I want to point out here is not so much the answer to the question but the method by which we got it. What we were doing each time to get the new amount of drug left over, say this 12.8, we were taking the previous amount of drug left over and multiplying by 20%. And every time, we kept multiplying the previous amount left over to get the new amount and that was sort of the rule here. It wasn't so much a formula that tells me I could just plug in five and find out what the answer is. But I have a rule or process that allows me to calculate the amount left over at any current time period based on how much was left over in the previous time period. Now, if that sounds like induction to you, you're on the right track here. So I just want to bring this down to some closure. This is what's known as a recursively defined sequence. The notion of recursion and the notion of induction kind of go hand in hand. Induction we know is a proof technique that allows us to prove problems in terms of previous and simpler versions of themselves. Recursion is a similar technique, it sort of more applies to calculations. So you could say here that we've created a sequence where A0, the amount left over after zero time periods have passed is 320. And then An, the amount left over after a current time period, is defined by taking the previous time period and multiplying by 0.2. So that's what we call a recursively defined sequence. Every term in the sequence except the first one, sort of a base case. The base case is given to us straight out, but every other term in the sequence is defined in terms of the previous item in the sequence. So that's what we mean by recursively defined sequence. So let's see how well you're understanding recursively defined sequences with a quick concept check. So let's suppose that we're going to define a sequence recursively by declaring A1 to be equal to 1, and then A sub n, every other nth term, as long as for n bigger than or equal to 2, every other term in the sequence is defined by n times An minus 1. So with that, what is the value of A7? Work this out and pause the video while you're doing it. And then come back when you have a result. So the answer here is going to be the very last one, 5,040. And to see that, let's just kind of try to crank through this. Well, let's go all the way up here. We need some room. So A1 is declared to be equal to 1. A2, according to the formula here, A2, let's pretend the n is a 2. That would be 2 times A sub 2 minus 1. So that would be 2 times A1. That's 2 times the previous value. So that would be 2 times 1, which is 2. A3, according to my formula, would be 3. See, there's an n there, times A sub 2. And that would be 3 times 2, because A2 is right up here. And 3 times 2 is 6. So what is A4? That would be 4 times A3. And that would be 4 times 6. That's 24. A5 is 5 times A4. And that would be 120. I'm running out of room, so I'm going to go up here to the top. A6 would be 6 times A5. And that would be 720. And then finally, we get our final result. I'll put it down here in the white. A7 is 7 times A6. And that would be 7 times 720. That's 5,040. So according to the rule for the sequence, the first term is defined for me. But every other term from the second term on up is given by taking the subscript and multiplying it times the previous term in the sequence. So that's a recursively defined sequence. So in the next video, we're going to look at a sequence that's defined by two conditions. And that motivates a very important and famous sequence of numbers. Stay around, and thanks for watching.