52
$\begingroup$

Does $x^{y^z}$ equal $x^{(y^z)}$? If so, why?

Why not simply apply the order of the operation from left to right? Meaning $x^{y^z}$ equals $(x^y)^z$?

I always get confused with this and I don't understand the underlying rule. Any help would be appreciated!

$\endgroup$
6
  • 13
    $\begingroup$ The most important thing to realize is $(x^y)^z \ne x^{(y^z)}$ (just try some values. I actually didn't realize there was a convention that $x^{y^z}$ was defined to be $x^{(y^z)}$ but it makes sense. $(x^y)^z = x^{yz}$ so we don't need another way to express that but $x^{(y^z)}$ doesn't equal anything simpler. It's a little like "why" $a*b + c = (a*b) + c$ and not $a*(b + c)$. It could have equalled $a*(b + c)$ because we have a distributive law $a*(b + c) = (a*b) + (a*c)$ so the need to express $(a*b) + (a*c)$ simply as $ab + ac$ seemed more ...to be continued ... $\endgroup$
    – fleablood
    Jan 30, 2016 at 23:39
  • 1
    $\begingroup$ ... cont. ... It could have equalled $a*(b + c)$ because we have a distributive law $a*(b + c) = (a*b) + (a*c)$ so the need to express $(a*b) + (a*c)$ simply as $ab + ac$ seemed more necessary then the need to express $a*(b + c)$ as $a*b + c$. In any event, if clarity matters just put in the parenthesis. $\endgroup$
    – fleablood
    Jan 30, 2016 at 23:41
  • 2
    $\begingroup$ It's just one of those conventions that people have adopted. This one saves on brackets as we can write $a^{b c}$ for $(a^b)^c$, and $a^{b^c}$ for $ a^{(b^c)}$ $\endgroup$ Jan 31, 2016 at 1:48
  • $\begingroup$ One possible motivation I think for the convention is that $\exp \exp x$ can only reasonably be interpreted as $\exp ( \exp x)$ (where $\exp x$ is a common notation for the ubiquitous $e^x$). Choosing $x^{(y^z)}$ over $(x^y)^z$ would keep to that. $\endgroup$ Feb 1, 2016 at 0:43
  • 1
    $\begingroup$ Possible duplicate of Can anyone explain why $a^{b^c} = a^{(b^c)} \neq (a^b)^c = a^{(bc)}$ $\endgroup$
    – anderstood
    Dec 1, 2016 at 4:26

7 Answers 7

80
$\begingroup$

In the usual computer science jargon, exponentiation in mathematics is right-associative, which means that $x^{y^z}$ should be read as $x^{(y^z)}$, not $(x^y)^z$. In expositions of the BODMAS rules that are careful enough to address this question, the rule is to evaluate the top exponent first. One way to help remember this convention is to note that $(x^y)^z = x^{yz}$ (i.e., $x^{(yz)}$), so it would be silly if out of the two possibilities, $x^{y^z}$ meant the one that can be expressed without using two tiers of superscripts.

$\endgroup$
16
  • 2
    $\begingroup$ Nice KIS(S) mnemotecnic! $\endgroup$
    – JnxF
    Jan 30, 2016 at 23:24
  • 8
    $\begingroup$ Though, $x^{y^z}$ isn't ambiguous at all... it's just the version without formatting ($x^y^z$) that needs a rule about which operation to apply first. (I notice that MathJax actually treats that construction as ambiguous.) $\endgroup$
    – Brilliand
    Jan 31, 2016 at 4:05
  • 6
    $\begingroup$ MathJax is presumably imitating $\TeX$'s double subscript error. $x^{{\mbox{$y$}}^{\mbox{$z$}}}$ is ambiguous if you and your typesetter haven't conspired to make the superscripts shrink. $\endgroup$
    – Rob Arthan
    Jan 31, 2016 at 11:09
  • $\begingroup$ In CS, it's not exponentiation that is usually right-associative, but the ^ operator, which gives a unique way to interpret x^y^z (I say "usually" because not every language uses the same associativity rules for ^). Written math notation uses relative position and size to determine what is being exponentiated to what. In $x^{y^z}$ we can see that $z$ is smaller than $y$, and thus is not the exponent to $x$, but rather to $y$. In $(x^y)^z$, the $y$ and $z$ are the same size. Associativity is for 1D strings, not 2D layouts. $\endgroup$ Oct 24, 2016 at 1:00
  • 1
    $\begingroup$ @Anand: my answer is not about programming language conventions, but about mathematical practice. Your observation that $x^{y^z}$ is undefined is nonsense. $\endgroup$
    – Rob Arthan
    Jul 30, 2017 at 0:27
30
$\begingroup$

Usually, a^b^c is taken to mean a^(b^c). This is purely an issue of the definition of notation so deep "why" answers aren't super likely. The main thing is that we have the identity (for positive $a$): $$(a^b)^c=a^{bc}$$ so it would make little sense to make that the default order, given that it reduces to a simpler form, whereas $a^{(b^c)}$ doesn't reduce. Moreover, generally exponentiation is written as $a^{b^c}$ rather than a^b^c, and the former notation more clearly shows that all of $b^c$ is in the exponent.

$\endgroup$
2
  • 2
    $\begingroup$ Not usually. Always. $\endgroup$
    – user207421
    Jan 31, 2016 at 23:46
  • 6
    $\begingroup$ @EJP Not in situations where you're limited to ASCII and have little to no typesetting capabilities (or it is a great deal of trouble to get around these limitations), a situation that you might find surprisingly common outside of tools specifically designed for math. $\endgroup$
    – jpmc26
    Feb 1, 2016 at 8:24
13
$\begingroup$

I would just like to point out that many calculators share the OP's confusion, even calculators from the same manufacturer. Taking a quick sample from the lost-and-found box in my office, I found that 2^3^4 turned out to be:

  • 4096 on Texas Instruments BA II Plus, TI-30XA, TI-30X II s, TI-36X solar, Windows calculator
  • 2.4178...*10^24 on Texas Instruments TI-30XS MultiView, Casio fx-115ES Plus, Google search bar.
$\endgroup$
1
  • 2
    $\begingroup$ No BS here, excellent use of time! +1 $\endgroup$
    – user284001
    Feb 3, 2016 at 14:36
6
$\begingroup$

The notation helps here; the exponent (which is the part that's raised) always acts like it has parentheses around it. So $x^{y^z}$ means $x^{(y^z)}$. Similarly, $x^{y+z}$ means $x^{(y+z)}$ and $x^{yz}$ means $x^{(yz)}$, even though exponentiation has higher precedence than addition or multiplication (so $x+y^z$ means $x+(y^z)$ and $xy^z$ means $x(y^z)$).

$\endgroup$
4
  • 1
    $\begingroup$ This is addressing a programming language convention, and not the math question. See my comment $\endgroup$
    – Anand
    Jul 29, 2017 at 14:51
  • $\begingroup$ @Anand - no math text I have ever seen insists on, or even puts, parentheses around an actual exponent ($x^y$) when the exponent is actually typeset as superscripted text. See Brilliand's comment on the other question. I literally have no idea why you think $x^{y+x}$ needs parentheses; I've never seen $x^{(x+y)}$ anywhere in a math book or paper. $\endgroup$ Jul 30, 2017 at 12:55
  • $\begingroup$ I did not say that. Please reread my other comment. $\endgroup$
    – Anand
    Jul 30, 2017 at 16:30
  • $\begingroup$ Your note about the concept of implied grouping parentheses is fantastic. This is the same kind of thing as in rational expressions (i.e. ratios of polynomials), where the fraction bar implies sets of parentheses around the numerator and denominator, respectively. $\endgroup$ 2 hours ago
3
$\begingroup$

The exponent is evaluated first if it is an expression. Examples are $3^{x+1}=3^{\left(x+1\right)}$ and $e^{5x^3+8x^2+5x+10}$ (the exponent is a cubic polynomial) and $10^{0+0+0+10^{15}+0+0+0}=10^{10^{15}}$. The left-associativity simply fails when the exponent contains multiple terms.

$\endgroup$
1
  • 1
    $\begingroup$ It is known as implicit parentheses. Another example is $\sqrt [f(x)]{g(y)}$. $f(x)$ is evaluated first, then $g(y)$. So $\sqrt[2+3]{864*9}=\sqrt[5]{864*9}=\sqrt[5]{7776}=6$ $\endgroup$ Feb 5 at 17:35
2
$\begingroup$

Without a convention, $x^{y^z}$ might be interpreted as either $(x^y)^z$ or $x^{(y^z)}$; so a convention is useful. If the convention meant the first, then we would be obliged to use parentheses whenever we intend the second. On the other hand, if the convention means the second (which it does), then there is no need to write parentheses for the first, because it can anyway be written more simply as $x^{yz}$. The convention predates computer code, and was adopted to save writing lots of parentheses.

$\endgroup$
1
$\begingroup$

It is something called implicit parentheses.

This happens with division. With $a+b/c-d$, this is left to right, and division has precedence over addition. Thus, $4+5/1-2=4+5-2=7$.

But with $\frac{a+b}{c+d}$, there is an implicit parentheses when division is expressed in this form. The functions in the numerator above the division bar and the denominator below the division bar are evaluated first and then the results are divided. This, $\frac{4+5}{1-2}=\frac{9}{-1}=-9$

Now, for exponentiation. There is an implicit parenthesis in the exponent. So, in $a+b^{c+d}$, $c+d$ is evaluated first, $b$ is raised to the power, and then it is added to $a$. $1+3^{2+1}=1+3^3=1+27=28$, while $1+3^2+1=1+9+1=11$

Now, for another example. $(4^3)^2=64^2=4096$, while $4^{3^2}=4^9=262144$

$\endgroup$
1
  • $\begingroup$ I saw your answer right after posting a comment to the same effect on another answer. This is excellent analysis. $\endgroup$ 2 hours ago

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .