arithmetic20 min

Exponents and Roots

Exponentiation as repeated multiplication, square roots as the inverse, and exponential growth patterns

0/9Not Started

Why This Matters

An exponent tells you how many times to multiply a number by itself. 2 to the power of 10 means multiplying ten 2s together: 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 1024. This shorthand is not just convenient -- it reveals one of the most important patterns in nature and computing: exponential growth. Each additional power of 2 doubles the result. Going from 2^10 (1024) to 2^20 (over a million) takes just 10 more multiplications.

The square root is the inverse of squaring. If 5 squared is 25, then the square root of 25 is 5. Roots undo exponents, just as division undoes multiplication and subtraction undoes addition. Finding a square root means asking: what number, multiplied by itself, gives this result?

Powers of 2 are foundational in computing. A byte is 2^8 = 256 possible values. A kilobyte is 2^10 = 1024 bytes. Memory sizes, hash table capacities, and binary tree depths all involve powers of 2. Understanding exponents means understanding how computing resources scale, why exponential algorithms are devastating, and why logarithmic algorithms are beautiful.

Define Terms

Visual Model

2^1 = 2base case
2^2 = 4doubled
2^3 = 8doubled again
2^4 = 1616 items
2^5 = 32rapid growth
2^10 = 1024about 1 thousand
2^20 = 1048576about 1 million
2^30 = 1073741824about 1 billion
sqrt(25) = 5inverse of 5^2
Exponential Growthdoubles each step

The full process at a glance. Click Start tour to walk through each step.

Powers of 2 grow exponentially: 2, 4, 8, 16 ... 1024 ... 1 million ... 1 billion. Square roots reverse the squaring operation.

Code Example

Code
// Exponentiation
console.log(2 ** 10);       // 1024
console.log(Math.pow(2, 10)); // 1024 (equivalent)
console.log(3 ** 4);        // 81
console.log(10 ** 6);       // 1000000

// Powers of 2: the computing milestones
for (let i = 0; i <= 10; i++) {
  console.log(`2^${i} = ${2 ** i}`);
}
// 2^0=1, 2^1=2, 2^2=4, ... 2^10=1024

// Special exponents
console.log(5 ** 0);    // 1 (anything to the 0 is 1)
console.log(5 ** 1);    // 5 (anything to the 1 is itself)
console.log((-3) ** 2); // 9 (negative squared is positive)
console.log((-3) ** 3); // -27 (negative cubed is negative)

// Square roots
console.log(Math.sqrt(25));   // 5
console.log(Math.sqrt(2));    // 1.4142... (irrational)
console.log(Math.sqrt(0));    // 0
console.log(Math.sqrt(144));  // 12

// Cube root and nth root
console.log(Math.cbrt(27));        // 3 (cube root)
console.log(Math.pow(32, 1/5));    // 2 (fifth root: 2^5=32)

// Manual exponentiation without ** operator
function power(base, exp) {
  let result = 1;
  for (let i = 0; i < exp; i++) {
    result *= base;
  }
  return result;
}
console.log(power(2, 10));  // 1024
console.log(power(3, 4));   // 81

Interactive Experiment

Try these exercises:

  • Compute 2^0, 2^1, 2^2, up to 2^16. At what power does the result exceed 10,000? Exceed 1,000,000?
  • What is (-2) ** 3 versus (-2) ** 4? Why does the sign alternate based on whether the exponent is odd or even?
  • Compute Math.sqrt(2) and then square the result. Do you get exactly 2? Why not?
  • How many times do you need to double 1 before exceeding 1 billion? This is asking: what is the smallest n where 2^n exceeds 1,000,000,000?
  • Compare the growth of n * n (quadratic) versus 2 ** n (exponential) for n = 1 through 20. At what point does exponential overtake quadratic?

Quick Quiz

Coding Challenge

Integer Exponentiation

Write a function called `intPow` that computes base raised to the power of exp, where exp is a non-negative integer. Do NOT use the built-in exponentiation operator (** or Math.pow). Use a loop to multiply the base by itself exp times. Handle the edge case where exp is 0 (should return 1).

Loading editor...

Real-World Usage

Exponents and roots drive critical computations:

  • Computer memory: RAM sizes are powers of 2 (4 GB = 2^32 bytes, 16 GB = 2^34 bytes). Storage capacities, bus widths, and cache sizes all follow powers of 2.
  • Algorithm analysis: O(2^n) exponential algorithms (like brute-force subset enumeration) become impractical beyond n=30 or so. Recognizing exponential growth tells you when a problem needs a smarter approach.
  • Compound interest: The formula A = P(1 + r)^t uses exponentiation. Even small interest rates create dramatic growth over long time periods. This is why starting to invest early matters so much.
  • Physics and engineering: Square roots appear in distance formulas, standard deviations, and wave equations. The Pythagorean theorem (c = sqrt(a^2 + b^2)) uses both powers and roots.
  • Graphics and games: Distance calculations between objects use the square root of summed squares. Frame rates, render resolution, and texture sizes all involve powers of 2.

Connections