Conceptintro
Geometric series
Also called geometric progression sum.
The sum of a geometric progression, which for a constant positive ratio other than one is within a constant factor of its largest term.
A geometric series is the sum of the terms of a geometric progression: a list in which each term is the previous term times a fixed ratio . For the sum of the first terms of is . When is a positive constant other than 1, the sum is of its largest term, in asymptotic notation. This rule gives many bounds in the analysis of algorithms in one line.
In plain words
Take a stick of length 1. Cut off half of it, then half of what is left, then half again. The pieces have lengths 1/2, 1/4, 1/8, and so on. All the pieces together never pass the original length 1. A sum in which each term is a fixed fraction of the previous term is small: it is at most a constant times the first term.
Now reverse the direction. Each term is twice the previous one. The last term is then larger than all the earlier terms together. So the sum is less than twice the last term. In both cases one end of the sum decides the size of the whole sum, and the other terms add only a constant factor.
The idea
Finite sum. For each real and each integer ,
For the sum is . With a first term , each term is multiplied by , so for . The factor does not change the rule below.
Proof. Let . Then . The two sums share the terms . So , that is . Divide by , which is not zero.
Infinite sum. For real with , when . So the partial sums converge and
For real with the terms do not tend to 0 and the series diverges. A common case is , with ratio .
The largest term rule. Let be a constant with and , and let .
- If , then . So , the last term.
- If , then . So , the first term.
Proof. Each term is positive, so is at least its largest term. This is if and if . For , the closed form gives . For , the infinite sum bounds the partial sum: .
The constants depend on . They grow when comes close to 1: for the factor is 2, for it is about 101.
Bounding by a geometric series. A series that is not exactly geometric can still be bounded by one. If and for each , with a constant , then by induction, so . For example, in the ratio of consecutive terms is , so the sum is at most . The exact value is .
The weighted sum . For there is a short proof with no calculus. Write . Then , where the order of summation can change because all terms are non-negative. The inner sum is by the infinite geometric sum. So the total is . The same exchange of sums gives the general form: for , the inner sum is , so . The exchange is valid for negative too, because the series converges absolutely.
Examples
Exact values. For and : . For and : .
Non-example. The rule needs a constant ratio. Take with terms. The last term is , but the sum is , which is about . So the sum is while the largest term is . The sum of a series with is also not covered: it is , and each term is the largest.
Where it is used
Array doubling. A dynamic array starts with capacity 1 and doubles its capacity when it is full. The copies happen at sizes , where is the integer with (for ). The total number of copied items is . For example, 17 appends copy items, and . So the copies cost per append on average over the sequence, which is an amortized bound.
Recursion trees. Sum the cost of a recursion tree level by level. Often the level costs form a geometric progression, and the rule gives the answer from one end.
- For the cost of level is . The ratio is , so the sum over is at most and at least . The root decides: .
- For the cost of level , for , is . The ratio is , so the last level decides. It costs , so .
- When the ratio is exactly 1 each level costs the same, and the total is the number of levels times the cost of one level. This is the middle case of the master theorem.
Building a heap. The bottom-up construction of a binary heap calls a sift-down at each internal node. A node of height costs at most swaps. A heap of nodes has at most nodes of height , and for this is at most , because and for . So the total number of swaps is at most
The build takes time, not the that the bound for each node suggests. The first phase of heapsort uses this.
References
- Cormen, Leiserson, Rivest and Stein, Introduction to Algorithms, fourth edition, Appendix A, Summations; Section 6.3 for the heap bound
- Graham, Knuth and Patashnik, Concrete Mathematics, second edition, Chapter 2, Sums
- Donald E. Knuth, The Art of Computer Programming, Volume 1, third edition, Section 1.2.3, Sums and products
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag D3C8ZM Edit this page History Report an error Markdown JSON