# Worked example: using recursive formula for arithmetic sequence

## Video udskrift

- [Instructor] We are told b of one is equal to negative seven, and b of n is equal to b of n minus one plus 12, and they're asking us to find the fourth term in the sequence. So what we have up here, which you could use a function definition, it's really defining the terms of a sequence. Especially if are to input whole numbers in here, it's the index on your sequence. What we really wanna do is, we wanna figure out what is b of four going to be equal to? Well if we just blindly apply this, we would say all right b of four, so be of n, is equal to b of n minus one plus 12, so it's gonna be b of four minus one plus 12. Well four minus one is just three, so it's going to be equal to b of three plus 12. All I did is said okay, well we're not trying to figure out, or we're not immediately trying to figure out what b of one is. We're trying to figure out what b of four is, so n is equal to four, so b of four is going to be equal to b of four minus one, or b of three, plus 12. To evaluate this, we have to figure out what b of three is, so let's write that down. That's what's fun about a recursive definition. You have to keep recursing backwards, so b of three. Well if n is three, that's going to be equal to b of, now n minus one is two, b of two plus 12. We don't know what b of two is, so let's keep going. We need to figure out b of two. If we use the same definition, b of two is going to be equal to b of two minus one plus 12, so b of two minus one. That's b of one plus 12, but we don't know what b of one is, so let's figure that out. B of one is equal to, well here we can finally use this top clause, so b of one is equal to negative seven. Now we can go and fill everything back in. If b of one is equal to negative seven, then we know that this right over here is negative seven, and now we can figure out that b of two is equal to negative seven plus 12 which is equal to five. If b of two is equal to five, well then this is equal to five right over here, and then now we know that b of three is equal to five plus 12 which is equal to 17. If we know that b of three is equal to 17, then we're ready to calculate what b of four is going to be. B of four is now, it's b of three, which we figured out was 17 plus 12 which is equal to 29, and we are done.