# Infinite series

An infinite series is an expression like this:

S = 1 + 1/2 + 1/4 + 1/8 + ...
The dots mean that infinitely many terms follow. We obviously can't add up an infinite number of terms, but we can add up the first n terms, like this:
S1 = 1
S2 = 1 + 1/2 = 3/2
S3 = 1 + 1/2 + 1/4 = 7/4
S4 = 1 + 1/2 + 1/4 + 1/8 = 15/8

It is clear what the pattern is: the n-th partial sum is

Sn = 2 - 1/2n
When n gets larger and larger, Sn gets closer and closer to the number 2. When a sequence Sn gets closer and closer and closer to a given number S, we say that S is the limit of the Sn's and we write
lim( Sn ) = S
To take a physical analogy, consider a student who is one yard from the wall of the classroom. He takes a large step to cut the distance to the wall in half. Then he takes another step to cut the distance in half again. He repeates this again and again, getting closer to the wall each time. He never reaches the wall, yet that is his limit postion. We could write
lim( Positionn ) = Wall
In our case lim( Sn ) = 2. Since this limit exists, we say that the sum of the series is 2, even though we can't really "do the sum."

## Another example

Our first example was easy to understand because there is a simple formula for the partial sums. Now let's look at a more difficult example.
S = 1 + 1/4 + 1/9 + 1/16 + ... + 1/n2 + ....
We can compute some partial sums in an effort to see what the limit might be:
S0 = 1
S1 = 1 + 1/4 = 1.25
S2 = 1 + 1/4 + 1/9 = 1.36111...
S3 = 1 + 1/4 + 1/9 + 1/16 = 1.4236111....
This time it is not clear what is happening. The partial sums are increasing, since we get one from another by adding a positive number. But do they approach a limit? Is there a number to which they get closer and closer as we add more terms? If there is a limit what is it? Can we compute it to some modest accuracy, say one or two decimal places?

### Problem

Use the "calculator" below to make an intelligent guess about whether the limit S exists, and if it does, what its value is, accurate to two decimal places.
```     Series calculator
Number of terms:
Partial sum:

```

### Notes

#### 1. Computing the partial sums

The n-th partial sum is computed by the Javascript function `sum`:
```  function sum(n) {

var s = 0;
for(i=1; i <= n; i++) {
s += 1.0/(i*i);
}
return s;
}
```
We can read the definition of `sum` as follows. First, create a variable s and set it to zero. This is a "container" in which we will accumulate the partial sums. Then repeatedly add 1/i2 to s as i ranges from 1 to n.

The heart of the definition is the "repeatedly .... as i ranges from 1 to n" part. Here the "..." is an action or sequence of actions to be performed. This contruction is called a loop, or, in more detail, a for loop.

#### 2. Convergence

You probably concluded that the limit S exists and were able to find a reasonably accurate value for it. However, there is is a subtle problem because the partial sums do keep increasing as n increases. True, they increase at a decreasing rate. But is this enough to guarantee the existence of a limit, the "sum" of the series? Now in fact the limit does exist, or, as we say, the series converges. This, however, requires an argument that we are not yet prepared to give.

It is important to understand clearly that there is a problem. To this end consider the so-called harmonic series,

H = 1 + 1/2 + 1/3 + 1/4 + ....
Does it converge? See the next section for more on this question. However, before going on, see what you can find by yourself.

#### 3. Convergence criteria

Let's take a closer look at the question of whether the series
S = 1 + 1/4 + 1/9 + 1/16 + ... + 1/n2 + ....
converges. Since its terms are postive, the partial sums form an increasing sequence:
S1 < S2 < S3 < ...
An increasing sequence behaves in one of two ways. Either there is a number M which is bigger than all the terms of the sequence, or else there is no such number. In the first case we say that the sequence is bounded above. The completeness axiom for the real numbers, the one that guarantees that there are no holes or gaps in the number line, also guarantees that such a sequence has a limit.
Theorem. A increasing sequence which is bounded above by a number M converges to a limit L. This limit is less than or equal to M.
In the second case the sequence is unbounded: no matter what M we choose, we can find an n such that Sn > M. We say that it "tends to infinity," a fact we write as
lim( Sn ) = infinity
The main point of all this is that we can guarantee that a series of positive terms converges if its partial sums are bounded above. Can we do this with the sum S above? If, for example, we can show that
Sn < 2
for all n, then we know (by virtue of the theorem) that the sequence { Sn } converges and that its limit is less than or equal to 2. The question is, therefore: how do we show that such an inequality is true?

One of the key's to answerin this question is to be found in the figure below. The figure composed of yellow boxes is a model for the partial sum of a series. Each box has unit width. The height of the n-th box is the magnitude of the n-th term. Thus the area of the n-th box has the same magnitude as the n-th term. Consequently the area of the yellow figure is the magnitude of the n-th partial sum. Now consider the green figure, which we imagine extending infinitely off to the right. ... to be continued.