Rational Exponents and Radicals
A fractional exponent is just another way to write a root: is the cube root of 8, and is that root squared. This lesson connects the two notations, shows how to simplify with the exponent laws, and points out the traps a computer sets when the base is negative or the result should be a whole number.
From roots to exponents
You already know nth roots and the exponent laws. Rational exponents glue them together. For and whole numbers and ():
The definition is forced by the law : if is to make sense, then must equal , and that is exactly what the th root does.
Tip: Take the root first, then the power. keeps the numbers small; gives the same answer the hard way.
The laws still hold
All the exponent laws work with fractional exponents (for positive bases):
| Law | Example |
|---|---|
So radical expressions can be simplified by turning every root into an exponent, adding or multiplying the fractions, and turning back:
To rationalize a denominator, multiply top and bottom by what completes the root: , and .
Floats are not exact
Python happily computes fractional powers, but 1/3 is not exactly one third as a float, so whole-number answers come out slightly off. SymPy keeps the exponent as an exact Rational:
import sympy as sp
print(27 ** (2/3))
print(16 ** 0.75, 32 ** -0.4)
print(round(27 ** (2/3), 12))
print(sp.Integer(27) ** sp.Rational(2, 3))
print(sp.Integer(32) ** sp.Rational(-2, 5))
x = sp.symbols("x", positive=True)
print(sp.sqrt(x) * sp.root(x, 3))
print(sp.sqrt(72), sp.radsimp(6 / sp.sqrt(3)))8.999999999999998
8.0 0.24999999999999997
9.0
9
1/4
x**(5/6)
6*sqrt(2) 2*sqrt(3)
8.999999999999998 is the float nearest to the true answer after two rounding steps. If an integer is expected, round, or use exact arithmetic.
Negative bases
The cube root of −8 is −2, because . But Python's ** with a negative base and a fractional exponent returns a complex number: it picks a different one of the three complex cube roots (the "principal" one). For an even root like there is no real answer at all.
import math
import numpy as np
print((-8) ** (1/3))
print(math.cbrt(-8), float(np.cbrt(-8.0)))
def real_root(a, n):
"""Real nth root, defined for negative a only when n is odd."""
if a < 0 and n % 2 == 1:
return -((-a) ** (1 / n))
if a < 0:
raise ValueError("even root of a negative number")
return a ** (1 / n)
print(real_root(-32, 5), real_root(81, 4))(1.0000000000000002+1.7320508075688772j)
-2.0 -2.0
-2.0 3.0
Note: Many textbooks define only for , precisely to avoid this ambiguity. When you need the real odd root of a negative number, use
math.cbrt(Python 3.11+),np.cbrt, or the sign trick above.
In software
Rational exponents show up wherever something scales by "a fraction of a power":
- Music: an equal-tempered semitone multiplies the frequency by , so 12 semitones double it (an octave).
- Graphics: gamma correction stores brightness as and decodes with .
- Statistics and finance: the geometric mean of growth factors is ; the average yearly growth over 5 years is .
- Game tuning: XP curves like grow faster than linear but slower than quadratic.
A4 = 440.0
semitone = 2 ** (1 / 12)
for name, k in [("A4", 0), ("C5", 3), ("E5", 7), ("A5", 12)]:
print(f"{name}: {A4 * semitone ** k:7.2f} Hz")
start, end, years = 1200, 2000, 5
cagr = (end / start) ** (1 / years) - 1
print(f"average growth per year: {cagr:.4%}")A4: 440.00 Hz
C5: 523.25 Hz
E5: 659.26 Hz
A5: 880.00 Hz
average growth per year: 10.7566%
Exercises
Exercise 1: Evaluate by hand
Evaluate , and without a calculator.
Answer
25, and .
Solution
import sympy as sp
print(sp.Integer(125) ** sp.Rational(2, 3), sp.Integer(81) ** sp.Rational(-3, 4), sp.Rational(1, 16) ** sp.Rational(1, 2))25 1/27 1/4
Exercise 2: One exponent
Write as a single power of ().
Answer
Solution
Turn each root into an exponent and add or subtract the fractions over the common denominator 12:
import sympy as sp
x = sp.symbols("x", positive=True)
print(sp.root(x**3, 4) * sp.sqrt(x) / sp.root(x, 3))x**(11/12)
Exercise 3: Rationalize
Simplify and so that no root is left in a denominator and the roots are as small as possible.
Answer
, and .
Solution
Exercise 4: Average growth (code)
A game's monthly players grew from 8 000 to 13 500 over 6 months. Write code that computes the constant monthly growth rate that produces this, and check it by compounding 6 times.
Answer
About 9.11% per month (the factor is ).
Solution
If the factor per month is , then , so .
g = (13500 / 8000) ** (1 / 6)
print(f"factor {g:.6f}, rate {g - 1:.2%}")
value = 8000
for month in range(6):
value *= g
print(round(value, 6))factor 1.091124, rate 9.11%
13500.0
Test yourself
What is ?
- 16
- 42.67
- 8
- 4
Why does Python print a complex number for (-8) ** (1/3)?
- Because −8 has no cube root
- Because
**with a negative base and a non-integer exponent returns the principal complex root - Because of integer overflow
- Because
1/3is an integer in Python
Which expression equals for ?