الگوریتم 3
CHAPTER 3: SUMMATIONS
3.1 Summation formulas and properties
Given a sequence a1, a2, . . . of numbers, the finite sum a1 + a2 + . . . +an can be written
Given a sequence a1, a2, . . . of numbers, the infinite sum a1 + a2 +
can be written
Linearity
For any real number c and any finite sequences a1, a2, . . . , an and b1, b2, . . . , bn,
The linearity property is also obeyed by infinite convergent series.
Arithmetic series
which came up when we analyzed insertion sort, is an arithmetic series and has the value
(3.1)
(3.2)
Geometric series
is a geometric or exponential series and has the value
(3.3)
When the summation is infinite and |x| < 1, we have the infinite decreasing geometric series
(3.4)
Harmonic series
For positive integers n, the nth harmonic number is
(3.5)
Integrating and differentiating series
(3.6)
Telescoping series
For any sequence a0, a1, . . . , an,
(3.7)
As an example of a telescoping sum, consider the series
Since we can rewrite each term as
Products
The finite product a1 a2
an can be written
Exercises
Show that
by manipulating the harmonic series.
Use the linearity property of summations to prove that 
3.2 Bounding summations
Mathematical induction
as long as (1/3 + 1/c)
1 or, equivalently, c
3/2. Thus,
, as we wished to show.
Bounding the terms
In general, for a series
, then
for all k
1. Thus, each term is bounded above by (1/3)(2/3)k, so that
Splitting summations
which is an asymptotically tight bound, since
.
we observe that the ratio of consecutive terms is
if k
3. Thus, the summation can be split into
since the second summation is a decreasing geometric series.
(3.8)
Approximation by integrals
(3.9)
(3.10)
(3.11)
For the upper bound, we derive the inequality
(3.12)
Figure 3.1 Approximation of
by integrals. The area of each rectangle is shown within the rectangle,
and the total rectangle area represents the value of the summation. The
integral is represented by the shaded area under the curve. By
comparing areas in (a), we get
, and then by shifting the rectangles one unit to the right, we get
.in (b).
Exercises
Show that
is bounded above by a constant.
Find an asymptotic upper bound on the summation
Show that the nth harmonic number is
(1g n) by splitting the summation.
Problems
Give asymptotically tight bounds on the following summations. Assume that r
0 and s
0 are constants.
Chapter notes

(n2)
on the worst-case running time of the algorithm. This example indicates
the general importance of understanding how to manipulate and bound
summations. (As we shall see in Chapter 4, summations also arise when
we use certain methods to solve recurrences.)
n
. Similarly, if the sum begins with k = x, where x is not an integer, we assume that the initial value for the summation is 

for which the series
also converges.



1, the summation

















evaluates to 1/2n(n + 1). We can easily verify this for n = 1, so we make the inductive assumption that it holds for n and prove that it holds for n + 1. We have
is 0(3n). More specifically, let us prove that
for some constant c. For the initial condition n = 0, we have
as long as c 
. Certainly,
. Assuming the bound for n, we now prove it for n+1:


suppose that ak+1/ak 
. The first term is 1/3, and the ratio of consecutive terms is


, which has already been shown to have an upper bound of n2. We might attempt to bound each term in the summation by the smallest term, but since that term is 1, we get a lower bound of n for the summation--far off from our upper bound of n2.

is independent of n. Then for any constant k0 > 0, we can write
. For example, to find an asymptotic upper bound on




, where â(k) is a monotonically increasing function, we can approximate it by integrals:






with an integral.
to obtain an upper bound on the nth harmonic number?