Runtime arguments often add the work done across a loop or across levels of recursion. Summation notation is a compact way to write that addition. The expression Σᵢ₌₁ⁿ i means 1 + 2 + ... + n. It does not add a new algorithmic idea; it lets us state one precisely.
Background for this page. You need addition, multiplication, and powers. A summation adds terms selected by an index. Its limits say which terms are included. Related explanations: Big O, Big Omega, and Big Theta · Divide and conquer: merge sort and recurrences.
Pair the first and last terms of that sum: 1 + n, 2 + (n − 1), and so on. Each pair totals n + 1. The result is n(n + 1)/2, which grows as Θ(n²). This is why comparing an item with every earlier item can lead to quadratic work.
A geometric sum grows by a constant factor: 1 + 2 + 4 + ... + 2^k = 2^(k+1) − 1. That identity explains the total copying done when a dynamic array doubles. Going the other direction, n + n/2 + n/4 + ... stays below 2n. The exact last term depends on where we stop, but the bound is enough for many algorithms.
We can also bound a sum without solving it exactly. If n terms are each at most n, their total is at most n². A lower bound may come from a group of terms that are all large. For example, the last half of 1 + 2 + ... + n contains about n/2 terms, each at least n/2, so the total is at least a constant times n². Upper and lower bounds together establish Θ(n²).
The harmonic sum 1 + 1/2 + ... + 1/n grows like Θ(log n). We met it while counting expected record changes in a random order. It grows without bound, but slowly. Comparing its terms with areas under 1/x, or grouping terms between powers of two, gives that logarithmic bound.
When you meet a sum, first ask what its terms count. A correct algebraic manipulation of the wrong count will not describe the program. Then decide whether you need an exact total, an upper bound, or a tight growth rate.
Check what happens at every recursion level
For a balanced binary recursion on n=8 items, suppose each level performs one unit of work per item. The levels have one group of eight, two groups of four, four groups of two, and eight groups of one. Every level contributes eight, and four levels contribute thirty-two. For n a power of two, including the leaf level gives n(log₂ n+1).
Contrast that with work on one shrinking branch: n+n/2+n/4+… . Its total is less than 2n. Both calculations contain halves, but one counts all branches and the other counts one branch. A recurrence analysis must identify which work is actually being added.
Practice. What is 1 + 2 + 4 + 8 + 16? Give a simple upper bound for n + n/2 + n/4 + ....
Answer. The first sum is 31. The second remains below 2n, so it is O(n).
Try another case. Why is n+n/2+… not Θ(n log n)?
Reasoning. Its terms shrink geometrically. There may be logarithmically many terms, but most are much smaller than n; replacing every term by n gives only a loose upper bound.