Skip to content

doubling and halving sums

the maths you need

what it is

A doubling sum from 1 ends one short of its next term, and a halving sum from one half stays short of 1. Such sums show that a full heap, a tree met below, is built in fewer sinking steps than it has items.

Add 1, 2, 4 and 8, each twice the one before: a doubling sum. The total, 15, is one less than the next term, 16. So the last term outweighs the rest: 1, 2 and 4 make 7. 2n2^n, read 2 to the power nn, is nn 2s multiplied together. Each 2 fewer halves it, 8, 4, 2, so 2 to the power 0 is 2 halved, 1. So 1, 2, 4 and 8 are 2 to the power 0, 1, 2 and 3.

1, 2, 4 and 8 added a row at a time, blue the terms before and yellow the term added. Each total, plus the 1 hollow square, makes the next term.

Halve from one half instead: one half, one quarter and one eighth make 7 eighths. Each term covers half the gap still left to 1, so the gap never closes.

One half, one quarter and one eighth added a row at a time, in a bar 1 long. Each yellow term fills half the gap left in the row above, so some gap always stays.
the totalterms00.20.40.60.8102468the totalterms00.20.40.60.8102468
  • the halving sum
  • its ceiling, 1
The halving sum, 1 to 8 terms, closing on 1.

Multiply each halving term by a count that climbs by one: 1 over 2, 2 over 4, 3 over 8. This weighted sum makes 11 eighths, 1.375, so far. Question 3 shows it stays under 2.

the totalterms00.511.520246810the totalterms00.511.520246810
  • the weighted sum
  • its ceiling, 2
The weighted sum, 1 to 10 terms, creeping toward 2.

A heap here keeps items, such as numbers, in a tree: levels of 1, 2, 4 and on, each item joined to at most two below. Each is at least as big as those under it, so the biggest is on top. To build a full heap, every level filled, lay the items in level by level from the left. Then each item with items under it sinks, from the last back to the top. While an item under it is bigger, it swaps with the biggest: one sinking step. Those below have already become heaps, so the whole tree ends as one.

123456711223344556677
1 to 7 laid in, as a tree and as a row in the order laid in. The marked 3 sinks first, swapping with 7.
756421371526344251637
The heap built, 4 sinking steps later, each item at least as big as those under it.

A full heap's levels hold 1, 2, 4 and on items, a doubling sum. The bottom level outnumbers the rest. Its items cannot sink, and each level up holds half as many, each able to sink one level more. For 4 levels that is 4 × 1 + 2 × 2 + 1 × 3, which is 11. That is 8 × (1 over 2 + 2 over 4 + 3 over 8), the bottom's 8 times the weighted sum (question 4, line 4).

depth01233221111000000003122231415161708090100110120130140150123
A full heap of 4 levels, numbered 0 to 3 down from the top at its side. Each place shows the most its item can sink, 11 in all, fewer than its 15 items.

where the formulas come from

Each question is worked out one numbered line at a time. A line shows the move it makes, the line itself, and why the move is allowed. A line either follows from the lines above it, or brings in something the question needs, such as how the method works, a small fact about nn, or a result from another page, with its own reason. Press 'hide the lines, then guess each one' to cover the lines and uncover them one by one, guessing each before you see it.

question 1Add 1+2+4+⋯+2n1 + 2 + 4 + \dots + 2^n. What is the total?
  1. the move: name the sum

    the line:
    S=1+2+4+⋯+2nS = 1 + 2 + 4 + \dots + 2^n

    why it is allowed: Let SS be the doubling sum up to 2n2^n. For nn as 3, it is 1 + 2 + 4 + 8.

  2. the move: double both sides

    the line:
    2S=2+4+8+⋯+2n+12S = 2 + 4 + 8 + \dots + 2^{n + 1}

    why it is allowed: Each term doubled is the next one along, and 2n2^n becomes 2n+12^{n + 1}. Doubling both sides keeps them equal. The plan: the two sums share all but their ends.

  3. the move: take line 1 away

    the line:
    2S−S=(2+4+⋯+2n+1)−(1+2+⋯+2n)\begin{aligned} 2S - S = {} & (2 + 4 + \dots + 2^{n + 1}) \\ & - (1 + 2 + \dots + 2^n) \end{aligned}

    why it is allowed: Take SS from both sides of line 2. On the right, write SS out as line 1 does.

  4. the move: tidy the left side

    the line:
    S=(2+4+⋯+2n+1)−(1+2+⋯+2n)\begin{aligned} S = {} & (2 + 4 + \dots + 2^{n + 1}) \\ & - (1 + 2 + \dots + 2^n) \end{aligned}

    why it is allowed: Two lots of SS less one lot is one lot.

  5. the move: cancel what both brackets share

    the line:
    S=2n+1−1S = 2^{n + 1} - 1
    when n is 3124816
    first bracket24816
    second bracket1248
    left overtake away 116
    Line 4 when nn is 3. The 2, 4 and 8 cancel, leaving 16 less 1, which is 15.

    why it is allowed: Every term from 2 to 2n2^n is in both brackets and cancels, leaving 2n+12^{n + 1} less 1.

  6. the move: the terms before the last

    the line:
    1+2+⋯+2n−1=2(n−1)+1−1\begin{gathered} 1 + 2 + \dots + 2^{n - 1} \\ = 2^{(n - 1) + 1} - 1 \end{gathered}

    why it is allowed: The sum of line 5 stopping one term sooner: line 5 with n−1n - 1 for nn. For 3, it is 1 + 2 + 4. At nn as 0 no terms are left, adding to 0, and 2 to the power 0, less 1, is 0 too.

  7. the move: tidy the power

    the line:
    2(n−1)+1−1=2n−12^{(n - 1) + 1} - 1 = 2^n - 1

    why it is allowed: One more than n−1n - 1 is nn. For 3, 1 + 2 + 4 is 7, one less than 8.

  8. the move: read it

    the line:
    one less thanthe next term,under twice the last\begin{gathered} \text{one less than} \\ \text{the next term,} \\ \text{under twice the last} \end{gathered}

    why it is allowed: By lines 6 and 7, the terms before the last add to one less than it: the last outweighs them all. By line 5 the sum is under 2n+12^{n + 1}, twice the last.

try it with a small nn: at n=3n = 3, line 1 gives S=15S = 15, which you can work out by hand

question 2Add 12+14+⋯+12n\frac{1}{2} + \frac{1}{4} + \dots + \frac{1}{2^n}. How close does it come to 1?
  1. the move: name the sum

    the line:
    H=12+14+⋯+12nH = \frac{1}{2} + \frac{1}{4} + \dots + \frac{1}{2^n}
    Line 1 for 3, 7 over 8, short of 1 by 1 over 8.

    why it is allowed: Let HH be the halving sum from one half down to 1 over 2n2^n. The bars add it for 3.

  2. the move: double both sides

    the line:
    2H=1+12+⋯+12n−12H = 1 + \frac{1}{2} + \dots + \frac{1}{2^{n - 1}}

    why it is allowed: As in question 1: double, take away, and all but the ends cancel. Doubled, one half becomes 1, and 1 over 2n2^n becomes 1 over 2n−12^{n - 1}, as 2n2^n is twice 2n−12^{n - 1}. For 3, 2 × 1 over 8 is 2 over 8, which is 1 over 4.

  3. the move: take line 1 away

    the line:
    2H−H=(1+⋯+12n−1)−(12+⋯+12n)\begin{aligned} 2H - H = {} & \left(1 + \dots + \frac{1}{2^{n - 1}}\right) \\ & - \left(\frac{1}{2} + \dots + \frac{1}{2^n}\right) \end{aligned}

    why it is allowed: Take HH from both sides of line 2. On the right, write HH out as line 1 does.

  4. the move: tidy the left side

    the line:
    H=(1+⋯+12n−1)−(12+⋯+12n)\begin{aligned} H = {} & \left(1 + \dots + \frac{1}{2^{n - 1}}\right) \\ & - \left(\frac{1}{2} + \dots + \frac{1}{2^n}\right) \end{aligned}

    why it is allowed: Two lots of HH less one lot is one lot.

  5. the move: cancel what both brackets share

    the line:
    H=1−12nH = 1 - \frac{1}{2^n}

    why it is allowed: Every term from one half to 1 over 2n−12^{n - 1} is in both brackets and cancels, leaving 1 less 1 over 2n2^n. For 3, 1 less 1 over 8 is 7 over 8.

  6. the move: a ceiling

    the line:
    H≤1H \le 1

    why it is allowed: Line 5 takes 1 over 2n2^n, above zero, from 1, so HH is under 1, and so at most 1.

  7. the move: read it

    the line:
    ever closer to 1,never reaching it\begin{gathered} \text{ever closer to 1,} \\ \text{never reaching it} \end{gathered}

    why it is allowed: By line 5 the sum falls short of 1 by its last term, which halves each time but never reaches zero. Line 6 makes 1 its ceiling.

try it with a small nn: at n=3n = 3, line 1 gives HH, about 0.88

question 3Add 12+24+38+⋯+n2n\frac{1}{2} + \frac{2}{4} + \frac{3}{8} + \dots + \frac{n}{2^n}. Does it grow without end?
  1. the move: name the sum

    the line:
    W=12+24+38+⋯+n2nW = \frac{1}{2} + \frac{2}{4} + \frac{3}{8} + \dots + \frac{n}{2^n}

    why it is allowed: Let WW be the weighted sum, term kk being kk over 2 to the power kk, up to nn. For 3, it is 1.375.

  2. the move: double both sides

    the line:
    2W=1+22+34+⋯+n2n−12W = 1 + \frac{2}{2} + \frac{3}{4} + \dots + \frac{n}{2^{n - 1}}

    why it is allowed: As in question 1, double, then take away. Doubling a term halves its bottom. For 3, 3 over 8 becomes 3 over 4.

  3. the move: take line 1 away

    the line:
    2W−W=(1+22+⋯+n2n−1)−(12+24+⋯+n2n)\begin{aligned} 2W - W = {} & \left(1 + \frac{2}{2} + \dots + \frac{n}{2^{n - 1}}\right) \\ & - \left(\frac{1}{2} + \frac{2}{4} + \dots + \frac{n}{2^n}\right) \end{aligned}

    why it is allowed: Take WW from both sides of line 2. On the right, write WW out as line 1 does.

  4. the move: tidy the left side

    the line:
    W=(1+22+⋯+n2n−1)−(12+24+⋯+n2n)\begin{aligned} W = {} & \left(1 + \frac{2}{2} + \dots + \frac{n}{2^{n - 1}}\right) \\ & - \left(\frac{1}{2} + \frac{2}{4} + \dots + \frac{n}{2^n}\right) \end{aligned}

    why it is allowed: Two lots of WW less one lot is one lot.

  5. the move: take away term under term

    the line:
    W=1+12+14+⋯+12n−1−n2nW = 1 + \frac{1}{2} + \frac{1}{4} + \dots + \frac{1}{2^{n - 1}} - \frac{n}{2^n}
    bottomfirst bracketsecond bracketleft over
    111
    22 over 21 over 21 over 2
    43 over 42 over 41 over 4
    83 over 8take away 3 over 8
    Line 4 when nn is 3, term under term.

    why it is allowed: Stand each term of the second bracket under the one of the first with the same bottom. The top above is one more, so each pair leaves 1 over that bottom. The front 1 and nn over 2n2^n have no partner.

  6. the move: the halving sum, one term shorter

    the line:
    12+⋯+12n−1=1−12n−1\frac{1}{2} + \dots + \frac{1}{2^{n - 1}} = 1 - \frac{1}{2^{n - 1}}

    why it is allowed: The halving sum of question 2 with n−1n - 1 terms, its line 5 with n−1n - 1 for nn. At nn as 1 both sides are 0.

  7. the move: put the front 1 back

    the line:
    1+12+⋯+12n−1=2−12n−11 + \frac{1}{2} + \dots + \frac{1}{2^{n - 1}} = 2 - \frac{1}{2^{n - 1}}

    why it is allowed: Add 1 to both sides of line 6. For 3, 7 over 4 is 2 less 1 over 4.

  8. the move: use line 7

    the line:
    W=2−12n−1−n2nW = 2 - \frac{1}{2^{n - 1}} - \frac{n}{2^n}

    why it is allowed: Line 7's total takes the place of line 5's halving terms. For 3, 7 over 4 less 3 over 8.

  9. the move: put both over the same bottom

    the line:
    W=2−22n−n2nW = 2 - \frac{2}{2^n} - \frac{n}{2^n}

    why it is allowed: 1 over 2n−12^{n - 1} is 2 over 2n2^n, since 2n2^n is twice 2n−12^{n - 1}. For 3, 1 over 4 is 2 over 8.

  10. the move: add the two fractions

    the line:
    W=2−n+22nW = 2 - \frac{n + 2}{2^n}

    why it is allowed: Taking away 2 over 2n2^n, then nn over 2n2^n, takes away n+2n + 2 over 2n2^n. For 3, 2 less 5 over 8 is 1.375.

  11. the move: a ceiling

    the line:
    W≤2W \le 2

    why it is allowed: Line 10 takes n+2n + 2 over 2n2^n, above zero, from 2, so WW is under 2, and so at most 2.

  12. the move: read it

    the line:
    under 2, howevermany terms\begin{gathered} \text{under 2, however} \\ \text{many terms} \end{gathered}

    why it is allowed: In line 10 the top climbs by one each term while the bottom doubles. So the gap to 2 shrinks toward zero, never reaching it, as line 11 says. The gap is 5 over 8 at 3 terms and 12 over 1,024 at 10, where the sum is about 1.99.

try it with a small nn: at n=3n = 3, line 1 gives WW, about 1.38

question 4A full heap of nn levels. At most how many sinking steps build it?
  1. the move: add up each item's most

    the line:
    T=∑j=0n−1j×2n−1−jT = \sum_{j=0}^{n - 1} j \times 2^{n - 1 - j}
    depth012211000021121304050607012
    A full heap of 3 levels, numbered 0 to 2 down from the top. Each place shows the most its item can sink, 4 in all.
    levels under it, jjitems, 2n−1−j2^{n - 1 - j}most each sinks, jjmost steps, j×2n−1−jj \times 2^{n - 1 - j}
    0400
    1212
    2122
    in all74
    Line 1 for 3 levels, a row per level. It adds the last column, 4.

    why it is allowed: Here nn counts levels, each holding twice the one above, from 1 at the top. Number a level by jj, the levels under it, as the table does for 3. It lies n−1−jn - 1 - j below the top, so it holds 2n−1−j2^{n - 1 - j} items, each able to sink jj. Σ\Sigma, read the sum of, adds the term after it for each jj from 0, under it, to n−1n - 1, over it. For 3 levels it adds the table's last column, 0 + 2 + 2, which is 4. No build takes more than TT.

  2. the move: leave out the bottom level

    the line:
    T=∑j=1n−1j×2n−1−jT = \sum_{j=1}^{n - 1} j \times 2^{n - 1 - j}

    why it is allowed: The term for jj as 0 is 0, so start at 1. With 1 level nothing is left to add, giving 0, as one item cannot sink.

  3. the move: split each power

    the line:
    T=∑j=1n−1j×2n−12jT = \sum_{j=1}^{n - 1} j \times \frac{2^{n - 1}}{2^j}

    why it is allowed: The plan: bring in question 3. Dividing 2n−12^{n - 1} by 2j2^j takes jj of its 2s away, leaving 2n−1−j2^{n - 1 - j}. For 3 levels and jj as 1, 4 over 2 is 2.

  4. the move: take the bottom count out in front

    the line:
    T=2n−1∑j=1n−1j2jT = 2^{n - 1} \sum_{j=1}^{n - 1} \frac{j}{2^j}

    why it is allowed: Every term has the factor 2n−12^{n - 1}, the bottom level's items: multiply by it once, after adding. For 3 levels, 1 × 2 + 2 × 1 is 4 × (1 over 2 + 2 over 4), 4 × 1.

  5. the move: use question 3

    the line:
    T=2n−1(2−(n−1)+22n−1)T = 2^{n - 1} \left(2 - \frac{(n - 1) + 2}{2^{n - 1}}\right)

    why it is allowed: Line 4's sum is the weighted sum of question 3 with n−1n - 1 terms: its line 10, n−1n - 1 for nn. With 1 level both are 0. For 3 levels, 2 less 4 over 4 is 1, and 4 times 1 is 4.

  6. the move: multiply out

    the line:
    T=2n−((n−1)+2)T = 2^n - \bigl((n - 1) + 2\bigr)

    why it is allowed: 2n−12^{n - 1} times 2 is 2n2^n, and 2n−12^{n - 1} times (n−1)+2(n - 1) + 2 over 2n−12^{n - 1} is (n−1)+2(n - 1) + 2.

  7. the move: tidy the bracket

    the line:
    T=2n−(n+1)T = 2^n - (n + 1)

    why it is allowed: (n−1)+2(n - 1) + 2 is n+1n + 1. For 3 levels, 8 less 4 is 4, as line 1 counts.

  8. the move: count the items

    the line:
    1+2+⋯+2n−1=2n−11 + 2 + \dots + 2^{n - 1} = 2^n - 1

    why it is allowed: The levels hold 1, 2, 4, up to 2n−12^{n - 1} items, 2n−12^n - 1 by lines 6 and 7 of question 1. For 3 levels, 7.

  9. the move: a ceiling

    the line:
    T≤2n−2T \le 2^n - 2
    levelsitemsthe guessline 7
    2331
    37144
    4154511
    53112426
    The guess, items times the most the top item can sink, beside line 7. Only line 7 stays under the items.

    why it is allowed: As nn is at least 1, line 7 takes at least 2 from 2n2^n, so TT is at most 2n−22^n - 2.

  10. the move: the count is reached

    the line:
    different items laid in smallestfirst take all T steps\begin{gathered} \text{different items laid in smallest} \\ \text{first take all } T \text{ steps} \end{gathered}
    steptopmiddlebottom
    laid in12, 34, 5, 6, 7
    3 sinks12, 74, 5, 6, 3
    2 sinks15, 74, 2, 6, 3
    1 sinks75, 14, 2, 6, 3
    1 again75, 64, 2, 1, 3
    1 to 7 laid in smallest first, one sinking step a row, 4 in all.

    why it is allowed: Lay different items in smallest first, as the table does. Each is then smaller than everything under it, and sinking below only swaps those items among themselves, so it stays so. So each sinks all the way: 3 and 2 sink 1 each, and 1 sinks 2, all 4 steps. Some build takes all TT steps.

  11. the move: read it

    the line:
    fewer sinking stepsthan items\begin{gathered} \text{fewer sinking steps} \\ \text{than items} \end{gathered}

    why it is allowed: By lines 8 and 9, a full heap of 2n−12^n - 1 items takes at most 2n−22^n - 2 sinking steps, fewer than its items. That ceiling grows in step with the items, the rung the growth ladder calls linear.

try it with a small nn: at n=3n = 3, line 1 gives T=4T = 4, which you can work out by hand

a worked example

Build a full heap of 3 levels from 3, 6, 2, 5, 1, 4, 7.

  1. Laid in: 3 on top, 6 and 2 under it, 5 and 1 under 6, and 4 and 7 under 2.
  2. 2 swaps with 7, the bigger of 4 and 7: 1 step. 6 is bigger than 5 and 1 and stays.
  3. 3 swaps with 7, then with 4: 2 steps. The heap reads 7, then 6 and 4, then 5, 1, 3 and 2.
  4. 3 steps in all, fewer than the 4 that question 4 allows for 3 levels.

the trap

check yourself

  1. A method does 64 steps, then 32, then 16 and on, halving down to 1. How many steps in all?

    the answer

    Read from 1 up, it is the doubling sum up to 64, 2 to the power 6. By question 1, 128 less 1, which is 127.

  2. What is one half + one quarter + one eighth and on, up to 1 over 1,024?

    the answer

    1,024 is 2 to the power 10, so by question 2, 1 less 1 over 1,024, which is 1,023 over 1,024.

  3. A full heap has 5 levels and 31 items. At most how many sinking steps build it?

    the answer

    By question 4, 2n−(n+1)2^n - (n + 1) with nn as 5, which is 32 less 6, 26, fewer than 31.