There are many techniques available for bounding the summations that describe the running times of algorithms. Here are some of the most frequently used methods.
The most basic way to evaluate a series is to use mathematical induction. As an example, let us prove that the arithmetic series
One need not guess the exact value of a summation in order to use mathematical induction. Induction can be used to show a bound as well. As an example, let us prove that the geometric series
as long as (1/3 + 1/c) ≤ 1 or, equivalently, c ≥ 3/2. Thus,
We have to be careful when we use asymptotic notation to prove bounds by induction. Consider the following fallacious proof that
The bug in the argument is that the "constant" hidden by the "big-oh" grows with n and thus is not constant. We have not shown that the same constant works for all n.
Sometimes, a good upper bound on a series can be obtained by bounding each term of the series, and it often suffices to use the largest term to bound the others. For example, a quick upper bound on the arithmetic series (A.1) is
In general, for a series
The technique of bounding each term in a series by the largest term is a weak method when the series can in fact be bounded by a geometric series. Given the series
We can apply this method to bound the summation
for all k ≥ 0. Thus, we have
A common bug in applying this method is to show that the ratio of consecutive terms is less than 1 and then to assume that the summation is bounded by a geometric series. An example is the infinite harmonic series, which diverges since
The ratio of the (k + 1)st and kth terms in this series is k/(k + 1) < 1, but the series is not bounded by a decreasing geometric series. To bound a series by a geometric series, one must show that there is an r < 1, which is a constant, such that the ratio of all pairs of consecutive terms never exceeds r. In the harmonic series, no such r exists because the ratio becomes arbitrarily close to 1.
One way to obtain bounds on a difficult summation is to express the series as the sum of two or more series by partitioning the range of the index and then to bound each of the resulting series. For example, suppose we try to find a lower bound on the arithmetic series
We can obtain a better lower bound by first splitting the summation. Assume for convenience that n is even. We have
which is an asymptotically tight bound, since
For a summation arising from the analysis of an algorithm, we can often split the summation and ignore a constant number of the initial terms. Generally, this technique applies when each term ak in a summation
since the initial terms of the summation are all constant and there are a constant number of them. We can then use other methods to bound
we observe that the ratio of consecutive terms is
if k ≥ 3. Thus, the summation can be split into
since the first summation has a constant number of terms and the second summation is a decreasing geometric series.
The technique of splitting summations can be used to determine asymptotic bounds in much more difficult situations. For example, we can obtain a bound of O(lg n) on the harmonic series (A.7):
The idea is to split the range 1 to n into ⌊ lg n⌋ pieces and upper-bound the contribution of each piece by 1. Each piece consists of the terms starting at 1/2i and going up to but not including 1/2i+1, giving
(A.10) |
When a summation can be expressed as
(A.11) |
The justification for this approximation is shown in Figure A.1. The summation is represented as the area of the rectangles in the figure, and the integral is the shaded region under the curve. When f(k) is a monotonically decreasing function, we can use a similar method to provide the bounds
(A.12) |
Figure A.1: Approximation of
The integral approximation (A.12) gives a tight estimate for the nth harmonic number. For a lower bound, we obtain
(A.13) |
For the upper bound, we derive the inequality
which yields the bound
(A.14) |
Show that
Find an asymptotic upper bound on the summation
Show that the nth harmonic number is Ω (lg n) by splitting the summation.
Approximate
Why didn't we use the integral approximation (A.12) directly on
Problems A-1: Bounding summations
Give asymptotically tight bounds on the following summations. Assume that r ≥ 0 and s ≥ 0 are constants.