The basic statement of the order of operations covers the five main operations (exponents, multiplication, division, addition, and subtraction). But what about other operations like square roots? How about trigonometric functions? And are operations at the same level always carried out left to right? Here are some questions about the details we don’t often mention.
Powers of powers: top-down
Here is a question from 2016:
Parsing Powers Raised to Powers What is the order of operations rule for 4 to the power 3 to the power 2? Depending on how you do it -- bottom up or top down -- you get two different answers. Working bottom up, you get 64 to the power 2, or 4096. Working top down, you get 4 to the power 4 to the power 9, or 262144.
Aisha is doing these two evaluations:
$$\left(4^3\right)^2 = 64^2 = 4096$$
$$4^\left(3^2\right) = 4^9 = 262,144$$
Which of these is the correct interpretation of \(4^{3^2}\)? The former is left to right, or bottom up; the latter is right to left, or top down.
I answered:
You're right: exponentiation is not associative, so the order must be specified clearly. The usual convention is that we group "top down," so that a^b^c = a^(b^c) In your example, 4^3^2 is interpreted as 4^(3^2) = 262,144. Part of the reason for this is that if we wanted to say (4^3)^2, we could simplify that to 4^(3*2) = 4^6, so it makes sense to require parentheses when we want to to express this less-used meaning.
Just as we have to specify the direction in which we evaluate \(a – b – c\) because subtraction lacks the associative property (\((a – b) – c\ne a-(b-c)\)), we have to specify the order of exponentiation. The more “interesting” interpretation is the one we consider “correct”.
I talked about this 15 years ago on the following page, discussing the difficulty of finding definitive statements about it at that time, and presenting some supporting evidence: Interpreting 2^3^2 http://mathforum.org/library/drmath/view/54362.html Nowadays, we can check Wikipedia (which is usually trustworthy on mathematical matters, and gives sources that can be checked): http://en.wikipedia.org/wiki/Exponentiation#Identities_and_properties Without parentheses to modify the order of calculation, by convention the order is top-down, not bottom-up: b^{p^q} = b^{(p^q)} =/= (b^p)^q = b^{(p*q)} = b^{p*q} . http://en.wikipedia.org/wiki/Order_of_operations#Special_cases If exponentiation is indicated by stacked symbols, the usual rule is to work from the top down, because exponentiation is right-associative in mathematics thus a^{b^c} = a^{(b^c)} , which typically is not equal to (a^b)^c. However, some computer systems may resolve the ambiguous expression differently. For example, Microsoft Office Excel evaluates a^b^c as (a^b)^c, which is opposite of normally accepted convention of top-down order of execution for exponentiation. I hope that helps.
In the 2001 discussion, Interpreting 2^3^2, the “patient” said, “My professor says that a lot of mathematicians take it on faith, that this is just the way to do it.” I commented on the difficulty of finding corroboration of my understanding of the convention:
I wouldn't quite call it "faith"; just an unwritten (or seldom written) convention. It's not that we "believe" it's true; we just "know" from experience that this is the usual way to read exponents. I've occasionally wondered where I could find an "official" authority on this, myself. I know that a^b^c is generally taken as a^(b^c), and that the reason is that (a^b)^c can be written as a^(bc), while the other form, which is more interesting, has no alternative. We've occasionally mentioned this in Dr. Math answers, but are we an authority? I recall learning it from some book when I was in school, quite possibly not a textbook. But how can I prove it to a skeptic? I've been looking to see if some math organization has adopted standards, but have never found one to which I can refer. Actually, the order of operations rules, so far as I have found, are not decreed by any authority, but have gradually become a commonly accepted standard through informal consensus, perhaps with the help of textbook authors, who tend to lay down rules more than actual mathematicians. The best thing to do is to show what mathematicians actually do.
I then gave what evidence I could find at the time, which included an acknowledgment by Texas Instruments that a particular calculator did not follow this rule, which “we learn in many algebra texts”, and an example of a site that explicitly stated their interpretation, calling it “customary”. (I noted just now that the Windows calculator also evaluates it bottom-up.) I concluded,
So I think it's clear that a^(b^c) is the usual interpretation of a^b^c, but not so much so that authors can comfortably assume that all readers will follow it without a reminder to make sure we agree. As far as I know, everyone who uses such expressions uses them in this way; I've never seen the other way given as the "right" way. The most one could say in the other direction would be that there is no firm rule and that one should state the rule before using it.
Another evidence of this interpretation is the way it is usually typeset: \(a^{b^c}\). Notice that each layer is smaller than the one before, indicating that c is thought of as a superscript on b.
Square roots: built-in grouping
I noted last time that PEMDAS does not explicitly include the negation operator, so we have to recognize that it is treated as being at the same level as multiplication. We get questions about other unary operators (that is, operations that act on only one number) from time to time. First, here is a question from 2009:
Order of Operations and Square Roots At what step in the order of operations (Clear parentheses, exponents, multiply and divide in order presented, add and subtract in order presented) does one work out a square root? I haven't seen it much yet, but it appears in expressions and equations toward the end of a friend's child's 6th grade math book. For instance, 14 plus (24 minus 12) squared divided by 2 times 3 cubed plus (4 minus 2 squared) plus the square root of 9? At which step would you replace the square root of 9 with 3? Thanks! It seems like it would go with either exponents or the multiplication and division step, but I don't know which; and I can't (for the life of me) find an explanation in the textbook; AND I can't remember what I learned in high school algebra . . . help! Here goes: 14 + (24 - 12)squared divided by 2 x 3cubed + (4 - 2squared) + square root of 9 14 + (12)squared divided by 2 x 3cubed + (4 - 2 squared) + square root of 9 14 + 12squared divided by 2 x 3cubed + (4 - 4) + square root of 9 14 + 12squared divided by 2 x 3cubed + 0 + square root of 9 14 + 144 divided by 2 x 3cubed + 0 + square root of 9 14 + 144 divided by 2 x 27 + 0 + square root of 9 14 + 72 x 27 + 0 + square root of 9 14 + 1,944 + 0 + square root of 9 14 + 1,944 + 0 + 3 1,958 + 0 + 3 1,958 + 3 1,961 In this problem, I don't think it would change the effect to include the square root at the time you do exponents; however, I know that the order of ops is around to provide stability when it WOULD change the effect (and the outcome). It makes my head hurt (and doing algebra in an email box is almost as bad ;-). Can you give me a rule for where to put square roots in the order of ops? Thank you!
The expression, written with proper formatting, is $$14 + (24 – 12)^2 \div 2 \times 3^3 + (4 – 2^2) + \sqrt{9}$$ Tracey has evaluated it correctly; there is really no difficulty introduced by the radical, but it would be nice to be able to state clearly where it fits.
Doctor Rick took this:
I'll write the expression this way: 14 + (24 - 12)^2 / 2 * 3^3 + (4 - 2^2) + sqrt(9) The part you're most concerned about is the last term; it probably looked a bit more like this on the paper: ___ \/ 9 One thing you need to notice is the bar (vinculum) over the 9. This may not be taught very often, but the vinculum is actually a remnant of an old alternate to parentheses. It is a grouping symbol, and as such, it goes along with parentheses in the order of operations. It's attached to the radical sign that says to take the square root; therefore immediately after evaluating the expression under the vinculum, you can take its square root.
So the radical, as commonly used, is taken as a single unit, and the entire radicand is evaluated as if it were in parentheses. So in terms of PEMDAS, the square root is at the level of P.
If the vinculum were not used, we would have an issue, as I’ll mention below.
Thus, the first thing to do is to evaluate each quantity in parentheses, AND evaluate the root: 14 + (24 - 12)^2 / 2 * 3^3 + (4 - 2^2) + sqrt(9) \_______/ \_______/ \_____/ 14 + 12 ^2 / 2 * 3^3 + 0 + 3 \_____/ \_/ 14 + 144 / 2 * 27 + 0 + 3 \_______/ 14 + 72 * 27 + 0 + 3 \_________/ 14 + 1944 + 0 + 3 Now, with only additions left, we add them up and get 1961. I get the same answer you got, though I evaluated the square root first. All that really matters here, as you observed, is that the square root is evaluated before the final addition.
As long as the radical is evaluated before it is needed (in this case, for the addition next to it), we’re good; Tracey’s delayed evaluation was perfectly valid:
The order of operations really defines a "partial ordering" of the operations in a given expression; certain operations in the expression must be done before certain others, but the ordering of other pairs of operations may not matter. In fact, properties such as the associative property open up even more possible orderings; for instance, additions don't really need to be done left to right.
The order of operations is often treated by students as a rigid process, but there is really considerable freedom in it.
If you can find any case where you think some other order of operations (in regard to square roots) would change the result, let me see it. Personally, I can't imagine doing anything else; someone less familiar with roots may see an issue that I don't see.
I’ll have another comment on the radical in a moment.
Percent: a postfix unary operator
I don’t normally think of “%” as an operator we would use in an equation, but there are occasions when it makes sense. Where does that fit in? This was asked in 2001:
Order of Operations with Percentages Why does the order of operations exclude percentage, square roots, etc.? Let's say I have a problem like this: 5% of 290 + 89 square root - 1 =
(By the way, according to some questions we have seen, “5% of” is included by some authors in other countries as a standard part of the notation, apparently under the belief that O in BODMAS refers to the word “of” being used in an expression. Here, I would never expect to see such an expression, and would consider it to come under “English sentence rules” rather than mathematical “order of operations rules”. But when such questions are asked, we answer them according to what a student is being taught.)
I’m not entirely sure what expression was meant here; I’ll suppose it’s “\(5\%\text{ of }290 + \sqrt{89} – 1\).
I answered, ignoring the provided expression and the issue of “of”:
I think we avoid listing all these special things so we don't overwhelm students. Computer programming languages have to spell out exactly what every possible combination of symbols means, so they give big lists of rules, and it can be pretty scary to learn. In real life, we usually just try to avoid writing anything that looks too tricky, because people don't follow rules as well as computers. The percent sign and square root sign are "unary operators"; that is, they act on one number to the right or left. They are probably always at the top of the list, the first things you have to evaluate. For example, 3+5% would mean 3 + 0.05 = 3.05, not 8% = 0.08.
I said “probably” for a reason; I am just using my own sense of what seems reasonable.
The square root is easier to be sure about, as we’ve already seen:
The square root sign is special. The actual radical sign is just the "v"-like thing alone, and means to take the root of the number following it. For example, \/4+5 would be 2+5=7, not the square root of 9, which is 3. But you usually see a bar hanging over the numbers you are to operate on. That part of the symbol is called a vinculum, and is left over from a time when that was used instead of parentheses. So ____ \/4+5 does mean the square root of 9.
I think I’ve only see the radical sign without a vinculum in printed material that was very old (before printing technology made it easier to typeset complicated expressions); but there are times even now when people writing to us are forced to do so. If you write “√4 + 5”, I would have to take that as 2 + 5 = 7; if you meant the root of the sum, you would have to write “√(4 + 5)”.
When I wrote this, I probably didn’t specifically consider how either a radical or a percentage would interact with exponents. If you wrote “√4 ^ 5”, I would take it as “√(4) ^ 5”, but if you think about it, it doesn’t make any difference, as $$\sqrt{4}\ ^5 = \left(4^{1/2}\right)^5 =4^{1/2\cdot 5} = \left(4^5\right)^{1/2} = \sqrt{4^5}.$$
Factorial: also at the top of the heap
Another unary operator (like “%” and unlike the radical, written after its argument) is the factorial, \(n! = n(n-1)\cdots3\cdot2\cdot1\). This question was raised in 2000:
Factorials and Order of Operations Where do factorials go in the Order of Operations? I've been thinking that factorials would go with exponents, but on the other hand, factorials go with multiplication.
Probably Kiaran’s thinking was based on the fact that the factorial is an extension of multiplication. I responded,
Hi, Kiaran. Good question! I would put factorials with functions, something you don't often see listed in the order of operations. If you are not familiar with functions, you can think of them very simply as something to be done to a single number (or sometimes a list of numbers) that produces a number as a result. The square root and the trigonometric functions (sine, cosine) are examples of this. Technically, the factorial is called a (postfix) unary operator, which means essentially the same thing.
Just as a function f is applied immediately after evaluating the parentheses that must follow it, \(f(\dots)\), unary operators are applied immediately to the single thing that follows. The issue with functions like the factorial is the lack of mandatory parentheses in the notation we use.
Because these don't stand between two numbers, but only relate to one number, they are thought of as being attached directly to that number; if you want to apply a function or unary operator to a whole expression, you have to use parentheses. That puts functions at the top of the order of operations, just after parentheses. For example, this means that the factorial applies only to the 5: 3 + 4*5! = 3 + 4*120 = 3 + 480 = 483 while this applies it to (3 + 4*5): (3 + 4*5)!
As with percentages, I am just using my common sense here, along with general experience of how factorials are used in expressions. There is no authority to decree this, but it is clear from common usage. For example, browsing through the Wikipedia article on factorial, I see equations like \(n! = n(n-1)!\), which clearly does not mean \(n! = [n(n-1)]!\) as it would have to if the factorial were either lower than multiplication, or done left to right along with multiplication. I also see expressions like \(\ln n!\) which is not taken to mean \((\ln n)!\).
One reliable source does explicitly state this:
For simple expressions, operations are typically ordered from highest to lowest in the order:
- Parenthesization,
- Factorial,
- Exponentiation,
- Multiplication and division,
- Addition and subtraction.
Absolute value: both operation and grouping symbol
Let’s look at one more operation we’ve been asked about, which is quite different, though it too is essentially a unary operator or function. This question is from 2002:
Absolute Value as a Grouping Symbol? I teach 8th grade Algebra in California. I was teaching the Order of Operations. I explained that there are four grouping symbols: parentheses, brackets, braces, and the fraction bar. One student asked me if the absolute value bars are also grouping symbols. I told him no. But as I thought about it, in a practical sense, absolute value is a grouping symbol: with every equation/expression in my algebra textbook that has an absolute value, you must solve what's in the absolute first! I have two questions: 1) Are there any examples of a problem where you do not have to evaluate the absolute first? and 2) Would it would be wrong for me to teach the absolute value as a "pseudo" grouping symbol?
Interesting question! I replied by mentioning yet another grouping symbol (the vinculum, as I mentioned above), then continuing:
But yes, the absolute value bars do serve partly as a grouping symbol. That is, their primary meaning is to indicate an absolute value, but they incidentally require that whatever is inside must be evaluated first. Thus 3|x+y| is equivalent to 3*abs(x+y) where I have used functional notation, in which again the parentheses are primarily to identify the argument of the function "abs" but also serve to group. In a function with two arguments, I suppose you could call the comma separating the arguments a grouping symbol too: atan2(x,y).
In effect, the absolute value bars are modified parentheses, which indicate that the function is applied to the quantity within.
In summary, I would go a bit beyond calling the absolute value a "pseudo" grouping symbol, and call it a symbol one of whose functions is to group an expression. I don't think I understand your first question; the point is that you CAN'T evaluate an absolute value before evaluating its argument. I suppose you meant, first before doing something else outside of it. Of course you can distribute, as you can with parentheses: 3|x+y| = |3x + 3y| but in terms of actually evaluating an expression as it stands, you have to evaluate the argument, then the absolute value, then whatever it is used in.
I also referred to another page that mentioned this,
Grouping Symbols
Years later, someone wrote to comment on that idea of distributing into an absolute value, which led to this explanation:
Absolute Caution
Next time, I will post a discussion on a topic too big to fit here: order of operations with trigonometric functions, which are commonly not written with the usual function notation, leading to some very complicated issues. And soon, I’ll talk more about the interaction of order of operations with properties like distributivity.
Pingback: Order of Operations: Trigonometric Functions – The Math Doctors