Sub topic 14
Stacked Exponents: 2^3^2
This chapter assumes you know that an exponent represents repeated multiplication and that exponents have higher precedence than multiplication, division, addition, and subtraction. It focuses on a special case: two or more exponents written in a row.
The standard meaning of 2^3^2
The expression 2^3^2 is called a stacked exponent or exponent tower. By standard mathematical convention, stacked exponents are evaluated from the top down, or from the right to the left:
2^3^2 = 2^(3^2)
First evaluate the exponent on the right:
3^2 = 9
Then use that result as the exponent of 2:
2^9 = 512
Therefore:
2^3^2 = 512
This rule is different from multiplication, division, addition, and subtraction. Those operations of equal rank are evaluated from left to right. Exponentiation is conventionally grouped from the right.
Why parentheses matter
Without parentheses, people may incorrectly group the expression as:
(2^3)^2
That calculation gives a different result:
- 2^3 = 8
- 8^2 = 64
So 2^3^2 and (2^3)^2 are not equivalent.
| Expression | Grouping | Value |
|---|---|---|
| 2^3^2 | 2^(3^2) | 512 |
| (2^3)^2 | 2^3, then squared | 64 |
Parentheses make the intended grouping explicit. Use 2^(3^2) when the upper exponent should be evaluated first. Use (2^3)^2 when the first power should be evaluated first.
print(2 ** 3 ** 2) # 512: Python groups this as 2 ** (3 ** 2)
print(2 ** (3 ** 2)) # 512
print((2 ** 3) ** 2) # 64The symbol used for exponentiation differs by context. In handwritten mathematics, a caret often represents a power, so 2^3 means “2 to the third power.” In Python, the exponentiation operator is **. A single caret in Python is a bitwise operator, not exponentiation.
Reading longer exponent towers
For a longer tower, start at the rightmost exponent:
2^3^2^1 = 2^(3^(2^1))
Work inward from the right:
- 2^1 = 2
- 3^2 = 9
- 2^9 = 512
The result is 512. Do not calculate 2^3 first unless parentheses require that grouping.
Checking the grouping
A calculator or programming language may use a different notation or may require explicit parentheses. Enter both possible groupings if you are unsure:
- 2^(3^2) gives 512.
- (2^3)^2 gives 64.
The difference between these results is a sign that grouping matters, not an arithmetic error.
Exercise
Evaluate 3^2^2 and compare it with (3^2)^2.
Show answer
3^2^2 means 3^(2^2) = 3^4 = 81. The parenthesized expression is (3^2)^2 = 9^2 = 81, so these particular expressions happen to have the same value. The grouping rule is still different, and other examples, such as 2^3^2, produce different values.