log-log plots and slopes
counting the cost
what it is
Each mark on a log-log plot is ten times the last. A count of climbs 2 marks for each mark across, slope 2, its power. Doubling the input multiplies it by 4, 2 × 2.
Counts run from a few steps to trillions. On ordinary scales the small ones lie along the floor, as below. So the learn pages' plots space 10, 100, 1,000 and on evenly, across for , the items, and up for the count. Each is a mark, and such a plot is log-log.
- , slope 2
- , slope 1
A number stands at its log to base 10, written : the power you raise 10 to, to make it. 1,000 is 10 × 10 × 10, so it stands at mark 3, and 1 at 0, as 10 to the power 0 is 1. 2 stands about 0.301 up, as 10 to the power 0.301 is about 2. A calculator's log key gives logs like this one; take powers between whole numbers on trust. Log means base 10 here, unless it says .
Multiply by 10 and a number moves one mark, wherever it starts: 2 to 20, then 200. Multiply by 2 and it moves about 0.301; by 4, twice that, about 0.602. Equal distances mean equal multiples (question 1).
The slope of a line is the marks it climbs for each mark across. A count of is 100 at 10 items, 10,000 at 100 and 1,000,000 at 1,000: 2, 4 and 6 marks up, for 1, 2 and 3 across. That is a straight line of slope 2 (question 2). The power, how many s are multiplied together, is its slope: climbs 1 and climbs 3 (question 4).
The doubling test measures a count at some size and at twice it, and divides: the doubling ratio. For , 10 items to 20 moves 0.301 across, and 100 to 400 climbs 0.602, twice as far: slope 2. For any ratio, divide its log by the log of 2 (question 3).
| the count | at 10 items | at 20 items | the doubling ratio | the slope |
|---|---|---|---|---|
| 10 | 20 | 2 | 1 | |
| 100 | 400 | 4 | 2 | |
| 1,000 | 8,000 | 8 | 3 |
A number in front above 1, as in , lifts the line by the same distance all the way, here one mark: parallel, slope 2 (question 5). A slower part, as the in , bends it where inputs are small; by 1,000 items its slope is within 0.01 of 2 (question 6).
- , one mark higher
- , bent at first
has no single power: at 4 items it is 4 × 2, at 16 items 16 × 4. Its second factor grows, far more slowly than . Its slope falls toward 1 so slowly that it is still 1.07 at about a million items (question 7).
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 , 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.
the move: name the distance
the line:a number where it stands ten times it where that stands 1 0 10 1 2 0.301 20 1.301 4 0.602 40 1.602 8 0.903 80 1.903 50 1.699 500 2.699 Logs to three places. Each doubling adds about 0.301; ten times adds exactly 1. why it is allowed: Here is any number above zero, standing at . Let be how far stands from it.
the move: multiplying adds the logs
the line:why it is allowed: With numbers: 10 times 100 is 1,000, and the logs 1 and 2 add to 3, its log. Every number above zero is 10 to the power of its log, so multiplying two adds their powers, their logs.
guess it, thenthe move: use line 2
the line:why it is allowed: Line 2 put into line 1.
guess it, thenthe move: cancel
the line:why it is allowed: added and taken away leaves nothing.
guess it, thenthe move: one ten
the line:why it is allowed: 10 is 10 to the power 1.
guess it, thenthe move: the same rule with 2
the line:why it is allowed: Line 2, for 2 times . is about 0.301.
guess it, thenthe move: read it
the line:why it is allowed: Line 5 has no : times 10 moves any number one mark. By line 6, times 2 moves it about 0.301. Any fixed multiple moves a fixed distance, its log. And back: a number one mark higher is ten times it, since each place holds one number.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
the move: name the height
the line:items the count marks across marks up 10 100 1 2 100 10,000 2 4 1,000 1,000,000 3 6 Each row down is one mark across and two up. why it is allowed: The input stands across, and the count at its own log, up. Let be that height, the log of the whole square.
the move: write the square out
the line:why it is allowed: Two s multiplied together.
guess it, thenthe move: multiplying adds the logs
the line:why it is allowed: Line 2 of question 1, for times .
guess it, thenthe move: add like with like
the line:why it is allowed: Two lots of .
guess it, thenthe move: read it
the line:why it is allowed: By line 4, twice as far up as across at every size. So the points lie on one straight line, 2 marks up for each mark across.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
the move: name the slope
the line:items where they stand the count where it stands 10 1 100 2 20 1.301 400 2.602 the move 0.301 across 4 times 0.602 up 10 items to 20, logs to three places. The count climbs twice as far. why it is allowed: From items to , the count climbs from to , while the input moves from to . Let be the climb over the move.
the move: write the square out
the line:why it is allowed: To square is to multiply a number by itself.
guess it, thenthe move: multiply the parts
the line:why it is allowed: 2 times 2 times times , in any order.
guess it, thenthe move: use lines 2 and 3
the line:why it is allowed: By lines 2 and 3, is .
guess it, thenthe move: multiplying adds the logs
the line:why it is allowed: On top, line 2 of question 1, for 4 times ; below, line 6 of question 1.
guess it, thenthe move: cancel
the line:why it is allowed: and are each added and taken away.
guess it, thenthe move: 4 is 2 times 2
the line:why it is allowed: The same number, written another way.
guess it, thenthe move: multiplying adds the logs
the line:why it is allowed: Line 2 of question 1, for 2 times 2.
guess it, thenthe move: add like with like
the line:why it is allowed: Two lots of .
guess it, thenthe move: divide
the line:Ratios 2, 4 and 8, their logs, and each log over 0.301 in blue, the slope. why it is allowed: is about 0.301, not zero, and goes into twice itself twice.
guess it, thenthe move: read it for any count
the line:why it is allowed: At twice the input, a count is the ratio times its count at , so it climbs the log of the ratio (line 2 of question 1). The input moves (line 6 of question 1). The slope is the climb over the move: a ratio of 8, 2 × 2 × 2, gives slope 3, as lines 6 to 10 do for 4.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
the move: name the height
the line:why it is allowed: Let be its height at items.
the move: write the cube out
the line:why it is allowed: Three s multiplied together.
guess it, thenthe move: multiplying adds the logs
the line:why it is allowed: Line 2 of question 1, used twice.
guess it, thenthe move: add like with like
the line:- , slope 3
- , slope 2
- , slope 1
Each climbs its power in marks for each mark across; from 10 items to ten million, climbs 18. why it is allowed: Three lots of .
guess it, thenthe move: write the cube out
the line:why it is allowed: To cube is to multiply three of a number together.
guess it, thenthe move: multiply the parts
the line:why it is allowed: Three 2s make 8, and three s make . At 10 items, 1,000; at 20, 8,000.
guess it, thenthe move: read it
the line:why it is allowed: By line 4, a straight line of slope 3, as in question 2. By line 6, a doubling ratio of 8, three 2s, so slope 3 by question 3 too.
guess it, thenthe move: read it for any power
the line:why it is allowed: Each multiplied in adds one to the height, as in lines 2 to 4. So the power is the slope.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
the move: name the gap
the line:items marks apart 10 100 1,000 1 100 10,000 100,000 1 1,000 1,000,000 10,000,000 1 Each is ten times the beside it, so one mark higher. why it is allowed: Each line stands at its count's log. Let be the marks between them.
the move: multiplying adds the logs
the line:why it is allowed: Line 2 of question 1, with for .
guess it, thenthe move: cancel
the line:why it is allowed: added and taken away leaves nothing.
guess it, thenthe move: one ten
the line:why it is allowed: As in line 5 of question 1.
guess it, thenthe move: read it
the line:why it is allowed: Line 4 has no : one mark apart all along, so parallel, both slope 2. With 5 in front, the gap is the log of 5, about 0.699.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
the move: name the doubling ratio
the line:- the count,
- the slower part,
The count starts above and joins it as falls behind. items the count 10 100 100 200 100 10,000 1,000 11,000 1,000 1,000,000 10,000 1,010,000 is all of at 10 items, a tenth at 100, a hundredth at 1,000. why it is allowed: Let be the count at items over the count at . At 10 items it is 200, at 20 it is 600, so is 3.
the move: multiply out the top
the line:why it is allowed: is by lines 2 and 3 of question 3, and 10 times is .
guess it, thenthe move: fit the bottom into the top
the line:why it is allowed: Write the top of line 2 as 4 times the bottom, less something. is and , so take away. At 10 items, 4 × 200 less 20 × 10 is 600.
guess it, thenthe move: divide each part
the line:why it is allowed: A difference over a number is each part over it, one less the other.
guess it, thenthe move: cancel
the line:why it is allowed: is above zero, so it cancels, leaving 4.
guess it, thenthe move: divide top and bottom by n
the line:items the doubling ratio the slope 5 2.67 1.42 10 3 1.58 100 3.82 1.93 1,000 3.98 1.99 10,000 3.998 1.999 Line 6 at five sizes, rounded; each slope by question 3. why it is allowed: Top and bottom over , above zero. becomes 20, and becomes .
guess it, thenthe move: a ceiling
the line:why it is allowed: By line 6, 4 less something above zero.
guess it, thenthe move: read it
the line:why it is allowed: As grows, 20 over shrinks toward zero. So by line 6 climbs toward 4, and the slope toward 2 (question 3): 1.58 at 10 items, 1.99 at 1,000.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
the move: name the doubling ratio
the line:why it is allowed: Let be the count at items over the count at . At 4 items it is 8, at 8 it is 24, so is 3. From 2 items on, is above zero, so dividing by it is safe.
the move: use the growth ladder
the line:where does this come from?
question 2 of the page growth and the growth ladderDouble the input. How big is then? the move: put in twice the input
the line:why it is allowed: Let be at twice the input, with in place of each .
the move: use question 1
the line:why it is allowed: By line 2 of question 1 of the page growth and the growth ladder, is .
the move: multiply out the bracket
the line:items twice that at twice the items 4 8 16 8 24 1,000 9,966 19,932 2,000 21,932 a million 19,931,569 39,863,137 2,000,000 41,863,137 Twice , and more, each cell rounded from the unrounded value. The is half of twice at 4 items, about a tenth at 1,000 and about a twentieth at a million. why it is allowed: times 1 is , and times is . At 4 items, 8 and 16 make 24.
the move: read it
the line:why it is allowed: By line 3, twice and more; the table at line 3 shows the 's share falling as the log grows.
why it is allowed: On the page growth and the growth ladder, question 2 works out as .
guess it, thenthe move: divide top and bottom by n
the line:why it is allowed: Top and bottom over , above zero.
guess it, thenthe move: divide each part
the line:why it is allowed: A sum over a number is each part over it, added.
guess it, thenthe move: cancel
the line:why it is allowed: is above zero, so it cancels, leaving 2.
guess it, thenthe move: put the 2 first
the line:The gap to is about 0.5 marks at 10 items, 1 at 1,000 and 1.3 at a million: still widening, ever more slowly, so the slope falls toward 1. items the doubling ratio the slope 4 2 3 1.58 16 4 2.5 1.32 1,024 10 2.2 1.14 about a million 20 2.1 1.07 Line 6, rounded, and each slope by question 3. About a million is 1,048,576. why it is allowed: Either order makes the same total.
guess it, thenthe move: read it
the line:why it is allowed: As grows, grows without end, so 2 over it shrinks toward zero. By line 6 falls toward 2, and the slope toward 1, that of (question 3). But slowly, as line 6's table shows: only many doublings show it.
guess it, then
try it with a small : at , line 1 gives , which you can work out by hand
a worked example
A method takes 2,004,000 steps on 1,000 items and 8,008,000 on 2,000. What is its slope?
- 8,008,000 over 2,004,000 is about 3.996, the doubling ratio.
- It is close to 4, two 2s, so the slope is close to 2 (question 3).
- A calculator's log key gives log 3.996 as about 0.6016, and 0.6016 over 0.301 is about 1.999, by the last line of question 3.
- At 4,000 items it takes 32,016,000 steps: a ratio of about 3.998, a slope of about 1.999 again. So the count likely grows like ; only how it works can prove it.
the trap
check yourself
Doubling the input takes a count from 3,000 steps to 24,000. What slope does its line have?
the answer
24,000 over 3,000 is 8, three 2s, so slope 3, pointing to (question 4). Measure another size before you trust one doubling.
Two methods draw parallel straight lines, the second one mark above. What does that say about their costs?
the answer
The same slope. If both are a number times a power of , the powers match (questions 4 and 5). One mark up is ten times as much, so the second costs ten times the first.
Why is the line of not quite straight?
the answer
A straight line keeps one slope. Its doubling ratio, by question 7, changes with , 2.5 at 16 items and 2.1 at about a million. So its slope keeps falling, slowly.