51

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!

N. F. Taussig
  • 76,571
  • 13
    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" $ab + c = (ab) + c$ and not $a(b + c)$. It could* have equalled $a(b + c)$ because we have a distributive law $a(b + c) = (ab) + (ac)$ so the need to express $(ab) + (ac)$ simply as $ab + ac$ seemed more ...to be continued ... – fleablood Jan 30 '16 at 23:39
  • 1
    ... cont. ... It could have equalled $a(b + c)$ because we have a distributive law $a(b + c) = (ab) + (ac)$ so the need to express $(ab) + (ac)$ simply as $ab + ac$ seemed more necessary then the need to express $a(b + c)$ as $ab + c$. In any event, if clarity matters just put in the parenthesis. – fleablood Jan 30 '16 at 23:41
  • 2
    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)}$ – DanielWainfleet Jan 31 '16 at 01:48
  • 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. – Vandermonde Feb 01 '16 at 00:43
  • @fleablood: (1) I see no indication that Imre believes that ${(x^y)}^z = x^{(y^z)}$; the question is about interpreting ${x^y}^z$. (2) Your point about ${(x^y)}^z$ equaling $x^{yz}$ is good, but Rob Arthan made it a few minutes before you did. (3) ISTM that your $ab+c$ analogy isn't particularly relevant: $$ and $+$ are distinct operators; $$ has a higher precedence than $+$; case closed. A more interesting analogy would be $a \div b \div c$, which is generally interpreted as $(a \div b) \div c$, because division (and subtraction) are left-associative, in contrast to* exponentiation. – Scott - Слава Україні Feb 02 '16 at 00:21
  • 1

7 Answers7

79

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.

Rob Arthan
  • 48,577
  • 2
    Nice KIS(S) mnemotecnic! – JnxF Jan 30 '16 at 23:24
  • 8
    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.) – Brilliand Jan 31 '16 at 04:05
  • 6
    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. – Rob Arthan Jan 31 '16 at 11:09
  • 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. – Kyle Miller Oct 24 '16 at 01:00
  • See above about typeset mathematics and also look at the rather large subset of the mathematical literature in the 1960's-1980's period that was typeset using golf-ball typewriters or daisy-wheel printers. Any sample of maths hand-written by me would convince you that what you say about relative position or size is unreliable.. – Rob Arthan Oct 24 '16 at 19:28
  • ... (continued) ... Look at page 111 of Frank Adams Stable Homotopy and Generalised Homology to see what $m_{p^2-1}z^{p^2}$ looked like in the days when professional typesetting was too expensive and Knuth hadn't written $\TeX$. – Rob Arthan Oct 24 '16 at 19:47
  • ... and finally the clinch question: how do you write $(x^y)^z$ without brackets using 2D layouts and relative position and size? Note that $x^{yz}$ is not an acceptable answer: it means $x$ raised to the power $yz$ and not $x^y$ raised to the power $z$. – Rob Arthan Oct 24 '16 at 23:50
  • This answer is talking about a programming language convention - not the math question, which we can assume this to be, being in the Math Stack Exchange. In math, dropping parentheses is allowed only if the operator is associative - since exponentiation is not, the answer is simply no (i.e, $x^{y^z}$ is not the same as $x^{(y^z)}$, since the former is undefined). – Anand Jul 29 '17 at 14:48
  • 1
    @Anand: my answer is not about programming language conventions, but about mathematical practice. Your observation that $x^{y^z}$ is undefined is nonsense. – Rob Arthan Jul 30 '17 at 00:27
  • @RobArthan please show me a math text, that states that we can drop the parentheses in the case of exponentiation, based on such a convention. There are several math books that state that we can drop the parentheses for associative operators (like $+$, $*$, $\cup$, $\cap$, etc.) - not as a convention, but due to redundancy because of its associativity. I have never seen any such statements about non-associative operators like exponentiation. – Anand Jul 30 '17 at 00:51
  • Also, there are a minority of languages (like Matlab and Excel) where exponentiation is left-associative. So, the claim that In the usual computer science jargon, exponentiation is right-associative, is approximately right (in the sense that a majority of languages follow it, but not absolute, in a precise mathematical sense). – Anand Jul 30 '17 at 01:16
  • This other thread (What is a convention) is relevant: I agree with Ryan Budney's comment there that "Convention" is just an English word with no special mathematical meaning. – Anand Jul 30 '17 at 01:37
  • @Anand: I'm sorry I can't give you a text book reference. However, I have given a link to an example from real mathematical practice that shows lots of example of nested superscripts as terms of polynomials or power series. In such examples, something like $x^{p^i}$ is always read as $x^{(p^i)}$. – Rob Arthan Jul 30 '17 at 10:53
  • Thanks, @Rob - I agree that this is a convenient convention in practice, to simplify typesetting and representation. I can even see that many mathematicians may assume it. It is also wise to assume that if we saw the unparenthesized form anywhere, it is best interpreted as stated. I think this difference relates to doing math with pen or pencil on paper vs doing it in print - with a pencil, I would always prefer to be precise. Nowadays, with LaTeX, I would use parentheses to disambiguate. If it gets too messy (as in your link), I would call out the convention before using it. – Anand Jul 30 '17 at 16:39
  • See Exponentiation: Identities and Properties - there is a citation needed for the exact same claim, and it also states that Excel and Matlab do not follow this convention. – Anand Jul 30 '17 at 16:51
  • @Anand: you are out there on your own. The top-down reading of nested exponentiation is universally accepted. Read anything about Fermat numbers to see that $a^{b^c}$ has always been interpreted with the top-down reading. I think most mathematicians would consider the brackets in $2^{(m^n)}$ to be otiose . – Rob Arthan Aug 05 '17 at 00:31
30

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.

Milo Brandt
  • 60,888
  • 2
    Not usually. Always. – user207421 Jan 31 '16 at 23:46
  • 6
    @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. – jpmc26 Feb 01 '16 at 08:24
12

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.
Rus May
  • 2,087
5

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)$).

  • 1
    This is addressing a programming language convention, and not the math question. See my comment – Anand Jul 29 '17 at 14:51
  • @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. – Jonathan Cast Jul 30 '17 at 12:55
  • I did not say that. Please reread my other comment. – Anand Jul 30 '17 at 16:30
2

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.

John Bentin
  • 18,454
2

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.

  • 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]{8649}=\sqrt[5]{8649}=\sqrt[5]{7776}=6$ – Michael Ejercito Feb 05 '24 at 17:35
0

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$