nth Roots and Fractional Exponents
A square root undoes squaring; a cube root undoes cubing; an nth root undoes raising to the nth power. The neat surprise is that roots are just exponents in disguise: is the same as . Once you see that, every exponent law applies to roots too.
Cube roots and beyond
The small number is the index of the root. A square root has index 2, which is normally not written.
Odd roots work for negative numbers, because a negative number cubed stays negative: . Even roots of negative numbers have no real answer, just like .
| Root | Value | Check |
|---|---|---|
| 2 | ||
| 10 | ||
| −5 | ||
| 2 | ||
| 2 | ||
| not real | no real has |
Roots as exponents
What exponent makes ? The power-of-a-power law says , so and . In general:
For example : take the cube root first (), then square (). Taking the root first keeps numbers small. Negative fractional exponents combine with the reciprocal rule: .
import math
print("8 ** (1/3) =", 8 ** (1/3))
print("64 ** (1/3) =", 64 ** (1/3))
print("math.cbrt(64)=", math.cbrt(64))
print("81 ** 0.25 =", 81 ** 0.25)
print("8 ** (2/3) =", 8 ** (2/3))
print("16 ** -0.75 =", 16 ** -0.75)8 ** (1/3) = 2.0
64 ** (1/3) = 3.9999999999999996
math.cbrt(64)= 4.0
81 ** 0.25 = 3.0
8 ** (2/3) = 3.9999999999999996
16 ** -0.75 = 0.125
Note:
64 ** (1/3)gives 3.9999999999999996 because 1/3 cannot be stored exactly as a float, so Python computes 64 to a power very slightly below 1/3.math.cbrt(Python 3.11+) is the dedicated, more accurate cube root. Round before you compare, or usemath.isclose.
Cube roots of negative numbers in code
Here is a trap: in Python, (-27) ** (1/3) does not return −3. Since is not exactly one third, Python treats the base as complex and returns a complex number. Use math.cbrt or handle the sign yourself:
import math
print((-27) ** (1/3))
print(math.cbrt(-27))
def real_root(x, n):
"""Real nth root; for odd n, works for negative x."""
if x < 0:
if n % 2 == 0:
raise ValueError("even root of a negative number")
return -((-x) ** (1 / n))
return x ** (1 / n)
print(round(real_root(-125, 3), 12), round(real_root(32, 5), 12))(1.5000000000000004+2.598076211353316j)
-3.0
-5.0 2.0
The complex value is a legitimate cube root of −27 in the complex numbers, but rarely the one you want.
The laws, now with fractions
All exponent laws hold for fractional exponents (with positive bases):
SymPy shows the same thing symbolically:
from sympy import symbols, root, sqrt, Rational, simplify
x = symbols("x", positive=True)
print(sqrt(x) * root(x, 3))
print((x ** Rational(3, 4)) ** 8)
print(root(32, 5), root(Rational(27, 8), 3))
print(simplify(Rational(16) ** Rational(-3, 4)))x**(5/6)
x**6
2 3/2
1/8
In software
- Gamma correction. Screens and image files store brightness with a power curve: roughly, and . Doing lighting math on the stored values instead of linear ones is a classic graphics bug.
- Average growth rate. If revenue grew by factor 1.8 over 5 years, the average yearly factor is , i.e. 12.5% per year. This "compound annual growth rate" is a fifth root.
- Scaling laws. If a sphere's volume doubles, its radius grows by , because volume goes with . Games use cube roots to size a blob that "eats" another blob of equal volume.
- Root mean square (RMS), used for audio levels and error metrics like RMSE, is .
Exercises
Exercise 1: Evaluate
Find , , and .
Answer
6, 5, −2, 2.
Solution
Exercise 2: Fractional exponents
Compute , and .
Answer
9, 8, .
Solution
from sympy import Rational
print(Rational(27) ** Rational(2, 3), Rational(4) ** Rational(3, 2), Rational(9) ** Rational(-1, 2))9 8 1/3
Exercise 3: Rewrite
Write as a power of , and write using a root.
Answer
and (or ).
Solution
The index of the root becomes the denominator and the power inside becomes the numerator: .
Exercise 4: Average growth
Monthly active users went from 20,000 to 45,000 in 6 months. What steady monthly growth factor gives that? Express it as a percent.
Answer
About 1.1447 per month, i.e. 14.47% growth per month.
Solution
. Six equal monthly factors satisfy , so .
f = (45_000 / 20_000) ** (1 / 6)
print(round(f, 4), f"{(f - 1) * 100:.2f}%")
print(round(20_000 * f ** 6))1.1447 14.47%
45000
Test yourself
What is ?
- 41.67
- 25
- 5
- 375
Which equals ?
What does math.cbrt(-8) return in Python?
- a complex number
- -2.0
- ValueError
- 2.0