Basis Lab

Answers · The mathematics underneath

How do I estimate something to the nearest order of magnitude?

In shortRound every factor to one digit times a power of ten, multiply the digits roughly, add the exponents, and report the nearest power of ten.

Round every factor to one digit times a power of ten, multiply the digits loosely, add the exponents, and report the answer as the nearest power of ten. The digits barely matter, since even being crude with them moves the answer by less than a factor of ten, whereas the exponents are the whole answer: changing one exponent by one changes the result by a factor of ten. So the method is one easy multiplication of small numbers and one careful addition of small integers.

X≈(d1d2⋯dn)×10 e1+e2+⋯+enX \approx (d_1 d_2 \cdots d_n) \times 10^{\,e_1 + e_2 + \cdots + e_n}

A year of logs, by hand

Take a concrete question: how much disk does a year of request logs need? You need four factors, each of which you can bound without looking anything up.

FIG 1
the factora round guessas a digit times a power of ten
requests per second, at the busy hourabout 3003 x 10^2
seconds in a yearabout 30 million3 x 10^7
busy fraction of the dayabout a third3 x 10^-1
bytes per log lineabout 5005 x 10^2

Now the two steps, in order. First the digits, rounded hard: 3×3×3×5=1353 \times 3 \times 3 \times 5 = 135, which is 10210^2 near enough. Then the exponents, which are added and not multiplied, because a product of powers of ten has exponents that add.

3×3×3×5=135≈102,2+7+(−1)+2=103\times 3\times 3\times 5 = 135 \approx 10^{2}, \qquad 2 + 7 + (-1) + 2 = 10

Put them together: 102×1010=101210^2 \times 10^{10} = 10^{12} bytes, one terabyte. As a check, the exact product is 300×3×107=9×109300 \times 3\times 10^{7} = 9\times 10^{9}, divided by three gives 3×1093\times 10^{9}, times 500500 gives 1.5×10121.5\times 10^{12}. The estimate came out at 101210^{12}, low by a factor of 1.5, and the digit step is where that 1.35 (135 rounded down to 100) went.

Why the sloppy version is the reliable one

The natural guess is that you should carry the awkward numbers exactly, so 31,536,00031{,}536{,}000 seconds in a year rather than 30 million, and divide by the busy fraction with full precision. That fails in two ways. The precision is wasted, because an error of a factor of two in a digit is log⁡102=0.30\log_{10} 2 = 0.30 in the exponent, while getting one exponent wrong by one is a full 1.01.0: ten times the damage from a third of the effort. And forcing exactness pushes you towards numbers you do not have, so you end up inventing traffic figures rather than bounding them. Rounding each factor to one digit and a power of ten gives a worked answer instead of a stalled one.

Four guesses each wrong by up to a factor of three would compound to 34=813^4 = 81 if they all erred the same way. They do not, because a guess is as likely to be too high as too low, and the errors add in the exponent as signed numbers. Each contributes at most log⁡103=0.48\log_{10} 3 = 0.48 to the exponent, with standard deviation 0.48/3≈0.280.48/\sqrt{3} \approx 0.28; four of them added in quadrature give 0.28×4=0.560.28 \times \sqrt{4} = 0.56, and 100.56≈3.610^{0.56} \approx 3.6. So the realistic error is a factor of three or four, not eighty. This also tells you where to spend effort: fix the shakiest factor and leave the rest alone.

The method stops being useful when the two things you are comparing lie within a factor of ten of each other, which is exactly when two designs are genuinely competitive. Then the estimate has not settled the question; it has shown the question needs measuring, and that is a result worth reporting. It also fails when every guess shares a bias, since a consistent pessimism does not cancel. Estimating in the busy case for one factor and the quiet case for another is fine; estimating everything for the busiest day of the year is not. Say the answer as a range and name the weakest factor in the same breath, so that whoever knows the real figure can replace your guess with it.

Worth keeping

  • Rounding a factor to one digit and a power of ten costs at most about half a decade in the exponent, which is why the digits can be brutal and the exponents cannot.
  • In a product of guesses the errors are signed and partly cancel, so uncertainty grows with the square root of the number of factors, not with the number of factors.
  • An estimate is reported as a range plus the name of its shakiest assumption, which is what lets somebody in the room correct it.

Where this goes next

This question is one step of Logarithms, Growth and Scale, a course that works through its subject from the beginning. The page that teaches this part of it is Thinking in Orders of Magnitude, and it reads the whole way through whether or not you have an account.

What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.

Read that pageThe whole course

Other questions people ask about this

  1. What does log base 2 of 8 actually mean?It is the exponent you must put on two to get eight, and that exponent is three.
  2. Why do we use e as the base of natural logarithms instead of 10?The base e is used because it makes growth calculus clean: the derivative of e to the x is itself, while base ten leaves a factor of about 2.3026 in every derivative.
  3. Why do machine learning models use log loss instead of just multiplying probabilities?Multiplying many probabilities underflows to zero on a computer; adding their logarithms keeps the same score and stays representable.
  4. What is the difference between a half-life and a decay rate?A half-life is the time for an amount to be multiplied by one half, while a decay rate says how fast that multiplication happens, either continuously or as a per-step factor.
  5. What is the difference between variance and standard deviation?They measure the same spread: variance is the average squared distance from the mean, standard deviation is its square root, so you report the standard deviation and calculate with the variance.
  6. How do you make a vague claim precise enough to tell whether it's true?Fix what is being talked about, what is asserted, which cases are covered and the cut-off, then name an observation that would prove it false.

Read alongside