Close
Register
Close Window

Show Source |    | About   «  21.6. Growth Rates Review   ::   Contents   ::   21.8. Solving Recurrence Relations  »

21.7. Summation Techniques

Consider the following simple summation.

\[\sum_{i=1}^n i.\]

An easy proof by induction shows that this summation has the well-known closed form \(n(n+1)/2\). But while induction is a good technique for proving that a proposed closed-form expression is correct, how do we find a candidate closed-form expression to test in the first place? Let us try to think through this problem from first principles, as though we had never seen it before.

A good place to begin analyzing a summation it is to give an estimate of its value for a given \(n\). Observe that the biggest term for this summation is \(n\), and there are \(n\) terms being summed up. So the total must be less than \(n^2\). Actually, most terms are much less than \(n\), and the sizes of the terms grow linearly. If we were to draw a picture with bars for the size of the terms, their heights would form a line, and we could enclose them in a box \(n\) units wide and \(n\) units high. It is easy to see from this that a closer estimate for the summation is about \((n^2)/2\). Having this estimate in hand helps us when trying to determine an exact closed-form solution, because we will hopefully recognize if our proposed solution is badly wrong.

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

Let us now consider some ways that we might hit upon an exact equation for the closed form solution to this summation. One particularly clever approach that we can take is to observe that we can “pair up” the first and last terms, the second and (\(n-1\))th terms, and so on. Each pair sums to \(n+1\). The number of pairs is \(n/2\). Thus, the solution is \(n(n+1)/2\). This is pretty, and there is no doubt about it being correct. The problem is that it is not a useful technique for solving many other summations.

Now let us try to come up with something a bit more general. We already recognized that, because the largest term is \(n\) and there are \(n\) terms, the summation is less than \(n^2\). If we are lucky, the closed form solution is a polynomial. Using that as a working assumption, we can invoke a technique called guess-and-test. We will guess that the closed-form solution for this summation is a polynomial. That means that we are guessing that it is of the form \(c_1 n^2 + c_2 n + c_3\) for some constants \(c_1\), \(c_2\), and \(c_3\). If this is true, then we can plug in the answers to small cases of the summation to solve for the coefficients. For this example, substituting 0, 1, and 2 for \(n\) leads to three simultaneous equations. Because the summation when \(n=0\) is just 0, \(c_3\) must be 0. For \(n=1\) and \(n=2\) we get the two equations

\[\begin{split}\begin{eqnarray*} c_1 + c_2 & = & 1 \\ 4 c_1 + 2 c_2 & = & 3, \end{eqnarray*}\end{split}\]

which in turn yield \(c_1 = 1/2\) and \(c_2 = 1/2\). Thus, if the closed-form solution for the summation is a polynomial, then it can only be

\[1/2 n^2 + 1/2 n + 0\]

which is more commonly written

\[\frac{n(n+1)}{2}.\]

At this point, we still must do the “test” part of the guess-and-test approach. We can use an induction proof to verify whether our candidate closed-form solution is correct. In this case it is indeed correct, as shown by Example 6.7.3. The induction proof is necessary because our initial assumption that the solution is a simple polynomial could be wrong. For example, it might have been that the true solution includes a logarithmic term, such as \(c_1n^2 + c_2 n \log n\). The process shown here is essentially fitting a curve to a fixed number of points. Because there is always an \(n\)-degree polynomial that fits \(n+1\) points, we have not done enough work to be sure that we to know the true equation without the induction proof.

Guess-and-test is useful whenever the solution is a polynomial expression. In particular, similar reasoning can be used to solve for \(\sum_{i=1}^n i^2\), or more generally \(\sum_{i=1}^n i^c\) for \(c\) any positive integer. Why is this not a universal approach to solving summations? Because many summations do not have a polynomial as their closed form solution.

A more general approach is based on the subtract-and-guess or divide-and-guess strategies. One form of subtract-and-guess is known as the shifting method. The shifting method subtracts the summation from a variation on the summation. The variation selected for the subtraction should be one that makes most of the terms cancel out. To solve sum \(f\), we pick a known function \(g\) and find a pattern in terms of \(f(n) - g(n)\) or \(f(n)/g(n)\).

Here is another example.

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

   «  21.6. Growth Rates Review   ::   Contents   ::   21.8. Solving Recurrence Relations  »

Close Window