Volume 1: Foundations to Precalculus · Part I: Foundations
Chapter 3. Exponents, Roots, and Scientific Notation
Chapter map: an exponent is shorthand for repeated multiplication, and from that one idea everything else in this chapter is derived rather than memorised: the laws of exponents, why \(a^0 = 1\), why a negative exponent means a reciprocal, why a fractional exponent means a root. We then put powers to work — simplifying surds, writing very large and very small numbers in scientific notation, reasoning in orders of magnitude, and living in the powers-of-two world of computer memory. We finish with a first look at exponential growth and its inverse, the logarithm, and with one of the most elegant algorithms in computing: exponentiation by squaring.
Why it matters: powers are the language of scale. Compound interest, half-lives of medicines, the inverse-square law of light and gravity, the size of a pizza, how many passwords an attacker must try, how much memory a 64-bit pointer can address, and why some algorithms finish in a blink while others never finish at all are all questions about exponents.
3.1. Exponents as repeated multiplication
3.1.1. The problem
Take a sheet of paper 0.1 mm thick and fold it in half. It is now 0.2 mm thick. Fold again: 0.4 mm. How many folds until the stack would reach the Moon, 384,000 km away? Most people guess thousands, or millions. The answer is 42. Repeated doubling grows so violently that ordinary intuition, trained on repeated adding, fails completely. We need notation for repeated multiplication, and then we need to learn to think with it.
3.1.2. Notation and vocabulary
Just as multiplication abbreviates repeated addition (\(3 \times 4 = 4 + 4 + 4\)), an exponent abbreviates repeated multiplication:
The underbrace says "count the factors underneath: there are \(n\) of them". So \(2^5 = 2 \times 2 \times 2 \times 2 \times 2 = 32\), and after \(n\) folds the paper is \(0.1 \times 2^n\) mm thick.
|
Base, exponent, power
In \(a^n\), \(a\) is the base and \(n\) is the exponent (also called the index — plural indices — or power). The whole expression \(a^n\) is "a power of \(a\)" and is read "\(a\) to the \(n\)", "\(a\) to the power \(n\)", or "\(a\) raised to the \(n\)th". \(a^1 = a\). In code it is written |
|
Squared, cubed
\(a^2\) is read "\(a\) squared" because it is the area of a square with side \(a\); \(a^3\) is "\(a\) cubed", the volume of a cube with edge \(a\). A perfect square is the square of an integer (1, 4, 9, 16, 25, …); a perfect cube is the cube of one (1, 8, 27, 64, …). |
Back to the paper. After 42 folds the thickness is \(0.1 \times 2^{42}\) mm. We will see in Section 3.7 that \(2^{10} \approx 1000\), so \(2^{40} = (2^{10})^4 \approx 10^{12}\) and \(2^{42} \approx 4 \times 10^{12}\). That makes \(0.1 \times 4 \times 10^{12} = 4 \times 10^{11}\) mm \(= 4 \times 10^5\) km: about 400,000 km, beyond the Moon. (Physically you cannot fold paper more than about 7 times — the point is the arithmetic.)
3.1.3. Failure modes
|
Exponent mistakes worth avoiding from day one
|
3.2. The laws of exponents, derived
3.2.1. The problem
Simplify \(\dfrac{x^7 \cdot (x^2)^3}{x^4}\). You might remember rules like "add the exponents" and "multiply the exponents", but which applies when? If the rules are derived rather than memorised, you never need to remember them: you can re-derive any of them in ten seconds by counting factors.
3.2.2. Why they work: counting factors
Product law. \(a^m \cdot a^n\): write out the factors.
Example: \(2^3 \cdot 2^2 = (2 \cdot 2 \cdot 2)(2 \cdot 2) = 2^5\). The exponents add because the factors are just pooled (associative law).
Quotient law. \(\dfrac{a^m}{a^n}\) with \(m > n\) and \(a \neq 0\): each of the \(n\) factors downstairs cancels one of the \(m\) factors upstairs.
Example: \(\dfrac{5^6}{5^2} = \dfrac{5 \cdot 5 \cdot 5 \cdot 5 \cdot (5 \cdot 5)}{(5 \cdot 5)} = 5^4\).
Power of a power. \((a^m)^n\) is \(n\) copies of \(a^m\) multiplied together, and each copy contains \(m\) factors of \(a\):
Example: \((2^3)^2 = 2^3 \cdot 2^3 = 2^6\).
Power of a product and power of a quotient. Rearranging factors (commutative and associative laws):
Collected:
|
Laws of exponents
For non-zero bases and integer exponents: \(a^m a^n = a^{m+n}\), \(a^m / a^n = a^{m-n}\), \((a^m)^n = a^{mn}\), \((ab)^n = a^n b^n\), \((a/b)^n = a^n / b^n\), \(a^0 = 1\), \(a^{-n} = 1/a^n\). They extend to fractional exponents for positive bases. Each can be re-derived by writing out the factors. |
3.2.3. The method
Input: a product/quotient of powers.
Steps:
-
Expand any power of a product or quotient: \((ab)^n \to a^n b^n\).
-
Apply power-of-a-power: \((a^m)^n \to a^{mn}\).
-
For each base, combine everything into a single power: add exponents of factors on top, subtract exponents of factors on the bottom.
-
Rewrite any negative exponents as reciprocals if the answer should have positive exponents (Section 3.3).
-
Evaluate numerical powers if small.
Output: a product of powers of distinct bases.
3.2.4. Worked examples
Example 1. The opening problem.
Example 2. Several bases.
Example 3. Different bases that are secretly the same: \(8^3 \cdot 4^2\).
Rewriting numbers as powers of a common base is the standard trick for exponential equations in Chapter 12.
3.2.5. Failure modes
|
Things the laws do not say
|
3.2.6. Where you’d use this
-
Area and volume scale as powers. A 16-inch pizza versus a 12-inch one: the area ratio is \((16/12)^2 = (4/3)^2 = 16/9 \approx 1.78\), so the larger pizza is almost 80% more food, not 33% more. Double every edge of a box and its volume grows by \(2^3 = 8\). This is the square–cube law: a giant ant scaled up 10 times would weigh \(10^3 = 1000\) times as much but have legs only \(10^2 = 100\) times as strong in cross-section, which is why large animals have thick legs.
-
Unit conversions with powers. \(1 \text{ km}^2 = (10^3 \text{ m})^2 = 10^6 \text{ m}^2\) (power of a product, then power of a power). Forgetting to square the conversion factor is one of the commonest errors in physics homework and in real engineering.
-
Counting in computing. A pixel with 8 bits each for red, green, and blue can be one of \(2^8 \cdot 2^8 \cdot 2^8 = 2^{24} = 16\,777\,216\) colours (product law). A 4-digit PIN has \(10^4\) possibilities; a 6-digit one, \(10^6\), which is 100 times harder to guess.
|
Exponent rule checker
Enter an exponent "rule" — true or false — such as \((a + b)^n = a^n + b^n\) or \(a^m a^n = a^{mn}\). The app tests it on random numbers and shows a counterexample if one exists, or a factor-counting picture (rows of coloured tiles for each factor) if it holds. |
3.2.7. Exercises
-
Simplify: (a) \(x^4 \cdot x^5\); (b) \(\dfrac{y^{10}}{y^3}\); (c) \((z^3)^4\); (d) \((3p^2q)^3\).
-
Simplify \(\dfrac{(4m^2n^3)^2}{8m^3n^5}\).
-
Write \(27^2 \cdot 9^3 / 3^5\) as a single power of 3.
-
Is \(2^{10} + 2^{10} = 2^{11}\) or \(2^{20}\)? Explain.
Answers
-
(a) \(x^9\). (b) \(y^7\). (c) \(z^{12}\). (d) \(27p^6q^3\).
-
Numerator \(16m^4n^6\); divide: \(\tfrac{16}{8} m^{4-3} n^{6-5} = 2mn\).
-
\((3^3)^2 \cdot (3^2)^3 / 3^5 = 3^6 \cdot 3^6 / 3^5 = 3^{7}\).
-
\(2^{10} + 2^{10} = 2 \cdot 2^{10} = 2^1 \cdot 2^{10} = 2^{11}\). Adding two equal things doubles; it does not multiply the exponents.
3.3. Zero and negative exponents
3.3.1. The problem
"\(a^n\) means \(n\) factors of \(a\)" makes sense for \(n = 1, 2, 3, \ldots\). But what could \(2^0\) mean — zero factors of 2? Or \(2^{-3}\), negative three factors? These are not questions about the definition (which has nothing to say) but about how to extend it. We want an extension that keeps the laws of exponents working. It turns out there is exactly one.
3.3.2. Intuition: follow the pattern
Read the powers of 2 from right to left: each step to the left divides by 2.
If the pattern is to continue — and there is no reason to put a break in it — then \(2^0\) must be 1 and \(2^{-n}\) must be \(\tfrac{1}{2^n}\).
3.3.3. Why it works: the laws force it
Insist that the quotient law \(\tfrac{a^m}{a^n} = a^{m-n}\) keeps working when \(m = n\). The left side is something divided by itself:
So \(a^0 = 1\) for every \(a \neq 0\). Now insist that the product law keeps working for a negative exponent:
So \(a^{-n}\) is the number which, multiplied by \(a^n\), gives 1 — the reciprocal of \(a^n\):
This is a recurring pattern in mathematics: a definition is first made where it obviously makes sense, then extended in the unique way that preserves the rules. You will see it again with fractional exponents (next section), with \(0! = 1\) (Chapter 24), and with complex exponents (Chapter 15).
|
Zero and negative exponents
For any \(a \neq 0\): \(a^0 = 1\) (the empty product), and \(a^{-n} = \dfrac{1}{a^n}\). A negative exponent means "reciprocal", not "negative": \(2^{-3} = \tfrac{1}{8}\), which is positive. A negative exponent on a fraction flips it: \(\left(\tfrac{a}{b}\right)^{-n} = \left(\tfrac{b}{a}\right)^n\). |
3.3.4. Worked examples
In the last line, note \(b^{3 - (-1)} = b^4\): subtracting a negative exponent is adding (Section 1.5). An equivalent shortcut is "a factor with a negative exponent may move across the fraction bar and change the sign of its exponent".
|
The empty product and \(0^0\)
\(a^0 = 1\) for the same reason an empty sum is 0: 1 is what you start with before multiplying anything in (it is the multiplicative identity, Section 1.4). In code, |
|
\(0^{-1}\)
\(0^{-n}\) for \(n > 0\) would be \(\tfrac{1}{0^n} = \tfrac{1}{0}\), which is undefined (Section 1.4). Python raises |
3.3.5. Where you’d use this
-
Medicine. Caffeine has a half-life of roughly 5 hours. After \(n\) half-lives a fraction \(2^{-n}\) remains: 200 mg drunk at 2 p.m. leaves about \(200 \times 2^{-2} = 50\) mg in your system at midnight. Drug dosing schedules are designed with exactly this calculation.
-
Physics: inverse-square laws. Light intensity, gravity, and radio signal strength fall off as \(r^{-2}\). Move three times further from a lamp (or a Wi-Fi router) and you receive \(3^{-2} = \tfrac{1}{9}\) of the power. Units use negative exponents too: acceleration in \(\text{m}\,\text{s}^{-2}\), density in \(\text{kg}\,\text{m}^{-3}\).
-
Computing. Binary place values to the right of the point are \(2^{-1}, 2^{-2}, 2^{-3}, \ldots\) (Section 2.8). Machine-learning learning rates, tolerances, and probabilities are routinely written as \(10^{-3}\) or
1e-3.
3.3.6. Exercises
-
Evaluate: \(10^{-3}\), \(4^{-1}\), \((-3)^{-2}\), \(\left(\tfrac{1}{2}\right)^{-4}\), \(7^0\), \((-7)^0\), \(-7^0\).
-
Simplify, giving the answer with positive exponents: \(\dfrac{x^{-2}y^5}{x^4y^{-3}}\).
-
Use the product law to explain why \(10^{-3} \times 10^{5} = 100\).
Answers
-
\(0.001\); \(\tfrac{1}{4}\); \(\tfrac{1}{9}\) (even power: positive); \(2^4 = 16\); \(1\); \(1\); \(-1\) (the minus is outside the power).
-
\(x^{-2-4} y^{5-(-3)} = x^{-6} y^{8} = \dfrac{y^8}{x^6}\).
-
\(10^{-3} \times 10^5 = 10^{-3+5} = 10^2 = 100\). In words: dividing by 1000 then multiplying by 100,000 is a net multiplication by 100.
3.4. Roots and fractional exponents
3.4.1. The problem
A square room has area 20 square metres. How long is each wall? We need to undo squaring. More generally, if we know \(x^n\) and want \(x\), we need an inverse of raising to a power. Root notation does this; fractional exponents turn out to be the same idea in a form that obeys the exponent laws.
3.4.2. Intuition and vocabulary
|
Square root, cube root, nth root
A square root of \(a\) is a number whose square is \(a\). Every positive number has two (\(3\) and \(-3\) are both square roots of 9). The symbol \(\sqrt{a}\) — the radical sign over the radicand \(a\) — means the principal (non-negative) square root: \(\sqrt{9} = 3\). A cube root \(\sqrt[3]{a}\) satisfies \((\sqrt[3]{a})^3 = a\); every real number has exactly one real cube root (\(\sqrt[3]{-8} = -2\)). In general \(\sqrt[n]{a}\) is the nth root; the small \(n\) is the index of the root. |
Negative numbers have no real square root, because any real number squared is non-negative (positive × positive and negative × negative are both positive). That gap is the one the complex numbers fill (Chapter 15).
Geometrically, \(\sqrt{a}\) is the side of a square of area \(a\). The picture below constructs a square of area exactly 2 on a unit grid, so its side has length exactly \(\sqrt{2}\) — a length you can draw perfectly but (Section 1.1) never write as a fraction.
3.4.3. Why it works: fractional exponents
What should \(9^{1/2}\) mean? Once again, demand that the laws keep working. Power-of-a-power says
So \(9^{1/2}\) is a number whose square is 9: a square root of 9. We choose the positive one. In general, for \(a > 0\),
The second formula follows from \(a^{m/n} = (a^{1/n})^m = (a^m)^{1/n}\), both of which are power-of-a-power. The denominator of the exponent is the root; the numerator is the power.
|
Rational exponents
For \(a > 0\) and integers \(m\), \(n\) with \(n > 0\): \(a^{1/n} = \sqrt[n]{a}\) and \(a^{m/n} = (\sqrt[n]{a})^m\). All the laws of exponents continue to hold. So \(\sqrt{x} = x^{1/2}\), \(\dfrac{1}{\sqrt{x}} = x^{-1/2}\), \(\sqrt[3]{x^2} = x^{2/3}\). Converting roots to fractional exponents is how calculus handles them (Chapter 17). |
Squaring and square-rooting undo each other (for non-negative numbers), so their graphs are mirror images in the line \(y = x\): a point \((a, b)\) on one corresponds to \((b, a)\) on the other. This mirror relationship between a function and its inverse is a central idea of Chapter 11.
3.4.4. The method
Input: a positive base \(a\) and a fraction \(m/n\) (in lowest terms, \(n > 0\)).
Steps:
-
If \(m < 0\), compute \(a^{|m|/n}\) and take the reciprocal at the end.
-
Take the \(n\)th root first (it keeps numbers small): \(r = \sqrt[n]{a}\).
-
Raise to the \(m\)th power: \(r^m\).
Output: \(a^{m/n}\).
3.4.5. Worked examples
Root first versus power first: \(16^{3/4}\) as \(\sqrt[4]{16^3} = \sqrt[4]{4096}\) gives the same 8, but finding the fourth root of 4096 by hand is far harder. Root first is the right choice whenever the root comes out exactly.
3.4.6. Alternative approach: computing a root numerically
When the root is not exact (\(\sqrt{20}\)), you can estimate it. \(\sqrt{20}\) lies between \(\sqrt{16} = 4\) and \(\sqrt{25} = 5\), closer to 4. A classical algorithm, the Babylonian method, improves any guess \(g\) by averaging it with \(20 / g\): if \(g\) is too big then \(20/g\) is too small, and the average is better than either.
Two steps already give \(\sqrt{20} \approx 4.47214\) (true value \(4.472135955\ldots\)). The number of correct digits roughly doubles each step. This is Newton’s method in disguise; Chapter 18 and Chapter 32 explain why it converges so fast.
3.4.7. Failure modes
|
Roots: the classic errors
|
3.4.8. Where you’d use this
-
Everyday. The square room with area 20 m² has walls of \(\sqrt{20} \approx 4.47\) m. A TV’s diagonal comes from Pythagoras (Chapter 9): a screen 30 by 40 inches is \(\sqrt{30^2 + 40^2} = \sqrt{2500} = 50\) inches across.
-
Music. Equal temperament splits an octave (a doubling of frequency) into 12 equal ratios, so each semitone multiplies the frequency by \(2^{1/12} \approx 1.0595\). Concert A is 440 Hz; the next note up, A♯, is \(440 \times 2^{1/12} \approx 466.2\) Hz.
-
Physics. An object dropped from height \(h\) (ignoring air resistance) hits the ground after \(t = \sqrt{2h/g}\): from 20 m, \(\sqrt{40/9.81} \approx 2.0\) s. A pendulum of length 1 m has period \(2\pi\sqrt{L/g} \approx 2.0\) s, which is why old clocks had metre-long pendulums.
-
Finance. Fractional exponents turn total growth into a yearly rate. An investment that doubles in 10 years grew by a factor \(2^{1/10} \approx 1.072\) each year: about 7.2% a year.
-
Computing. The distance between two points in a game or a map is \(\sqrt{\Delta x^2 + \Delta y^2}\). Code that only needs to know which of two objects is closer compares the squared distances instead, skipping the square root entirely. Root-mean-square error, the standard measure of a regression model’s accuracy, is a square root of an average of squares (Chapter 31).
|
Where the radical sign came from
"Radical" comes from Latin radix, "root" (as in radish). The symbol √ is thought to derive from a stylised lowercase r, first printed in Christoff Rudolff’s Coss of 1525. The bar over the radicand (the vinculum) was added by Descartes in 1637 to show how far the root extends — the same bar that became the fraction bar. |
|
Root finder
Drag a square’s side until its area matches a target (say 20) and watch the side length converge; then switch to the Babylonian method and step it, showing each guess and its partner \(20/g\) closing in from opposite sides of the true root. Try it: Babylonian square-root stepper |
3.4.9. Exercises
-
Evaluate: \(\sqrt{144}\), \(\sqrt[3]{-125}\), \(32^{1/5}\), \(32^{3/5}\), \(9^{-3/2}\).
-
Write as a power of \(x\): \(\sqrt{x}\), \(\dfrac{1}{x\sqrt{x}}\), \(\sqrt[4]{x^3}\).
-
Solve \(x^2 = 50\) exactly and approximately (two Babylonian steps from \(g_0 = 7\)). Try it: Step √50 from 7.
Answers
-
\(12\); \(-5\); \(2\); \(2^3 = 8\); \(\tfrac{1}{(\sqrt{9})^3} = \tfrac{1}{27}\).
-
\(x^{1/2}\); \(x^{-1} \cdot x^{-1/2} = x^{-3/2}\); \(x^{3/4}\).
-
\(x = \pm\sqrt{50} = \pm 5\sqrt{2}\) (see Section 3.5). \(g_1 = \tfrac12(7 + \tfrac{50}{7}) = \tfrac12(7 + 7.142857) = 7.071429\); \(g_2 = \tfrac12(7.071429 + 7.070707) = 7.071068\). So \(x \approx \pm 7.0711\).
3.5. Surds: simplifying radicals and rationalising denominators
3.5.1. The problem
Your calculator says \(\sqrt{50} = 7.0710678\ldots\) and \(\tfrac{1}{\sqrt 2} = 0.7071067\ldots\). Notice anything? The digits are the same. Exact forms make such relationships visible — \(\sqrt{50} = 5\sqrt{2}\) and \(\tfrac{1}{\sqrt{2}} = \tfrac{\sqrt{2}}{2}\) — while decimals hide them. In geometry, trigonometry, and the quadratic formula, exact answers involving roots appear constantly, and you need to be able to put them in a standard simplest form.
|
Surd, radical form
A surd (UK usage) or radical (US usage) is an irrational root such as \(\sqrt{2}\) or \(\sqrt[3]{5}\), left in exact form rather than as a decimal. Simplest radical form means: no perfect-square factor under a square root, no root in a denominator, and no fraction under a root. Like surds have the same radicand (\(3\sqrt{2}\) and \(5\sqrt{2}\)) and can be added like like terms. |
3.5.2. Why it works
For \(a, b \ge 0\), the power-of-a-product law with exponent \(\tfrac{1}{2}\) gives
So we can split a radicand into a perfect square times something else and pull the perfect square out.
3.5.3. The method
Input: \(\sqrt{n}\) for a positive integer \(n\).
Steps:
-
Find the prime factorisation of \(n\) (Section 1.8).
-
Pair up equal primes. Each pair \(p \cdot p = p^2\) comes out of the root as a single \(p\).
-
Multiply the extracted primes together (outside) and the unpaired primes together (inside).
Output: \(k\sqrt{m}\) where \(m\) has no square factor greater than 1.
Input: a fraction with a square root in the denominator.
Steps:
-
If the denominator is \(c\sqrt{b}\): multiply top and bottom by \(\sqrt{b}\), using \(\sqrt{b}\sqrt{b} = b\).
-
If the denominator is \(a + \sqrt{b}\) (or \(a - \sqrt{b}\)): multiply top and bottom by the conjugate \(a - \sqrt{b}\) (or \(a + \sqrt{b}\)), using \((a + \sqrt{b})(a - \sqrt{b}) = a^2 - b\).
-
Simplify.
Output: an equivalent fraction with a rational denominator.
The conjugate trick works because of the difference of two squares, \((x + y)(x - y) = x^2 - y^2\), which you can check with the distributive law: \(x^2 - xy + yx - y^2 = x^2 - y^2\). The cross terms cancel, and squaring kills the root.
3.5.4. Worked examples
Simplify \(\sqrt{72}\).
The shortcut, when you can spot it, is to find the largest perfect-square factor: \(72 = 36 \times 2\), so \(\sqrt{72} = \sqrt{36}\sqrt{2} = 6\sqrt{2}\).
Add surds: \(\sqrt{50} + \sqrt{18} - \sqrt{8} = 5\sqrt{2} + 3\sqrt{2} - 2\sqrt{2} = 6\sqrt{2}\). Only after simplifying are they visibly like surds.
Rationalise: \(\dfrac{6}{\sqrt{3}}\).
Rationalise with a conjugate: \(\dfrac{4}{3 - \sqrt{5}}\).
3.5.5. Choosing a method, and why bother
-
For simplifying: if you can see a perfect-square factor (4, 9, 16, 25, 36, 49, 64, 81, 100, …), use it directly; otherwise factorise.
-
Rationalising was originally about hand computation: \(\tfrac{1}{\sqrt{2}} = \tfrac{1}{1.41421\ldots}\) is a horrible long division, while \(\tfrac{\sqrt{2}}{2} = \tfrac{1.41421\ldots}{2}\) is easy. Today the reason is mainly canonical form (Section 2.2): it makes equal answers look equal, so you can compare your answer with someone else’s. The conjugate technique itself remains important — the same trick evaluates limits in calculus (Chapter 16) and divides complex numbers (Chapter 15).
A surd you have handled today. A4 paper is 210 mm by 297 mm, and \(297 / 210 \approx 1.414 \approx \sqrt{2}\). The ISO paper sizes are designed so that folding a sheet in half gives the next size down with exactly the same shape: if the sides are \(1\) and \(r\), the half-sheet has sides \(\tfrac{r}{2}\) and \(1\), and keeping the ratio means \(r / 1 = 1 / (r/2)\), so \(r^2 = 2\) and \(r = \sqrt{2}\). That is why a photocopier can shrink A3 to A4 at "71%": \(\tfrac{1}{\sqrt{2}} = \tfrac{\sqrt{2}}{2} \approx 0.707\).
|
Surd mistakes
\(\sqrt{2} + \sqrt{3} \neq \sqrt{5}\) (unlike surds do not combine; \(1.414 + 1.732 = 3.146 \neq 2.236\)). \(2\sqrt{3}\) means \(2 \times \sqrt{3}\), not \(\sqrt[2]{3}\) or \(\sqrt{6}\). And \(\sqrt{ab} = \sqrt{a}\sqrt{b}\) needs \(a, b \ge 0\): "\(1 = \sqrt{1} = \sqrt{(-1)(-1)} = \sqrt{-1}\sqrt{-1} = -1\)" is a famous fake proof that breaks exactly there. |
3.5.6. Exercises
-
Simplify: \(\sqrt{48}\), \(\sqrt{200}\), \(3\sqrt{20} - \sqrt{45}\).
-
Rationalise: \(\dfrac{10}{\sqrt{5}}\), \(\dfrac{1}{\sqrt{2} + 1}\).
-
A square has diagonal 10 cm. Find its side in simplest radical form. (Diagonal of a square with side \(s\) is \(s\sqrt{2}\), by Pythagoras, Chapter 9.)
Answers
-
\(\sqrt{16 \cdot 3} = 4\sqrt{3}\); \(\sqrt{100 \cdot 2} = 10\sqrt{2}\); \(3 \cdot 2\sqrt{5} - 3\sqrt{5} = 3\sqrt{5}\).
-
\(\tfrac{10\sqrt{5}}{5} = 2\sqrt{5}\). \(\tfrac{1}{\sqrt{2} + 1} \cdot \tfrac{\sqrt{2} - 1}{\sqrt{2} - 1} = \tfrac{\sqrt{2} - 1}{2 - 1} = \sqrt{2} - 1\).
-
\(s\sqrt{2} = 10\), so \(s = \tfrac{10}{\sqrt{2}} = \tfrac{10\sqrt{2}}{2} = 5\sqrt{2}\) cm (about 7.07 cm).
3.6. Scientific notation and significant figures
3.6.1. The problem
The mass of the Earth is 5,970,000,000,000,000,000,000,000 kg. The mass of an electron is 0.000 000 000 000 000 000 000 000 000 000 911 kg. Written out, these are unreadable, impossible to compare at a glance, and easy to miscount. Worse, they claim false precision: is the Earth’s mass really known to the last kilogram?
3.6.2. Intuition
Separate a number into how big (a power of ten) and which digits (a number between 1 and 10). The Earth is \(5.97 \times 10^{24}\) kg: "about 6, followed by 24 places". The electron is \(9.11 \times 10^{-31}\) kg. The exponent carries the size; the leading number carries the precision.
|
Scientific notation
A number is in scientific notation (UK: standard form) when written as \(m \times 10^k\) with \(1 \le |m| < 10\) and \(k\) an integer. \(m\) is the significand (or mantissa or coefficient). Programming languages and calculators write \(5.97 \times 10^{24}\) as |
3.6.3. The method
Input: a non-zero decimal number.
Steps:
-
Move the decimal point so that exactly one non-zero digit is to its left. This is \(m\).
-
Count how many places the point moved: \(k\). If you moved it left (the number was large), \(k\) is positive; if right (the number was small), \(k\) is negative.
-
Write \(m \times 10^{k}\), keeping only the significant digits in \(m\).
Output: \(m \times 10^k\).
Examples. \(384\,400\) km: point moves 5 places left, \(3.844 \times 10^5\) km. \(0.000\,72\) s: point moves 4 places right, \(7.2 \times 10^{-4}\) s.
Arithmetic. Multiply and divide the significands, and combine the powers of ten with the exponent laws; then re-normalise.
The last line says the Earth outweighs an electron by a factor of about \(6.6 \times 10^{54}\) — a comparison that would be hopeless in long form. Adding and subtracting require matching exponents first: \(3.2 \times 10^5 + 4 \times 10^3 = 3.2 \times 10^5 + 0.04 \times 10^5 = 3.24 \times 10^5\).
3.6.4. Significant figures
|
Significant figures
The significant figures (s.f., or significant digits) of a measured number are the digits that carry real information about its precision. Rules: non-zero digits are significant; zeros between non-zero digits are significant (\(4007\): 4 s.f.); leading zeros are not (\(0.0072\): 2 s.f.); trailing zeros after a decimal point are (\(2.50\): 3 s.f.); trailing zeros in a whole number are ambiguous (\(1500\): 2, 3, or 4?) — scientific notation removes the ambiguity: \(1.5 \times 10^3\) vs \(1.500 \times 10^3\). |
The working rule for calculations: a product or quotient should be reported to the fewest significant figures of its inputs. If a car travels 125.0 km in 1.5 h, the speed is \(125.0 / 1.5 = 83.333\ldots\), reported as \(83\) km/h (2 s.f., limited by 1.5). For sums and differences, the limiting factor is instead the fewest decimal places. These are rules of thumb; proper error propagation is part of Chapter 31 and Chapter 32.
|
False precision
A calculator showing 83.33333333 has not measured the speed to ten digits. Reporting all of them misleads the reader about how well you know the answer. The converse also bites: dropping meaningful trailing zeros (writing 2.5 for a measurement known to be 2.50) throws away information. |
3.6.5. Orders of magnitude
The exponent \(k\) in \(m \times 10^k\) (rounded according to whether \(m\) is nearer 1 or 10) is the order of magnitude. Two quantities "differ by three orders of magnitude" when one is about 1000 times the other. Thinking in orders of magnitude is how physicists and engineers make sense of scales from the subatomic to the cosmic — and how you do the Fermi estimates of Section 1.10.
A scale like this, in which equal distances mean equal ratios rather than equal differences, is a logarithmic scale. You will meet it formally in Chapter 12; it is the natural scale for anything spanning many powers of ten (earthquakes, sound levels, pH, algorithm running times).
|
Powers of Ten
Charles and Ray Eames’s 1977 short film Powers of Ten starts with a picnic in Chicago and zooms out by a factor of 10 every ten seconds to \(10^{24}\) m, then zooms in to a proton. It remains one of the best nine minutes ever made on scale. The SI prefixes recently had to be extended for the same reason: in 2022 ronna (\(10^{27}\)) and quetta (\(10^{30}\)) were added, partly because global data storage is heading toward those scales. |
|
Scale zoomer
An infinite zoom from \(10^{-35}\) m to \(10^{27}\) m, with landmarks appearing as you pass their order of magnitude. A side panel shows the current scale in scientific notation, E notation, and the matching SI prefix, and lets you pin two objects to compare their ratio. |
3.6.6. Exercises
-
Write in scientific notation: 93,000,000; 0.000 040 5; 6.02 billion.
-
Compute, giving answers in scientific notation: \((2.5 \times 10^{-3})(4 \times 10^{8})\); \(\dfrac{9 \times 10^{5}}{3 \times 10^{-4}}\); \(7.1 \times 10^{4} - 9 \times 10^{3}\).
-
How many significant figures: \(0.00306\), \(3.060\), \(3.06 \times 10^{-3}\)?
-
Light travels at \(3.00 \times 10^8\) m/s. The Sun is \(1.50 \times 10^{11}\) m away. How long does sunlight take to reach us?
Answers
-
\(9.3 \times 10^7\); \(4.05 \times 10^{-5}\); \(6.02 \times 10^{9}\).
-
\(10 \times 10^{5} = 1.0 \times 10^{6}\); \(3 \times 10^{9}\); \(7.1 \times 10^4 - 0.9 \times 10^4 = 6.2 \times 10^4\).
-
3; 4; 3.
-
\(\tfrac{1.50 \times 10^{11}}{3.00 \times 10^{8}} = 0.500 \times 10^{3} = 5.00 \times 10^2\) s, which is 500 s, or about 8.3 minutes.
3.7. Powers of two: the computer’s native scale
3.7.1. The problem
Why is a "32-bit" program limited to 4 GB of memory? Why does a "2 TB" drive show up as 1.82 TB on your computer? Why are buffer sizes, hash table capacities, and texture dimensions so often 256, 1024, 4096? All of it follows from one fact: with \(n\) bits you can write exactly \(2^n\) different patterns.
3.7.2. Why it works
Each bit has 2 possible values. Two bits give \(2 \times 2 = 4\) patterns (00, 01, 10, 11); three bits give \(2 \times 2 \times 2 = 8\); \(n\) bits give \(2^n\). (This "multiply the number of choices" rule is the multiplication principle of Chapter 24.) So:
A 32-bit pointer can name \(2^{32}\) different bytes, which is \(2^{32} = 2^2 \cdot 2^{30} = 4\) GiB: the 4 GB limit. An \(n\)-bit signed integer ranges from \(-2^{n-1}\) to \(2^{n-1} - 1\) (Section 1.9). Try it: What 32 bits can address.
3.7.3. The approximation that makes it all mental
\(2^{10} = 1024 \approx 10^3\). With the power-of-a-power law, every power of 2 can be estimated in your head:
where \(q\) and \(r\) are the quotient and remainder of \(n \div 10\). So \(2^{32} = (2^{10})^3 \cdot 2^2 \approx 10^9 \times 4 = 4\) billion (true: 4.29 billion), and \(2^{64} = (2^{10})^6 \cdot 2^4 \approx 10^{18} \times 16 = 1.6 \times 10^{19}\) (true: \(1.84 \times 10^{19}\)). The error grows with each factor of \(2^{10}\), since each contributes 2.4%.
3.7.4. KB versus KiB
That 2.4% is the source of a long-running confusion. Should a "kilobyte" be 1000 bytes (as "kilo" means everywhere else) or 1024 bytes (a convenient power of 2)? Both usages were common, so in 1998 the IEC introduced separate binary prefixes:
|
Decimal (SI) and binary (IEC) prefixes
SI (decimal): kilo (k) \(= 10^3\), mega (M) \(= 10^6\), giga (G) \(= 10^9\), tera (T) \(= 10^{12}\), peta (P) \(= 10^{15}\). IEC (binary): kibi (Ki) \(= 2^{10}\), mebi (Mi) \(= 2^{20}\), gibi (Gi) \(= 2^{30}\), tebi (Ti) \(= 2^{40}\), pebi (Pi) \(= 2^{50}\). So 1 KB \(= 1000\) bytes and 1 KiB \(= 1024\) bytes. Lower-case b means bits, upper-case B bytes: 1 Gbit/s is 125 MB/s. |
Storage manufacturers use SI prefixes; Windows reports sizes in binary units but labels them "GB" and "TB"; macOS switched to SI units in 2009; RAM is always sold in binary sizes. The discrepancy grows with each prefix:
Worked example: the "missing" space. A drive sold as 2 TB holds \(2 \times 10^{12}\) bytes. In TiB: Try it: Convert a 2 TB drive.
Nothing is missing; the same quantity is being reported in a 10% larger unit.
def human_bytes(n, binary=True):
"""Format a byte count with SI (kB, MB, ...) or IEC (KiB, MiB, ...) prefixes."""
base = 1024 if binary else 1000
units = ["KiB", "MiB", "GiB", "TiB", "PiB"] if binary else ["kB", "MB", "GB", "TB", "PB"]
if n < base:
return f"{n} B"
value, unit = float(n), "B"
for u in units:
if value < base:
break
value /= base
unit = u
return f"{value:.2f} {unit}"
disk = 2 * 10**12 # a "2 TB" drive as sold
print(human_bytes(disk, binary=False))
print(human_bytes(disk, binary=True))
print(human_bytes(1536), human_bytes(1536, binary=False))
2.00 TB 1.82 TiB 1.50 KiB 1.54 kB
|
Rice on a chessboard
A legend tells of a sage who asked a king for one grain of rice on the first square of a chessboard, two on the second, four on the third, doubling each time. The last square alone needs \(2^{63} \approx 9.2 \times 10^{18}\) grains; the whole board needs \(2^{64} - 1 \approx 1.8 \times 10^{19}\) — roughly a thousand years of current world rice production. Note that \(2^{64} - 1\) is also the largest unsigned 64-bit integer: the chessboard is a 64-bit register. |
Try it: The 64-bit chessboard.
|
Bits and bytes calculator
A slider for bit width \(n\) from 1 to 128 that shows the number of patterns \(2^n\), the signed and unsigned ranges, the memory addressable with \(n\)-bit pointers, and a familiar real-world comparison ("more than the number of grains of sand on Earth"). A second panel converts any size among B, KB, KiB, MB, MiB, …, highlighting the percentage gap. |
3.7.5. Exercises
-
Without a calculator, estimate \(2^{24}\) and \(2^{50}\).
-
How many bits are needed to give a unique ID to each of 10 billion devices?
-
A 16 GiB RAM module holds how many bytes, exactly, as a power of 2? About how many in GB?
-
Explain why
x & 7gives the same result asx % 8for non-negative integersx.
Answers
-
\(2^{24} = 2^{20} \cdot 2^4 \approx 10^6 \times 16 = 1.6 \times 10^7\) (true: 16,777,216 — the number of 24-bit colours). \(2^{50} = (2^{10})^5 \approx 10^{15}\) (true: \(1.13 \times 10^{15}\)).
-
Need \(2^n \ge 10^{10}\). \(2^{30} \approx 10^9\) is too small; \(2^{33} \approx 8.6 \times 10^9\) is too small; \(2^{34} \approx 1.7 \times 10^{10}\) suffices: 34 bits.
-
\(16 \times 2^{30} = 2^4 \cdot 2^{30} = 2^{34} = 17\,179\,869\,184\) bytes \(\approx 17.2\) GB.
-
\(7 = 111_2\). The AND keeps the lowest three bits of
x, which (by place value, Section 1.3) represent exactly the remainder ofxon division by \(2^3 = 8\); all higher bits are multiples of 8.
3.8. A first look at exponential growth and logarithms
3.8.1. The problem
An algorithm that takes \(n^2\) steps on an input of size \(n\) and another that takes \(2^n\) steps both "get slower as \(n\) grows". Is the difference important? For \(n = 10\), \(n^2 = 100\) and \(2^{10} = 1024\) — not very different. For \(n = 100\), \(n^2 = 10\,000\) while \(2^{100} \approx 1.27 \times 10^{30}\). If each step took a nanosecond, the first finishes in 10 microseconds; the second would take about \(4 \times 10^{13}\) years, thousands of times the age of the universe.
3.8.2. Intuition
In \(n^2\) the variable is the base and the exponent is fixed: a power function (or polynomial). In \(2^n\) the variable is the exponent and the base is fixed: an exponential function. Exponential growth means a fixed percentage increase per step (here, 100% per step — doubling), and as we saw with compound interest (Section 2.5), repeated percentage increases snowball.
|
Exponential versus polynomial
An exponential expression has the variable in the exponent: \(2^n\), \(1.05^t\), \(10^x\). A polynomial (or power) expression has the variable in the base: \(n^2\), \(n^3\), \(x^{10}\). For any base \(b > 1\) and any power \(k\), \(b^n\) eventually exceeds \(n^k\) and the ratio grows without bound. Exponential growth with base \(b > 1\) has a doubling time; exponential decay (base between 0 and 1) has a half-life. |
3.8.3. Running it backwards: the logarithm
Exponentiation answers "2 to the 10 is what?" (1024). The reverse question is "2 to the what is 1024?" The answer, 10, is the logarithm base 2 of 1024:
In general \(\log_b x\) is the exponent you must put on \(b\) to get \(x\). Logarithms turn multiplication into addition (since exponents add when powers multiply) and compress huge ranges into small ones. They deserve — and get — a full chapter, Chapter 12. Here are the two facts every programmer uses daily:
-
Bits needed. To give distinct codes to \(N\) things you need \(\lceil \log_2 N \rceil\) bits (\(\lceil\,\rceil\) means "round up"). For 10 billion devices: \(\log_2 10^{10} \approx 33.2\), so 34 bits — matching the exercise in Section 3.7.
-
Halving steps. Binary search on \(N\) sorted items halves the range each step, so it needs about \(\log_2 N\) steps: 20 steps for a million items, 30 for a billion. That \(\log_2 N\) grows so slowly is the mirror image of \(2^n\) growing so fast.
3.8.4. Where you’d use this
-
Savings and debt. £1000 at 5% a year, compounded for 30 years, becomes \(1000 \times 1.05^{30} \approx £4322\). The same arithmetic applied to an unpaid credit-card balance is why debt "suddenly" becomes unmanageable.
-
Biology. Under ideal conditions E. coli divides every 20 minutes. One cell becomes \(2^{30} \approx 1.07 \times 10^9\) cells after 30 doublings, i.e. just 10 hours. Food-safety rules about not leaving food at room temperature come from this calculation; the same doubling model is the starting point for epidemic forecasting.
-
Security. A password of 8 lowercase letters has \(26^8 \approx 2.1 \times 10^{11}\) possibilities. Each extra character multiplies the attacker’s work by 26, while each extra character only adds one to your typing. Cryptography is built on exactly this asymmetry: the defender’s cost grows linearly, the attacker’s exponentially.
|
Exponential intuition fails everyone
A lily pad patch doubles in size every day and covers the pond on day 30. On what day was it half covered? Day 29 — not day 15. Exponential processes look negligible for most of their history and then appear to explode. That is why early-stage epidemics, compound debts, and viral software growth are so routinely underestimated: on a linear chart, nearly all the change happens at the end. |
|
Growth race
Choose growth functions (\(n\), \(n \log n\), \(n^2\), \(n^3\), \(2^n\), \(n!\)) and a "computer speed" in steps per second. A race shows the largest \(n\) each can handle in one second, one hour, and one year. Toggle the vertical axis between linear and logarithmic and watch the exponential curve become a straight line. |
3.8.5. Exercises
-
Compute \(\log_2 64\), \(\log_{10} 1000\), \(\log_3 81\), \(\log_2 \tfrac{1}{8}\).
-
About how many steps does binary search need for \(10^{12}\) items?
-
Which is larger for \(n = 30\): \(n^5\) or \(2^n\)? For \(n = 20\)?
Answers
-
6; 3; 4; \(-3\) (since \(2^{-3} = \tfrac18\)).
-
\(10^{12} = (10^3)^4 \approx (2^{10})^4 = 2^{40}\): about 40 steps.
-
\(n = 30\): \(30^5 = 24\,300\,000 \approx 2.4 \times 10^7\) and \(2^{30} \approx 1.07 \times 10^9\): the exponential is larger. \(n = 20\): \(20^5 = 3\,200\,000\) and \(2^{20} \approx 1\,048\,576\): the power is still larger. (They cross near \(n \approx 23\).)
3.9. Exponentiation by squaring
3.9.1. The problem
To compute \(3^{13}\) the obvious way, start with 3 and multiply by 3 twelve more times: 12 multiplications. To compute \(a^n\) that way takes \(n - 1\) multiplications. In cryptography (RSA, Diffie–Hellman) exponents have hundreds of digits — \(n \approx 2^{2048}\). At a billion multiplications per second the obvious method would not finish before the stars burn out. Yet your browser does it many times a second. How?
3.9.2. Intuition
Squaring doubles the exponent: \(3 \to 3^2 \to 3^4 \to 3^8 \to 3^{16}\) takes only four multiplications to reach the 16th power. Any exponent can be assembled from such powers, because any number is a sum of powers of two — that is exactly what its binary representation says (Section 1.3):
The step from sum to product is the product law of exponents, read backwards. Compute the repeated squares \(3^1, 3^2, 3^4, 3^8\), and multiply together those whose bit is 1.
3.9.3. The method
Input: a base \(a\) and an integer exponent \(n \ge 0\).
Steps:
-
Set \(\text{result} = 1\) and \(\text{square} = a\).
-
While \(n > 0\):
-
If \(n\) is odd (its lowest binary digit is 1), set \(\text{result} = \text{result} \times \text{square}\).
-
Set \(n = \lfloor n / 2 \rfloor\) (drop the lowest bit; \(\lfloor\,\rfloor\) means round down).
-
If \(n > 0\), set \(\text{square} = \text{square} \times \text{square}\).
-
Output: \(\text{result} = a^n\).
Try it: 3¹³ by repeated squaring.
3.9.4. Worked example: \(3^{13}\)
Each row is one pass through the loop. "Bit" is the lowest binary digit of \(n\) at the start of the pass.
| \(n\) | bit | square (\(= 3^{2^k}\)) | result after this pass | action |
|---|---|---|---|---|
13 |
1 |
\(3\) |
\(1 \times 3 = 3\) |
multiply in, then square |
6 |
0 |
\(9\) |
\(3\) |
skip, then square |
3 |
1 |
\(81\) |
\(3 \times 81 = 243\) |
multiply in, then square |
1 |
1 |
\(6561\) |
\(243 \times 6561 = 1\,594\,323\) |
multiply in; \(n\) becomes 0, stop |
So \(3^{13} = 1\,594\,323\), using 3 squarings and 3 multiplications into the result: 6 instead of 12. (Counting the first "\(1 \times 3\)", which a careful implementation can skip.)
Why it is correct. At every stage, the invariant \(\text{result} \times \text{square}^{\,n} = a^{N}\) holds, where \(N\) is the original exponent. Initially it is \(1 \times a^N\). If \(n\) is even, squaring the square and halving \(n\) leaves \(\text{square}^n\) unchanged (power-of-a-power law: \((s^2)^{n/2} = s^n\)). If \(n\) is odd, we first move one factor of \(\text{square}\) into the result, making the remaining exponent even. When \(n\) reaches 0, \(\text{square}^0 = 1\) and the result is \(a^N\). (Loop invariants are a proof technique; Chapter 22 develops them.)
Cost. The loop runs once per binary digit of \(n\), about \(\log_2 n\) times, with at most two multiplications each: at most about \(2 \log_2 n\) multiplications instead of \(n - 1\). For a 2048-bit exponent, that is about 4096 multiplications instead of \(2^{2048}\).
3.9.5. Implementation
def fast_pow(a, n):
"""Compute a**n for an integer n >= 0 by repeated squaring.
Returns (result, number_of_multiplications) so we can see the saving.
"""
result, square, mults = 1, a, 0
while n > 0:
if n & 1: # lowest bit of n is 1: this power is needed
result *= square
mults += 1
n >>= 1 # move on to the next bit
if n: # square only if more bits remain
square *= square
mults += 1
return result, mults
print(fast_pow(3, 13))
print(fast_pow(2, 64)[0] == 2**64, fast_pow(2, 64)[1])
print(fast_pow(7, 0), fast_pow(1.0001, 10_000)[0])
(1594323, 6) True 7 (1, 0) 2.718145926824356
(\(1.0001^{10\,000}\) being close to \(e = 2.71828\ldots\) is no coincidence; Chapter 12 explains it.)
In cryptography the numbers would become astronomically large, so every multiplication is followed by taking the remainder modulo some \(m\), which keeps all intermediate values below \(m\) (why this is legitimate is Chapter 23's business):
def mod_pow(a, n, m):
"""Compute a**n mod m by repeated squaring, keeping every number below m."""
result, square = 1, a % m
while n > 0:
if n & 1:
result = result * square % m
square = square * square % m
n >>= 1
return result
print(mod_pow(3, 13, 1000), 3**13 % 1000)
print(mod_pow(2, 10**18, 10**9 + 7) == pow(2, 10**18, 10**9 + 7))
323 323 True
Python’s built-in three-argument pow(a, n, m) is exactly this algorithm. Note that mod_pow(2, 10**18, ...) takes about 60 loop iterations; the naive method would take \(10^{18}\).
3.9.6. Alternative approaches and choosing
-
Naive repeated multiplication: simplest, fine for small exponents (\(n\) up to a few dozen), and has the virtue of being obviously correct.
-
Recursive halving: \(a^n = (a^{n/2})^2\) if \(n\) is even, \(a \cdot a^{n-1}\) if odd. The same cost, and the clearest way to explain the idea; but recursion depth grows with \(\log_2 n\).
-
Left-to-right binary: scan the bits from the most significant end, squaring the result each step and multiplying by \(a\) when the bit is 1. Same count; preferred in hardware because it always multiplies by the same fixed \(a\).
-
Floating-point
a ** normath.pow: for real (non-integer) results, the library computes \(e^{n \ln a}\) using logarithms (Chapter 12), which is constant time but only approximately correct. For exact integer results, use integer exponentiation.
Choose integer squaring (or pow(a, n, m)) whenever exactness matters; choose floating-point power when you need real-valued results and can tolerate rounding.
|
Overflow and timing
In languages with fixed-width integers, |
|
An ancient algorithm
The binary method of exponentiation appears in Pingala’s Chandaḥśāstra, an Indian text on poetic metre from around the 2nd century BCE, where it is used to count metrical patterns. The closely related "Russian peasant" or ancient Egyptian method of multiplication — doubling one number and halving the other — is the same idea with addition in place of multiplication: \(13 \times 3 = 3 \cdot 8 + 3 \cdot 4 + 3 \cdot 1\). |
|
Square-and-multiply stepper
Enter a base and exponent. The exponent’s bits are shown as a row of switches; stepping through the loop lights up the current bit, shows the square and the result, and counts multiplications against the naive method. A slider pushes the exponent to thousands of bits (with a modulus) to show the naive count becoming astronomically large while the fast count grows by one or two per bit. |
3.9.7. Exercises
-
Using the binary method, compute \(2^{21}\) by hand, showing the table of \(n\), bit, square, and result. Try it: Check 2²¹ step by step.
-
How many multiplications does the method use (at most) for \(n = 1000\)? How many does the naive method use?
-
Compute \(7^{10} \bmod 13\) with the binary method, reducing modulo 13 at every step. (\(\bmod\) means "remainder on division by".) Try it: Check 7¹⁰ mod 13.
Answers
-
\(21 = 10101_2\).
\(n\) bit square result 21
1
2
2
10
0
4
2
5
1
16
32
2
0
256
32
1
1
65536
\(32 \times 65536 = 2\,097\,152\)
So \(2^{21} = 2\,097\,152\).
-
\(1000 = 1111101000_2\) has 10 bits, six of them 1: 9 squarings and 6 multiplications into the result, 15 in all (or 14 if the first \(1 \times a\) is skipped), versus 999 naively.
-
\(10 = 1010_2\). Squares mod 13: \(7\); \(7^2 = 49 \equiv 10\) (since \(49 = 3 \cdot 13 + 10\)); \(10^2 = 100 \equiv 9\); \(9^2 = 81 \equiv 3\). Bits (from the right) 0, 1, 0, 1 select the 2nd and 4th squares: \(10 \times 3 = 30 \equiv 4\). So \(7^{10} \bmod 13 = 4\). (The symbol \(\equiv\) means "leaves the same remainder"; see Chapter 23.)
3.10. Interactive tools
Browser tools on the companion website that go with this chapter. Each example link in the chapter opens one of them with that example already set up.
3.11. Mastery check
-
Simplify, giving positive exponents: \(\dfrac{(2x^3y^{-1})^3}{4x^{-2}y^2}\).
-
Explain, using the quotient law, why \(5^0 = 1\), and evaluate \(\left(\tfrac{3}{4}\right)^{-2}\).
-
Evaluate \(64^{2/3}\) and \(81^{-3/4}\) without a calculator.
-
Simplify \(\sqrt{75} + \sqrt{12}\) and rationalise \(\dfrac{2}{\sqrt{7} - \sqrt{5}}\).
-
Compute \(\dfrac{(3.0 \times 10^{5})(8.0 \times 10^{-2})}{1.2 \times 10^{-4}}\) in scientific notation, to 2 significant figures.
-
A cloud provider bills 500 GiB. How many GB is that, to 3 s.f.? How many bits does a 32-bit address bus address, and how many GiB is that in bytes?
-
Which grows faster as \(n\) gets large, \(n^{10}\) or \(1.1^n\)? About how many steps does binary search take on 4 billion items?
-
Compute \(5^{11}\) by exponentiation by squaring, showing the table, and say how many multiplications you used.
Decision rule: All correct without hesitation → you have finished the Foundations part; move on to Chapter 4. Stuck on 1–2 → reread the matching section (Section 3.2, Section 3.3, Section 3.4, Section 3.5, Section 3.6, Section 3.7, Section 3.8, Section 3.9). Stuck on more → work the section exercises first; exponent fluency is assumed constantly from here on.
Mastery check answers
-
Numerator \(8x^9y^{-3}\). Divide: \(\tfrac{8}{4} x^{9-(-2)} y^{-3-2} = 2x^{11}y^{-5} = \dfrac{2x^{11}}{y^5}\).
-
\(1 = \tfrac{5^n}{5^n} = 5^{n-n} = 5^0\). \(\left(\tfrac{3}{4}\right)^{-2} = \left(\tfrac{4}{3}\right)^2 = \tfrac{16}{9}\).
-
\((\sqrt[3]{64})^2 = 4^2 = 16\). \(\tfrac{1}{(\sqrt[4]{81})^3} = \tfrac{1}{3^3} = \tfrac{1}{27}\).
-
\(5\sqrt{3} + 2\sqrt{3} = 7\sqrt{3}\). \(\tfrac{2}{\sqrt7 - \sqrt5} \cdot \tfrac{\sqrt7 + \sqrt5}{\sqrt7 + \sqrt5} = \tfrac{2(\sqrt7 + \sqrt5)}{7 - 5} = \sqrt{7} + \sqrt{5}\).
-
Numerator: \(24 \times 10^{3} = 2.4 \times 10^4\). Divide: \(\tfrac{2.4}{1.2} \times 10^{4 - (-4)} = 2.0 \times 10^{8}\).
-
\(500 \times 2^{30} = 536\,870\,912\,000\) bytes \(\approx 537\) GB. A 32-bit bus addresses \(2^{32}\) locations; \(2^{32} \text{ bytes} = 4\) GiB.
-
\(1.1^n\): every exponential with base above 1 eventually beats every power (though here only for quite large \(n\) — the crossover is in the hundreds). \(4 \times 10^9 \approx 2^{32}\), so about 32 steps.
-
\(11 = 1011_2\). \(n = 11\), bit 1: result 5, square to 25. \(n = 5\), bit 1: result \(5 \times 25 = 125\), square to 625. \(n = 2\), bit 0: square to 390,625. \(n = 1\), bit 1: result \(125 \times 390\,625 = 48\,828\,125\). So \(5^{11} = 48\,828\,125\), with 3 squarings and 3 multiplications into the result (6 in all, 5 if the initial \(1 \times 5\) is not counted), versus 10 naively.