Constructing geometric sequences
So I have the function g of x is equal to 9 times 8 to the x minus 1 power. And it's defined for x being a positive-- or if x is a positive-- integer. If x is a positive integer. So we could say the domain of this function, or all the valid inputs here are positive integers. So 1, 2, 3, 4, 5, on and on and on. So this is an explicitly defined function. What I now want to do is to write a recursive definition of this exact same function. That given an x, it'll give the exact same outputs. So let's first just try to understand the inputs and outputs here. So let's make a little table. Let's make a table here. And let's think about what happens when we put in various x's into this function definition. So the domain is positive integers. So let's try a couple of them. 1, 2, 3, 4. And then see what the corresponding g of x is. g of x. So when x is equal to 1, g of x is 9 times 8 to the 1 minus 1 power, 9 times 8 to the 0 power, or 9 times 1. So g of x is going to be just 9. When x is 2, what's going to happen? It'll be 9 times 8 to the 2 minus 1. So that's the same thing as 9 times 8 to the 1st power. And that's just going to be 9 times 8. So that is 72. Actually let me just write it that way. Let me write it as just 9 times 8. 9 times 8. Then when x is equal to 3, what's going on here? Well this is going to be 3 minus 1 is 2. So it's going to be 8 squared. So it's going to be 9 times 8 squared. So we could write that as 9 times 8 times 8. I think you see a little bit of a pattern forming. When x is 4, this is going to be 8 to the 4 minus 1 power, or 9 to the 3rd power. So that's 9 times 8 times 8 times 8. So this gives a good clue about how we would define this recursively. Notice, if our first term, when x equals 1 is 9, every term after that is 8 times the preceding term. Is 8 times the preceding term. 8 times the preceding term. 8 times the preceding term. So let's define that as a recursive function. So first define our base case. So we could say g of x-- and I'll do this is a new color because I'm overusing the red. I like the blue. g of x. Well we can define our base case. It's going to be equal to 9 if x is equal to 1. g of x equals 9 if x equals 1. So that took care of that right over there. And then if it equals anything else it equals the previous g of x. So if we're looking at-- let's go all the way down to x minus 1, and then an x. So if this entry right over here is g of x minus 1, however many times you multiply the 8s and we have a 9 in front, so this is g of x minus 1. We know that g of x-- we know that this one right over here is going to be the previous entry, g of x minus 1. The previous entry times 8. So we could write that right here. Times 8. So for any other x other than 1, g of x is equal to the previous entry-- so it's g of-- I'll do that in a blue color-- g of x minus 1 times 8. If x is greater than 1, or x is integer greater than 1. Now let's verify that this actually works. So let's draw another table here. So once again, we're going to have x and we're going to have g of x. But this time we're going to use this recursive definition for g of x. And the reason why it's recursive is it's referring to itself. In its own definition, it's saying hey, g of x, well if x doesn't equal 1 it's going to be g of x minus 1. It's using the function itself. But we'll see that it actually does work out. So let's see... When x is equal to 1, so g of 1-- well if x equals 1, it's equal to 9. It's equal to 9. So that was pretty straightforward. What happens when x equals 2? Well when x equals 2, this case doesn't apply anymore. We go down to this case. So when x is equal to 2 it's going to be equivalent to g of 2 minus 1. Let me write this down. It's going to be equivalent to g of 2 minus 1 times 8, which is the same thing as g of 1 times 8. And what's g of 1? Well g of 1 is right over here. g of 1 is 9. So this is going to be equal to 9 times 8. Exactly what we got over here. And of course this was equivalent to g of 2. So let me write this. This is g of 2. Let me scroll over a little bit so I don't get all scrunched up. So now let's go to 3. Let's go to 3. And right now I'll write g of 3 first. So g of 3 is equal to-- we're going to this case-- it's equal to g of 3 minus 1 times 8. So that's equal to g of 2 times 8. Well what's g of 2? Well g of 2, we already figured out is 9 times 8. So it's equal to 9 times 8-- that's g of 2-- times 8 again. And so you see we get the exact same results. So this is the recursive definition of this function.