Arithmetic and NumbersMathematics · Book 1
0 / 0

Shelves / Arithmetic and Numbers

AN·10

Powers, Roots, Scientific Notation and Logarithms

Repeated multiplication and its inverses: what powers are and why the exponent laws hold, why a⁰ = 1 and a⁻ⁿ = 1/aⁿ are forced, why −2² is −4, roots and fractional exponents, finding square roots by averaging, why areas scale by k² and volumes by k³, scientific notation for the very large and very small, compound growth in closed form, and logarithms: the exponent you need, why they turn multiplication into addition, how they count digits, and why every digit-counting formula in code eventually fails in floating point.

35 topics · ~31 min read · 15-question quiz
Updated Suggest a correction

Start here

What this chapter answers

Why is 23×24=27, and why is anything to the power 0 equal to 1? What does 2−3 mean, and 91/2? Is −22 equal to 4 or −4? How can you find 2 to fifty digits with a pencil? Why does a map twice the size need four times the paper? How do scientists write the mass of an electron, and how many years does money take to double at 8 %? What is a logarithm, and why does it count digits?

Powers in one picture

Fold a sheet of paper in half: 2 layers. Again: 4. Again: 8. After n folds there are 2n layers, 2×2×⋯×2 with n twos. Ten folds make 1,024 layers. That's a power: repeated multiplication, written with the number of repeats raised. Asking "how many folds give a million layers?" runs it backwards, and the answer, about 20, is a logarithm. This chapter is about going forwards (powers), sideways (roots) and backwards (logarithms).

Powers

Repeated multiplication

For a whole number n≥1, an means a multiplied by itself n times: an =a×a×⋯×a. The number a is the base and n the exponent (or power, or index). a2 is "a squared" (the area of a square of side a), a3 "a cubed" (a cube's volume). Powers grow fast: 210=1024, 220 is just over a million, 264 is 18,446,744,073,709,551,616.

The exponent laws

Counting factors gives every rule:

So 23×24=27=128, 109÷106=103, (52)3=56. What the laws don't say matters as much: am+an has no simpler form (23+24=24, not 27), and (a+b)2 is a2+2ab+b2, not a2+b2.

Zero and negative exponents

What should a0 and a−n mean? As with chapter 9's sign rules, ask what the laws force. If am/an=am−n is to hold when m=n, then a0=an/an=1 (for a≠0). And if it's to hold when m<n, then a−n =a0/an =1an. So 2−3=18, 10−2=0.01, and the pattern …,8,4,2,1,12,14,… halves at every step down, across zero, without a break. A negative exponent means "divide", not "negative": 2−3 is positive.

00 is the one awkward case: the pattern a0=1 says 1, while 0n=0 says 0. Most mathematics and most programming languages define 00=1 (Python's 0 ** 0 is 1), because that's what makes formulas for counting and for polynomials work; in calculus it's treated as undefined when it arises as a limit.

−2² and the order of operations

In −22, the power is done before the opposite: −22=−(22)=−4. To square −2, write (−2)2=4. This is a convention, chosen so that −x2 means "the opposite of x2" in algebra, and it's the one Python, most programming languages and mathematics use. Not every tool agrees: in many spreadsheets, =-2^2 gives 4, because the minus sign is applied first. When it matters, use brackets.

A negative base raised to a whole power has the sign rule of chapter 9: an even number of negative factors gives a positive result, an odd number a negative one: (−2)3=−8, (−1)100=1.

Powers of 10 and of 2

Place value (chapter 2) is built on powers of ten: 4,056 =4×103+0×102+5×101+6×100, and decimals continue with negative powers, 0.07=7×10−2. The metric prefixes are named powers of ten: kilo 103, mega 106, giga 109, milli 10−3, micro 10−6, nano 10−9. Computers count in powers of two, and 210=1024 is close to 103, which caused a lasting ambiguity: a "kilobyte" has meant both 1,000 and 1,024 bytes. Since 1998 the standard names are kB (103) and KiB, "kibibyte" (210); a disk sold as 1 TB holds about 0.91 TiB, a difference of 9 % that is pure notation.

Squares, cubes and scaling

Chapter 8 noted that a map at scale 1:n shrinks areas by n2. Powers explain why: if every length is multiplied by k, an area (a length times a length) is multiplied by k×k=k2, and a volume by k3. Double the side of a square and it needs four times the paint; double a cube's side and it holds eight times as much. A pizza of 30 cm diameter has (3020)2 =2.25 times the area of a 20 cm one, so at less than 2.25 times the price it's the better buy. This square–cube law is why an animal scaled up to twice the length needs much thicker legs: its weight grows with its volume (k3), the strength of its bones with their cross-section (k2).

Roots

Undoing a power

The square root a is the non-negative number whose square is a: 49=7, 0.25=0.5. Both 7 and −7 square to 49 (chapter 9), so "the" square root is defined as the non-negative one; the equation y2=49 has two solutions, ±7. Negative numbers have no square root among the numbers of this book (squares are never negative); numbers that do (the complex numbers) lie beyond this book. Similarly the cube root a3 is the number whose cube is a: 643=4, and −83=−2, since cubes keep the sign.

Roots of products split: ab=ab for non-negative a,b, so 50 =252 =52. Roots of sums don't: 9+16=5, not 3+4=7.

Fractional exponents

What should 91/2 mean? The law (am)n=amn forces it: (91/2)2=91=9, so 91/2 is a number whose square is 9: 91/2=9=3. In general a1/n=an and am/n =(an)m: 82/3=22=4, 32−3/5 =2−3 =18. (For negative bases this breaks down: (−8)1/3 could be −2, but (−8)2/6 would then have to equal (−86)2, which doesn't exist here. Most software returns a complex number or an error, as the lab shows.)

Finding a square root by averaging

Most square roots aren't fractions: 2 isn't, as chapter 12 proves. So how is 2=1.41421356… computed? A method known in Babylon and written down by Heron of Alexandria (first century CE): if g is a guess for a, then g and ag lie on opposite sides of a (their product is a), so their average is a better guess. From g=1 for 2: 1+22=32, then 12(32+43) =1712, then 577408 =1.414215… The number of correct digits roughly doubles at every step, which the lab measures. It's the same method calculators and computer libraries use, as Newton's method (beyond this book).

Interactive diagram: Square roots by averaging: √2 in four steps. It needs JavaScript; the text around it says the same.

Scientific notation

Writing the very large and the very small

Scientific notation writes a number as m×10k with 1≤m<10: the speed of light is about 3.00×108 m/s, a year about 3.16×107 seconds, the mass of an electron 9.11×10−31 kg. The exponent k says where the decimal point goes (the size); the mantissa m carries the digits. Calculators and programs write 9.11×10−31 as 9.11e-31.

To multiply, multiply the mantissas and add the exponents, then tidy: (3×108)×(3.16×107) =9.48×1015 metres in a light-year. To divide, divide and subtract: 6×10232×104 =3×1019. To add, first match the exponents: 4.2×105+3×103 =4.2×105+0.03×105 =4.23×105. Floating-point numbers (chapter 7) are scientific notation in base 2: a mantissa with 53 binary digits and an exponent, which is why a float can hold 10300 and 10−300 but only about 16 significant decimal digits of either.

Orders of magnitude

The exponent alone, the order of magnitude, is often all an estimate needs (chapter 11). India's population is about 1.4×109; a city of 107 is a hundredth of it, two orders of magnitude smaller. Comparing exponents is how scientists check that a calculation is in the right range before trusting its digits.

Growth, in closed form

Chapter 7 found that a 6 % rise every year for 5 years multiplies by 1.065. In general, an amount P growing by a rate r each period becomes, after n periods,

A=P(1+r)n.

This is compound growth, in closed form: one formula instead of n steps. ₹1,00,000 at 8 % a year is multiplied by 1.0810≈2.159, becoming about ₹2,15,892 in 10 years, and about ₹10 lakh in 30. A fall works the same way with a negative rate: a price that loses 15 % a year keeps 0.85n of its value. And the question "how long until it doubles?" asks for the n with (1+r)n=2, an exponent we don't know: that's what logarithms are for.

Logarithms

The exponent you need

The logarithm to base b of x is the power you must raise b to, to get x:

logbx=yexactly whenby=x.

So log28=3, log101000=3, log100.01=−2, log51=0. It's defined for positive x and positive bases other than 1. Logarithms grow very slowly: log10 of a billion is only 9, and log2 of a billion about 30. Common bases have short names: log10 (often written log), log2 (in computing), and ln, the natural logarithm, to base e≈2.71828, the base that makes the formulas of calculus simplest (beyond this book).

01001100
Powers grow fast: y = b^x (b = 2)
0.11000-312
Logarithms grow slowly: y = log_b x (b = 2)

The logarithm laws

Every exponent law has a logarithm law, because logarithms are exponents.

The first law is the one that changed history: to multiply two long numbers, look up their logarithms, add, and look up the number with that logarithm. Navigators and astronomers did this for three and a half centuries, and the slide rule does it mechanically, by adding lengths on two logarithmic scales.

Logarithms count digits

Chapter 2 showed that the numbers with k digits are those from 10k−1 up to 10k−1. Taking log10, a number n has k digits exactly when k−1≤log10n<k, so:

(⌊y⌋, the floor, is the largest whole number not above y.) 21000 has ⌊1000log102⌋+1 =⌊301.03⌋+1 =302 digits, found without computing it. The base-b version is the formula chapter 2's plot drew: a bigger base needs fewer digits, in proportion to 1logb. In code, though, floor(log10(n)) + 1 is computed in floating point, and the lab shows it giving the wrong answer for numbers as small as 1015−1.

Solving for an exponent

Now "how long until it doubles?" has an answer. (1+r)n=2 means n =log1+r2 =ln2ln(1+r). At 8 %: 0.6930.0770≈9.01 years. Because ln(1+r) is close to r for small rates, n≈0.693r≈72r%: the old rule of 72 (Luca Pacioli mentions it in 1494), which the lab tests. The same method finds how many halvings binary search needs (log2n), how many years until a price falls by half, or how many bits are needed to count to n.

Interactive diagram: Halving to one: why binary search takes log₂ n steps. It needs JavaScript; the text around it says the same.

Logarithmic scales

Quantities that range over many powers of ten are measured on logarithmic scales, where each step multiplies. Sound level in decibels is 10log10 of a power ratio, so +10 dB is ten times the sound power and +3 dB about double. Acidity's pH is −log10 of the hydrogen ion concentration, so pH 3 is ten times as acidic as pH 4. Each step of earthquake magnitude is about 32 times the energy. Charts of growth (prices over decades, epidemics, computer speeds) use a logarithmic axis so that steady percentage growth appears as a straight line.

Lab: powers and logarithms in code

Experiment 1: exact powers, and digits by logarithm

Python
import math
print(2 ** 10, 2 ** 64, len(str(2 ** 1000)), "digits in 2^1000")
print(2 ** -3, 10 ** 0, (-2) ** 2, -2 ** 2, (-8) ** (1 / 3))
# Counting digits with logarithms, and where floating point breaks the formula
for n in (999, 1000, 10**15 - 1, 10**15, 10**16 - 1, 10**23):
    by_log = math.floor(math.log10(n)) + 1
    print(f"{n:>24} len(str) {len(str(n)):>2}  floor(log10)+1 {by_log:>2}  {'ok' if by_log == len(str(n)) else 'WRONG'}")
Text
1024 18446744073709551616 302 digits in 2^1000
0.125 1 4 -4 (1.0000000000000002+1.7320508075688772j)
                     999 len(str)  3  floor(log10)+1  3  ok
                    1000 len(str)  4  floor(log10)+1  4  ok
         999999999999999 len(str) 15  floor(log10)+1 16  WRONG
        1000000000000000 len(str) 16  floor(log10)+1 16  ok
        9999999999999999 len(str) 16  floor(log10)+1 17  WRONG
100000000000000000000000 len(str) 24  floor(log10)+1 24  ok

Python's integers are exact at any size: 264 in full, and 21000 with its 302 digits, as the theorem predicted. 2 ** -3 is 0.125, 10 ** 0 is 1, and the order of operations shows: (-2) ** 2 is 4, -2 ** 2 is −4. (-8) ** (1/3) doesn't give −2: 13 isn't exactly representable, and Python returns a complex cube root rather than guessing. The digit-counting formula floor(log10(n)) + 1 is right for small numbers and wrong for 1015−1 and 1016−1: the float log10 of 999,999,999,999,999 rounds to exactly 15.0. For exact integers, count digits with len(str(n)), or with integer comparisons against powers of ten.

Experiment 2: square roots by averaging

Python
from fractions import Fraction as F
from decimal import Decimal, getcontext
getcontext().prec = 50
true = Decimal(2).sqrt()                                  # 50 digits, for checking
g = F(1)
for step in range(1, 7):
    g = (g + 2 / g) / 2                                   # average the guess and 2 / guess
    err = abs(Decimal(g.numerator) / Decimal(g.denominator) - true)
    shown = str(g) if len(str(g)) < 28 else f"({len(str(g.numerator))}-digit fraction)"
    print(f"step {step}: {shown:>27}   error below 10^{err.adjusted() + 1}")
Text
step 1:                         3/2   error below 10^-1
step 2:                       17/12   error below 10^-2
step 3:                     577/408   error below 10^-5
step 4:               665857/470832   error below 10^-11
step 5:   886731088897/627013566048   error below 10^-24
step 6:         (25-digit fraction)   error below 10^-48

Heron's averaging, done with exact fractions, gives 32, 1712, 577408, … The error falls from about 10−1 to 10−2, 10−5, 10−11, 10−24 and 10−48: each step roughly squares the error, doubling the number of correct digits. That's quadratic convergence, and it's why six steps from a crude guess of 1 reach 48 decimal places. The fractions themselves grow fast (25 digits by step 6), chapter 6's price of exactness again.

Experiment 3: doubling times and the rule of 72

Python
import math
for rate in (2, 4, 6, 8, 12, 18, 24):
    exact = math.log(2) / math.log(1 + rate / 100)        # years to double: (1 + r)^n = 2
    print(f"{rate:>2}% a year: doubles in {exact:5.2f} years; rule of 72 says {72 / rate:5.2f}")
print("₹1,00,000 at 8% for 10, 20, 30 years:", [round(100_000 * 1.08 ** n) for n in (10, 20, 30)])
Text
 2% a year: doubles in 35.00 years; rule of 72 says 36.00
 4% a year: doubles in 17.67 years; rule of 72 says 18.00
 6% a year: doubles in 11.90 years; rule of 72 says 12.00
 8% a year: doubles in  9.01 years; rule of 72 says  9.00
12% a year: doubles in  6.12 years; rule of 72 says  6.00
18% a year: doubles in  4.19 years; rule of 72 says  4.00
24% a year: doubles in  3.22 years; rule of 72 says  3.00
₹1,00,000 at 8% for 10, 20, 30 years: [215892, 466096, 1006266]

The exact doubling time is ln2ln(1+r). The rule of 72 is within a few months for rates from about 4 % to 12 %, and drifts at the ends: too long for small rates, too short for large ones (because 72 is a bit larger than 100ln2≈69.3, a deliberate choice that compensates for ln(1+r) being smaller than r near 8 %). ₹1 lakh at 8 % roughly doubles each 9 years: ₹2.16 lakh at 10 years, ₹4.66 lakh at 20, ₹10.06 lakh at 30.

Experiment 4: multiplying by adding, and counting halvings

Python
import math
# Multiplying by adding logarithms, as a slide rule does
a, b = 37.5, 2.48
print("log10:", round(math.log10(a), 5), "+", round(math.log10(b), 5), "=", round(math.log10(a) + math.log10(b), 5),
      "-> 10^that =", round(10 ** (math.log10(a) + math.log10(b)), 6), "| a * b =", a * b)
# How many halvings to find one item among n: binary search needs about log2(n) steps
for n in (1_000, 1_000_000, 1_000_000_000, 8_000_000_000):
    print(f"{n:>13,} items: {math.ceil(math.log2(n))} halvings")
Text
log10: 1.57403 + 0.39445 = 1.96848 -> 10^that = 93.0 | a * b = 93.0
        1,000 items: 10 halvings
    1,000,000 items: 20 halvings
1,000,000,000 items: 30 halvings
8,000,000,000 items: 33 halvings

Adding the logarithms of 37.5 and 2.48 and raising 10 to the sum gives their product, 93: a slide rule in five lines. The second part counts how many times a list can be halved before one item is left, ⌈log2n⌉: 10 halvings for a thousand items, 30 for a billion, 33 for eight billion. That's why binary search, and any "divide in half" strategy, stays fast however large the data grows.

Worked examples

Using the exponent laws

Scientific notation

Logarithms and growth

Exercises

Practice

  1. Evaluate: (a) 53; (b) 2−4; (c) (−3)4 and −34; (d) 163/4; (e) 1000−1/3.
  2. Simplify: (a) a5×a−2; (b) (104)3÷10−2; (c) 6×1073×10−2 in scientific notation.
  3. Write in scientific notation: (a) 7,350,000; (b) 0.000 006 02; (c) 48×10−7.
  4. Calculate (4.5×106)×(2.0×10−4) and (4.5×106)+(2.0×105).
  5. Find: (a) log10100,000; (b) log2132; (c) log77; (d) log93.
  6. Use the logarithm laws to write as one logarithm: log5+log4−log2. Evaluate it.
  7. A photo on a phone is 4,000 × 3,000 pixels. If both sides are halved, by what factor do the number of pixels and the file size (roughly) fall?
Answers
  1. (a) 125; (b) 116; (c) 81 and −81; (d) (164)3=8; (e) 110.
  2. (a) a3; (b) 1012÷10−2 =1014; (c) 2×109.
  3. (a) 7.35×106; (b) 6.02×10−6; (c) 4.8×10−6.
  4. 9.0×102=900; 4.5×106+0.2×106 =4.7×106.
  5. (a) 5; (b) −5; (c) 1; (d) 12, since 91/2=3.
  6. log5×42 =log10 =1.
  7. Lengths × 12, so pixels × (12)2 =14: from 12 million to 3 million, and the file roughly a quarter of the size.

Harder

  1. Explain why a0=1 using the pattern a3,a2,a1,…, and why the argument fails for a=0.
  2. Prove that a×b =ab for non-negative a,b. Then find values showing a+b≠a+b in general. When are they equal?
  3. Show that logbx×logxb=1. Use it to find log82 from log28.
  4. A bacterium divides every 20 minutes. Starting from one, how many are there after 6 hours? About how long until there are a billion (230≈109)?
  5. A price falls 20 % every year. After how many whole years is it below half its starting value? Below a tenth?
Answers
  1. Each step down the pattern divides by a: a3÷a=a2, a2÷a=a1, so the next is a1÷a=1. For a=0, the step "divide by a" is division by zero, so the pattern gives no value for 00; it's defined as 1 by convention where needed.
  2. (ab)2 =(a)2(b)2 =ab, and ab≥0, so it's the non-negative square root of ab. For sums: 9+16=5≠7. Squaring a+b gives a+b+2ab, so they're equal only when ab=0: when a or b is 0.
  3. With change of base, logbx =lnxlnb and logxb =lnblnx; their product is 1. log28=3, so log82=13 (indeed 81/3=2).
  4. 6 hours is 18 divisions: 218=262,144. A billion is about 230: 30 divisions, 10 hours.
  5. 0.8n<0.5: n>ln0.5ln0.8 =3.11, so after 4 years (0.83=0.512, 0.84=0.4096). 0.8n<0.1: n>ln0.1ln0.8 =10.3, so after 11 years.

Challenge

  1. Show that the averaging method for a satisfies gnew−a =(g−a)22g. Explain why this means the number of correct digits roughly doubles each step once g is close, and why every guess after the first is at least a.
Discussion

gnew =12(g+ag) =g2+a2g. Subtract a =2ga2g: gnew−a =g2−2ga+a2g =(g−a)22g. The new error is the old error squared, divided by 2g (about 2a once g is close). If the error is about 10−k, the next is about 10−2k divided by a constant: twice as many correct digits. And since a square is never negative and g>0, gnew−a≥0: every new guess is at least a, approaching from above (the lab's guesses 32,1712,577408 are all just above 2).

In real life

Misconceptions and limits

The model to keep

Common misconceptions

Misconception What's actually true Where it's shown
"23×24=47" or "23+24=27". Same base: exponents add when multiplying: 27. Sums of powers don't combine. The exponent laws
"2−3 is negative." It's 18: a negative exponent means divide. Zero and negative exponents
"a0=0." a0=1 for a≠0, forced by an/an. Zero and negative exponents
"−22=4." −(22)=−4; (−2)2=4. Some spreadsheets disagree. −2² and the order of operations
"a+b =a+b." Roots split over products, not sums: 25≠3+4. Undoing a power
"Doubling the size doubles the area." Area scales by k2: four times. Volume by k3: eight times. Squares, cubes and scaling
"log(x+y) =logx+logy." It's log(xy)=logx+logy; logarithms of sums don't split. The logarithm laws
"floor(log10(n)) + 1 always counts digits." In floating point it fails, from 1015−1 up. Experiment 1

Limits and trade-offs

  • Real exponents need real numbers. 22 and log102 aren't fractions; defining them properly needs the real numbers of chapter 12 and limits (beyond this book).
  • Negative bases and fractional exponents don't mix. (−8)1/3 is −2 by one reading and undefined (or complex) by another; software usually refuses or returns a complex number.
  • Logarithms in code are approximate. Every formula built on a floating-point logarithm (digit counts, bit lengths, doubling times) can be off by one at the boundaries; use exact integer methods when an exact answer is needed (len(str(n)), n.bit_length(), math.isqrt).
  • Exponential growth doesn't last. P(1+r)n describes steady percentage growth; real populations, epidemics and markets slow down as they meet limits, and extrapolating a power far ahead is a common forecasting error.

Revision sheet

Key ideas

  • an =a×⋯×a (n factors). Laws: aman=am+n, am/an=am−n, (am)n=amn, (ab)n=anbn.
  • Forced by the laws: a0=1, a−n=1/an, a1/n=an, am/n=(an)m.
  • −22=−4, (−2)2=4; even powers of negatives are positive, odd negative.
  • Scaling: lengths × k → areas × k2, volumes × k3.
  • Roots: a is the non-negative root; ab=ab; a+b≠a+b. Heron: average g and a/g; digits double each step.
  • Scientific notation m×10k, 1≤m<10: multiply mantissas, add exponents; match exponents to add.
  • Compound growth: A=P(1+r)n; doubling time ln2ln(1+r)≈72r%.
  • Logarithm: logbx=y⟺by=x. Laws: products → sums, quotients → differences, powers → multiples; change of base logbx =logxlogb.
  • Digits: ⌊log10n⌋+1 (base b: ⌊logbn⌋+1); halvings to one item: ⌈log2n⌉.

Glossary

  • Power (exponentiation): repeated multiplication, an.
  • Base: the number being raised to a power, a in an; also the base of a logarithm.
  • Exponent (index): the number of factors, n in an; extended to zero, negative and fractional values.
  • Square root: the non-negative number whose square is a given number.
  • Cube root / nth root: the number whose cube (nth power) is a given number.
  • Scientific notation: writing a number as m×10k with 1≤m<10.
  • Mantissa: the digits part m of a number in scientific notation.
  • Order of magnitude: the power of ten of a number's size.
  • Compound growth: growth by the same percentage each period, P(1+r)n.
  • Logarithm: the exponent to which a base must be raised to give a number, logbx.
  • Natural logarithm: the logarithm to base e≈2.718, written ln.
  • Logarithmic scale: a scale on which equal steps are equal multiplications.
  • Doubling time: how long a steadily growing quantity takes to double, ln2ln(1+r).
  • Square–cube law: when lengths scale by k, areas scale by k2 and volumes by k3.