Alternating series test. [SOUND] Alternating series and it turns out that there's a particularly nice criterion for when they converge. So here's what normally goes by the name the alternating series test so the setup of this is as follows I'm going to suppose that I've got a sequence. The terms are decreasing and all of the terms are positive. And the limit of the nth term as n goes to infinity is 0. So these are the assumptions. And then in that case, I may conclude that this alternating series that I build from the sequence a sub n by multiplying by minus 1 to the n plus 1 power. This alternating series converges. Alternating series form a class of series for which the limit test is practically the whole story. So given these conditions, if the limit of a sub n is 0, then this series converges. But we already know by just the limit test that if the limit of the nth term of this series, remember, is non-zero, then the series diverges. But to say that this limit is non-zero is exactly the same thing as saying that this limit either doesn't exist or is non-zero. So, alternating series are a situation where just determining the limit of the nth term, or at least the absolute value of the nth term, tells the whole story. If that limit is 0, then the series converges, and if that limit's non-zero, then the series diverges. Now, you already know that the if the limit of the nth term is not 0, the series diverges. So, in this case, what do I have to show? So this is the statement that I want to prove. I start with some sequence which is decreasing. All the terms are positive. The limit of that sequence is 0. I want to conclude that this series, this alternating series, converges. Well what does that even mean? What does it mean to show that this series converges? Right, I just have to remember the definition of this is really something about the limit. All right, it's to say that the limit of this partial sum, the sum k goes from 1 to n of minus 1 to the k plus 1 times a sub k, this sequence of partial sums should converge and I'll usually denote that n partial sum by just, s sub n. Well let's look more carefully at these partial sums. So let's look at the first few terms of the sequence of partial sums, right? What happens when I just plug in a few values of n here? What do I get? Well, when I plug in n equals 1? It's not too interesting, right? It's just the sum of the first term, which is just a sub 1. When I plug in n equals 2, that's a little bit more interesting, right? That's the sum of the first two terms, which is a sub 1 minus a sub 2. Why is the minus in there? When I plug in k equals 2 here, I get negative 1 to the 3rd times a sub 2. Negative 1 to the 3rd is minus 1. So that's introducing a negative sign in front of the a sub 2. So this is a sub 1 minus a sub 2. What's the third partial sum? Well the third partial sum is a sub 1 minus a sub 2 plus the next term in the series which is minus 1 to the 4th times a sub 3, it's plus a sub 3. What's the fourth partial sum? Well that's a sub 1 minus a sub 2 plus a sub 3 minus a sub 4. I mean, it's maybe we're not getting a lot of intuition here. The fifth one is a sub 1 minus a sub 2 plus a sub 3 minus a sub 4 plus a sub 5. It's a little bit hard maybe to tell what's going on. So, instead of just looking at these numbers, I could try to look at these partial sums on a number line. And the key fact to remember here is that these a sub n's are decreasing, so in something like the fifth partial sum, a sub 2 is smaller than a sub 1, a sub 3 is smaller than both of these still. Right? That's going to help us to draw a nice picture of what these partial sums look like on the number line. So the first partial sum, you know? Who knows where it is? It's just a sub 1 and it's somewhere on the number line. But then to get from that first partial sum to the next partial sum to get from s of 1 over to s of 2, all right? I just subtract a sub 2. So here I am subtracting a sub 2, and that lands me over here at the second partial sum, right, because s sub 2 is a sub 1 minus a sub 2. Well, how do I get to the third partial sum? Where is the third partial sum? Well, to get to s sub 2 to s sub 3, I just add a sub 3. And the key fact here is that a sub n is decreasing so the amount that I'm moving to the right with a sub 3 is less than the amount that I was moving to the left with a sub 2. So maybe here is s sub 3, the third partial sum. And then to get from s sub 3 to s sub 4, I have to subtract a sub 4, but again, the sequence a sub n is decreasing, so a sub 4 is smaller than a sub 3, so I'm moving less to the left than I was to the right to go from s sub 2 to s sub 3. So now I subtract a sub 4, and I land here at s4, the fourth partial sum. And to get to s sub 4 to s sub 5, I'd be adding a sub 5, but a sub 5 is even smaller than a sub 4. So maybe that's somewhere over here. What do I notice? Well, what I'm noticing here is that the even partial sums, s sub 2 and s sub 4 are increasing. And the odd partial sums, s sub 1, s sub 3, s sub 5, they're decreasing. I can be a little bit more precise, right? This sequence, the sequence s sub 2 n minus 1 is decreasing. This sequence, s sub 2 n, is increasing. So these two sequences are monotone. The s sub evens is increasing, but bounded above by s sub 1. And the s of odds are decreasing, but bounded below by, say, s sub 2. So I've got monotone and bounded sequences. So by the monotone convergence theorem, the sequence of even partial sums is increasing and bounded above, and therefore the limit exists. And by the monotone conversion theorem the sequence of odd partial sums is decreasing but bounded below, and consequently the limit of s sub odd exists. Well, that's awesome, or not. What did I actually want to prove? Well, I actually wanted that the limit of just the partial sums exists, I mean, I don't, I don't really care about the sequence of even partial sums and the sequence of odd partial sums. I just want to know what the sequence of partial sums, does it have a limit? So how do I know that the odd and the even sequences converge to the same thing? So what I know is that the limit of the even partial sums exist and the limit of the odd partial sums exists. But I just want to know about the limit of the partial sums all together, right? The even terms are getting close to something, the odd terms are getting close to something but are all the terms getting close to something. Well to analyze this, I'm going to look instead at this limit, I'm going to look at the limit of the difference of the even and the odd partial sums and there's two different ways to calculate this limit. On the one hand [LAUGH] well I can just calculate what this term is, this is the sum of the first 2 end terms, this is the sum of the first 2n minus 1 terms. So if I add up the first 2n terms and subtract all but the last term that's exactly the same then as just the 2 nth term, which in this case is negative a sub 2n. So this limit is the same as this limit, but what is this limit, right? Well I actually know what that one's equal to because I assume that the limit of the nth term is 0. So [LAUGH] my, my assumption right the limit of negative a sub 2n is the same as negative the limit of a sub n which is 0. But now there's another way that I could calculate this limit. This is the limit of a difference, which is the difference of the limits provided the limits exist. And in this case, they do, right? I'm assuming that these two limits exist. So this is the limit of a difference. This is a difference of the limits. But now, [LAUGH]. I just calculated this a moment ago, to be equal to 0, right? What I'm saying here is that the limit of this sequence, and the limit of this sequence, differ by 0. Which is to say that this limit equals this limit, right? Which is just to say that the limit of s sub n exists, because the limit of the even terms is equal to the limit of the odd terms. So all of the terms together are getting close to something in particular and that's what I wanted. Right the limit of a partial sums exist and that's exactly what it means to say that this series converges right to say that a series converges is just to say that the limit of the sequence of partial sums exists. But wait, there's more. Let's think back to this picture, right? This diagram of the number line with the partial sums drawn on it. Well, the odd partial sums are decreasing, and their limit is some value L. The even partial sums are increasing, and their limit's the same thing, it's also L, because the difference between even and odd partial sums are controlled by just the terms in the sequence a sub k, and those terms have limit 0. So the even partial sums are increasing to L, the odd partial sums are decreasing to L. And what this means is that the value of this series is between these two, right. Here's the value of the of the series. Here's the series, and all of the even partial sums are below it and all of the odd partial sums are above this true value, L. This is one of the best reasons to care about alternating series. So not only is it really easy to determine if an alternating series converges, the whole story just boils down to whether the limit of a sub n is 0 or not. But more than that, I can now give explicit error bounds on the value of an alternating series. If I compute the 2 nth and the 2n minus 1th partial sum, I know the true value of my series lands between these two values. And this makes alternating series great for machines. When you're calculating a partial sum, you're getting error bounds for free. [SOUND]