In mathematics, operations refer to actions like addition, subtraction, multiplication, division, and exponentiation. The same expression can produce different results depending on the order in which these operations are performed. The order of operations is a set of conventions that specifies a single, unambiguous evaluation order, ensuring that every mathematician and every calculator reads an expression the same way.
Quick Reference: The Rules
| Priority | Operation | Notes |
|---|---|---|
| 1 | Parentheses (brackets) | Innermost first |
| 2 | Exponentiation | Right to left for stacked powers |
| 3 | Multiplication and Division | Left to right, equal priority |
| 4 | Addition and Subtraction | Left to right, equal priority |
The Four Rules (PEMDAS)
The order of operations is captured by the mnemonic PEMDAS:
PEMDAS: Parentheses · Exponents · Multiplication & Division · Addition & Subtraction
A common memory phrase is "Please Excuse My Dear Aunt Sally." The four levels, in order of priority, are explained below.
Rule 1: Parentheses
Evaluate all expressions inside grouping symbols first, starting with the innermost group and working outward. Grouping symbols are the override mechanism: they always take priority, regardless of any other rule.
The P in PEMDAS stands for parentheses ( ), but the same rule applies to all three types of grouping symbol:
| Symbol | Name | Typical use |
|---|---|---|
( ) |
Parentheses | Primary grouping |
[ ] |
Brackets (square brackets) | Grouping inside parentheses to improve readability |
{ } |
Curly braces (braces) | Outermost grouping when brackets are already in use |
When expressions are nested, the convention in textbooks and handwriting is to alternate symbols from inside out (parentheses innermost, then brackets, then curly braces) so that the eye can easily match each opening symbol to its closing partner:
Mathematically all three symbols mean exactly the same thing: evaluate the enclosed expression first. The alternation is a readability convention, not a rule that changes priority.
A basic example without nesting:
Rule 2: Exponentiation
Apply exponents (powers and roots) before multiplication, division, addition, or subtraction.
Rule 3: Multiplication and Division (left to right)
Multiplication and division have equal priority and are evaluated strictly left to right.
Rule 4: Addition and Subtraction (left to right)
Addition and subtraction have equal priority and are evaluated strictly left to right.
Why This Order? The Motivation Behind the Rules
The order of operations is a convention, not a mathematical law, but it is a well-motivated one. Each level of priority reflects how algebraic notation naturally groups quantities.
Why multiplication before addition? In algebra, writing means , never . The product is a single entity (a term), and terms are added together to form an expression. This intuition, embedded in algebraic notation since the 17th century, is why multiplication binds more tightly than addition.
Why exponentiation before multiplication? Similarly, means , not . The exponent belongs to the base immediately below it. If multiplication had higher priority than exponentiation, standard polynomial notation would be unreadable.
Why left to right for equal-priority operations? This is a pure convention, consistent with the left-to-right direction of written language. It resolves ambiguity when two operations of equal strength appear in sequence.
Historical note. The rules were progressively formalized through the 16th–19th centuries as algebraic notation developed. The convention that multiplication precedes addition was implicit in Leibniz and Euler's notation. The explicit term "order of operations" and the classroom mnemonics (PEMDAS, BODMAS) were largely codified by textbook authors in the late 19th century, as mass-printed mathematics textbooks became widespread.
Worked Examples
Example 1. Evaluate .
Multiplication before addition:
Example 2. Evaluate .
Division and multiplication left to right:
Example 3. Evaluate .
Parentheses → exponent → multiplication → addition/subtraction left to right:
\begin{aligned} 2 + 3^{2}\times4-(1+5) &= 2+9\times4-6 \\ &= 2+36-6 \\ &= 32. \end{aligned}Example 4. Evaluate .
The fraction bar acts as an implicit parenthesis around the numerator and denominator:
Why Mnemonics Can Mislead
Mnemonic acronyms are useful memory aids, but they obscure two critical facts that are not spelled out by the letters themselves.
Pitfall 1: M and D are equal, not sequential. Because "M" appears before "D" in PEMDAS, many students conclude that multiplication is always performed before division. This is wrong. Multiplication and division share the same priority level and are evaluated left to right. Applying multiplication first gives incorrect results:
\begin{aligned} &6 \div 2 \times 3 \overset{\color{red}\text{wrong}}{=} 6\div6=1\\ &6\div2\times3\overset{\color{blue}\text{correct}}{=}(6\div2)\times3=9. \end{aligned}Pitfall 2: A and S are equal, not sequential. Similarly, "A" before "S" does not mean addition is always done first. Addition and subtraction share equal priority and run left to right:
\begin{aligned} &2-3+4\overset{\color{red}\text{wrong}}{=}2-(3+4)=2-7=-5 \\ &2-3+4\overset{\color{blue}\text{correct}}{=}(2-3)+4=-1+4=3. \end{aligned}Understanding the two-tier structure (multiplication and division together at level 3; addition and subtraction together at level 4) matters far more than remembering the letters.
Special Cases and Exceptions
Stacked Exponentiation (right to left)
When exponents are written as a tower (stacked superscripts), the convention is to evaluate from the top down, that is, right to left:
This convention is both standard and natural: evaluating left to right would give , which is just a single exponent and makes the tower notation pointless. For example:
Implied Multiplication (Juxtaposition)
When multiplication is indicated by placing two quantities side by side, without any multiplication symbol, it is called implied multiplication or multiplication by juxtaposition. In academic and scientific writing, juxtaposition is conventionally given higher priority than explicit multiplication or division, because the two factors form a visual unit.
Under this convention, is read as , not as , and means .
This convention is not universal, however, and is a common source of confusion:
- Many scientific calculators (TI-83, most HP models) treat as , giving priority to left-to-right division.
- The TI-82 and some others do give juxtaposition higher priority.
- Google and Wolfram Alpha follow strict left-to-right PEMDAS with no special treatment for juxtaposition.
Because of this disagreement, expressions like should always be avoided in writing. Use explicit parentheses, such as or , to remove any ambiguity.
Unary Minus
The minus sign can be either binary (between two numbers, meaning subtraction) or unary (in front of one number, meaning negation). The unary minus is generally treated as having lower priority than exponentiation, so:
When negating the base is intended, explicit parentheses are required.
Ambiguous Expressions: The Viral Math Problem
In 2019, the expression went viral online, with people arriving at two different answers:
- Answer 16: Treat as , then apply left-to-right PEMDAS: .
- Answer 1: Treat as an implied-multiplication unit with higher priority: .
Both answers follow a consistent rule; they just follow different rules. The expression is genuinely ambiguous, and the disagreement it caused illustrates why professional mathematicians and scientists avoid this style of writing entirely. The American Mathematical Society commented that the problem is "ambiguous as written."
The correct takeaway is not which answer is right, but that a well-written expression leaves no room for ambiguity. The two unambiguous ways to write this problem are:
International Variants
PEMDAS is the standard mnemonic in the United States. Other English-speaking countries use different acronyms for the same rules:
| Acronym | Stands for | Used in |
|---|---|---|
| BODMAS | Brackets, Order, Division/Multiplication, Addition/Subtraction | UK, India, Australia |
| BEDMAS | Brackets, Exponents, Division/Multiplication, Addition/Subtraction | Canada, New Zealand |
| BIDMAS | Brackets, Indices, Division/Multiplication, Addition/Subtraction | UK (alternative) |
Despite the different names, the mathematical rules are identical. The differences are purely linguistic (parentheses vs. brackets, exponents vs. orders vs. indices), reflecting regional English vocabulary rather than different mathematics.
Exercises
Evaluate each expression.
(a) (b) (c) (d)
Answer
(a) (b) (c) (d)
Solution
Work down the priority ladder each time, doing the highest-priority operation present before anything else.
(a) . The expression contains an addition and a multiplication. Multiplication sits at level 3 and addition at level 4, so the multiplication goes first:
Doing the addition first would give , which is wrong.
(b) . Division and multiplication are both at level 3, so they have equal priority and we work strictly left to right. Reading from the left, the division comes first:
This is the pitfall the section warns about. The "M" before the "D" in PEMDAS does not mean multiplication goes first. Doing the multiplication first would give , which is wrong.
(c) . Addition and subtraction are both at level 4, so again we go strictly left to right, and the subtraction comes first:
Doing the addition first would give , which is wrong.
(d) . Three levels appear here. The exponent is at level 2, so it goes first:
The expression is now . Multiplication (level 3) beats addition (level 4):
A common wrong route is to multiply the and the first, getting . The exponent belongs to the immediately beneath it, not to any later product.
Evaluate .
Answer
Solution
This section says that when grouping symbols are nested, we start with the innermost group and work outward. Think of it as peeling an onion one layer at a time.
Step 1: the innermost group. The parentheses are inside everything else, so they go first:
The expression becomes
Step 2: the next layer out. Now the square brackets are innermost:
The expression becomes
Step 3: the outermost group. Evaluate the curly braces:
The expression becomes
Step 4: what is left. Only the multiplication remains:
A note on the three symbols. As this section explains, , and mean exactly the same thing mathematically. Alternating them is purely so that the eye can pair each opening symbol with its closing one. So do not imagine that curly braces are somehow "more powerful" than parentheses; here the parentheses were done first simply because they were innermost.
The mistake to avoid. Working from the outside in, or subtracting left to right across the brackets, would give . The brackets exist precisely to prevent that reading.
Evaluate .
Answer
Solution
As this section explains, the fraction bar acts as an implicit parenthesis around the whole numerator and around the whole denominator. So the correct plan is: evaluate the top completely, evaluate the bottom completely, then divide.
The numerator, . Multiplication before addition:
The denominator, . The exponent is at level 2, so it goes first:
Then the multiplication, at level 3:
Then the subtraction, at level 4:
The division. Now, and only now, do we divide:
Why the implicit parentheses matter. If this expression were typed on one line without brackets, as , the rules would give something entirely different — the division would apply only to the , not to the whole of . To type the original safely you would have to write
This is worth remembering whenever you copy a printed fraction into a calculator: the bar has to be replaced by brackets, or the answer will be wrong.
Evaluate each of the following, and comment on any pair that gives the same value.
(a) (b) (c) (d)
Answer
(a) (b) (c) (d)
Solution
This section states that exponentiation has higher priority than a unary minus — that is, than a minus sign used to negate a single quantity. So without brackets, the power is applied first and the minus sign is applied last.
(a) . There are no brackets, so the exponent binds to the alone:
(b) . The brackets override the usual priority, exactly as the section says grouping symbols always do. Now the base really is :
Parts (a) and (b) differ in sign, and the only difference between them is a pair of brackets. This is one of the most frequently mishandled pieces of notation in all of algebra.
(c) . Again no brackets, so the cube applies to the alone:
(d) . Here the base is :
The pair that agrees. Parts (c) and (d) both give , even though the brackets differ. The reason is that the exponent is odd. Cubing leaves one minus sign without a partner, so the result is negative anyway — which is the same sign that the external minus produces in (c).
For an even exponent the two disagree, as (a) and (b) show, because the minus signs cancel in pairs inside the bracket.
The practical advice. Because and look so alike and mean such different things, always write the brackets when you intend to square a negative number. And when reading someone else's expression, check for the brackets before assuming which is meant.
Evaluate and , and say which is larger.
Answer
and ; the first is larger.
Solution
Evaluating . This is a tower of exponents, and this section states that towers are evaluated from the top down, that is, right to left:
So the top pair is dealt with first:
The expression becomes
(Doubling nine times: .)
Evaluating . Here the brackets tell us plainly what to do first:
Alternatively, by the Power of a Power Rule from the earlier section on exponents, , which agrees.
Which is larger. Since , the tower is much the larger — eight times larger, in fact.
Why the top-down convention exists. This section gives the reason, and it is a good one. If a tower were read from the bottom up, then would mean , which by the Power of a Power Rule is just — an ordinary single exponent. The stacked notation would then be pointless, since it would never express anything new. Reading top-down is what makes towers worth writing at all.
A caution about calculators. Some calculators and programming languages evaluate a chain of powers left to right, so entering 2^3^2 may return rather than . When in doubt, insert brackets and write explicitly.
Insert one pair of parentheses in each expression to make the statement true.
(a) (b) (c)
Answer
(a) (b) (c)
Solution
These run the usual exercises backwards: instead of applying the rules, we use brackets to override them and force a different order. Recall that grouping symbols always take priority, whatever the other rules say.
A good method is to first work out what the expression gives without brackets, see how far off it is, and then ask which operation would have to be promoted.
(a) . Without brackets the rules give , not . To reach we notice , and is . So the addition must be done first, which means bracketing it:
(b) . Without brackets the rules give , not . To reach we notice , and is . So the subtraction must be promoted:
(c) . Without brackets the rules give , not . To reach we notice , and is . So the addition must be done before the squaring:
The pattern. In all three parts the bracket promoted the operation that the rules would otherwise have done last. That is the usual situation, because brackets are only needed when you want the natural order reversed. If the answer you want already matches the unbracketed value, no brackets are required at all.
Always check. After inserting brackets, evaluate the whole expression from scratch and confirm you reach the stated value, as done above. It is easy to bracket the right numbers in the wrong place.
A shop sells shirts at $12 each and hats at $ 7 each. Priya buys shirts and hats, then uses a voucher.
(a) Write a single expression for the amount she pays.
(b) Evaluate it.
(c) Her friend evaluates the expression strictly left to right and gets a different answer. What does he get, and why is it wrong?
Answer
(a) (b) (c)
Solution
Part (a). The cost of the shirts is lots of , that is . The cost of the hats is lots of , that is . These are added, and then the voucher is subtracted:
Notice that no brackets are needed. The order of operations already does the right thing, because each product is a single item of cost — a term — and the terms are then added and subtracted. This is exactly the motivation this section gives for putting multiplication above addition in the first place.
Part (b). Multiplications first, since they sit at level 3:
The expression becomes
Addition and subtraction share level 4, so work left to right:
So Priya pays .
Check against the story: three shirts at is ; two hats at is ; together ; less the voucher leaves . ✓
Part (c). Evaluating strictly left to right, ignoring priority, the friend would compute
So he gets . The answer is absurd on its face: Priya bought five items whose listed prices are and , so she cannot possibly owe more than about .
The mistake is that "" was treated as a step in a running total, when in fact the is not an amount of money at all — it is a count of hats, and it only becomes money once multiplied by . The order of operations exists precisely so that is bound together as one quantity before any adding happens.
The general lesson. When a real situation is written as a single expression, the order of operations usually matches the meaning automatically. If your arithmetic gives an answer that makes no sense in the story, suspect the order before suspecting the arithmetic.
Evaluate and . Explain why they differ.
Answer
and .
Solution
The first expression, . Both operations are divisions, sitting at the same priority level, so the rule is strictly left to right:
So the value is .
The second expression, . The brackets override the left-to-right rule and force the second division to happen first:
So the value is .
Why they differ. Division is not associative: regrouping the same numbers with the same operations changes the answer. Compare this with addition, where the associative property from the earlier section on the rules of algebra guarantees , so the grouping makes no difference. There is no such guarantee for division.
This is exactly why the left-to-right convention is needed. With addition the convention would be harmless, since every grouping agrees. With division the convention is doing real work: it picks out one of two genuinely different answers as the meaning of .
A related warning. Subtraction is not associative either, for the same reason. This section illustrates it with
Practical advice. A chain of divisions such as is easy to misread. If you mean , write it that way, or write . If you mean , use a bracket or a fraction bar. The reader should never have to rely on remembering a convention.
Evaluate .
Answer
Solution
Two extra symbols appear here, and each behaves as a grouping symbol in its own way.
- A radical sign acts like a bracket around everything underneath it: evaluate what is inside first, then take the root. The root itself sits at level 2, alongside exponents, since a root is a fractional exponent.
- Absolute value bars likewise act like brackets: evaluate what is inside first, then take the absolute value.
Step 1: the grouped quantities. Inside the absolute value bars,
so
using the definition from the earlier section: the absolute value of a negative number is its negative, and . The answer is positive, as an absolute value always is.
The radical needs no inner work, since is already a single number.
Step 2: level 2, roots and exponents.
The expression is now
Step 3: level 3, multiplication.
The expression is now
Step 4: level 4, addition.
The mistake to guard against. It is tempting to read the middle of the expression as first, giving . But the multiplication outranks the addition, so the from the square root has to wait. Writing each stage on its own line, as above, makes it much harder to slip.
Note also that is , not and not . The bars must be evaluated, not simply erased.
A student evaluates as . Find the error and give the correct value.
Answer
The correct value is .
Solution
The correct value. Division and multiplication have equal priority, so they are performed strictly left to right. Reading from the left, the division comes first:
The error. The student performed the multiplication before the division, almost certainly because the letter "M" comes before the letter "D" in PEMDAS. But as this section stresses, "MD" is a single level, not two. The letters appear in that order only because the acronym has to be pronounceable.
There is a second way to describe the same mistake: the student effectively read the expression as , inserting a bracket that is not there. Brackets change the meaning, and you are not free to add them.
Checking which reading is right. Rewrite the expression as a fraction. Left to right, means
whereas the student's reading would have to be written as
These are visibly different expressions, and only the first matches what was written.
How to avoid this. When you see a run of multiplications and divisions, put your finger at the left end and move right, doing each operation as you meet it. Do not scan ahead for multiplications. The same discipline applies to a run of additions and subtractions.
A student evaluates as . Find the error and give the correct value.
Answer
The correct value is .
Solution
The correct value. Both operations are subtractions, at the same priority level, so they are performed strictly left to right:
The error. The student grouped the last two numbers together, inserting a bracket that was never written. As noted in the previous exercise, adding a bracket changes the expression into a different one.
The damage is done by the sign. Inside the invented bracket, , and subtracting adds rather than removing . That is why the student's answer, , is not merely different but larger than the number he started with — a clear signal that something has gone wrong, since we are subtracting positive amounts from and the result must be smaller than .
A concrete check. Think of it as money: you have , you spend , then you spend . You are left with , not . The story leaves no room for doubt.
When would the student's grouping be correct? Only if the brackets were actually printed:
So and are genuinely different expressions with different values, which shows that subtraction, like division, is not associative. The left-to-right convention is what settles the meaning of the unbracketed version.
The habit to build. Whenever you feel tempted to "do the easy pair first" in a run of additions and subtractions, resist. Move left to right, one operation at a time.
Is the statement always true, sometimes true, or never true? Assume and are not zero, and justify your answer.
Answer
Sometimes true.
Solution
The answer is sometimes.
A case where it fails. Take , , .
The left side, worked left to right:
The right side:
Since , the statement is false here. So it is certainly not always true.
A case where it holds. Take , , .
The left side:
The right side:
Both give , so the statement is true here.
Since it holds in one case and fails in another, it is sometimes true.
Which cases work. Writing both sides as fractions makes the pattern clear. The left side is
and the right side is
These agree exactly when . Multiplying both sides by , which is allowed since and are non-zero, gives . So either , or , which means or .
That explains the successful example, where was , and it shows how special such cases are. For a randomly chosen the statement will fail.
Why this matters. The left side is what actually means under the order of operations. The right side is what many people think it means. The gap between the two is the reason this section warns so strongly against writing expressions like at all: they invite exactly this confusion, and the safe course is to write or and leave nothing to interpretation.
Explain carefully why rather than , and state how you would write the expression if you wanted the answer .
Solution
The rule involved. The minus sign in is a unary minus: it sits in front of a single quantity and negates it, rather than sitting between two numbers as a subtraction. This section states that a unary minus has lower priority than exponentiation.
So exponentiation is carried out first, and the negation is applied to the result:
Why the priority is set this way. The section explains the underlying reason when discussing why exponents outrank multiplication: an exponent belongs to the base immediately beneath it, and nothing more. In the base written under the exponent is , not . For the base to be , the minus sign would have to be attached to it by brackets.
There is also a strong practical reason. Algebraic expressions such as appear constantly, and they are always intended to mean . If the convention were the other way round, an expression like would become ambiguous, since the reader could not tell whether the minus belonged to the subtraction or to the base.
How to get . Use brackets to make the base explicit:
The brackets override the priority rules, which, as this section says, grouping symbols always do.
A summary of the two expressions.
One further caution. The distinction disappears for odd exponents: both and equal , because an odd power keeps the sign of its base. So testing your understanding on a cube will not reveal whether you have the rule right. Always test with a square.
The expression is ambiguous. Rewrite it in the two unambiguous ways described in this section, and give the value of each.
Answer
and .
Solution
The trouble lies in the notation , where the multiplication is shown by simply placing the next to the bracket. This section calls that implied multiplication, or multiplication by juxtaposition, and explains that there is genuine disagreement about its priority.
Reading 1: juxtaposition is ordinary multiplication. Under this reading, means , and the expression is treated by strict left-to-right PEMDAS. Brackets first:
leaving . Division and multiplication share a level, so left to right:
Written so that no reader could mistake it, this is
Reading 2: juxtaposition binds more tightly. Under this reading, the and the bracket form a single visual unit that must be evaluated before the division. Brackets first again:
then the juxtaposed product:
and finally the division:
Written unambiguously, this is
Which is right? Neither, and that is the point. As this section explains — using the closely related expression that went viral in 2019 — both readings follow a consistent rule, but they follow different rules. Textbooks, calculators and software genuinely disagree: some scientific calculators give juxtaposition higher priority, while Google and Wolfram Alpha do not. The American Mathematical Society described the viral problem as ambiguous as written.
The real lesson. Do not try to memorise which convention "wins". Instead, never write an expression of this shape. Once the intent is expressed with a fraction bar or an extra pair of brackets, as in the two displayed forms above, there is nothing left to argue about. Clarity is the writer's job, not the reader's.
Evaluate
Answer
Solution
This combines several levels at once, so work patiently from the innermost grouping outward, writing one line per step.
Step 1: the innermost bracket, . Inside it, the exponent comes before the subtraction:
The expression becomes
Step 2: the numerator of the fraction. The fraction bar groups the top separately, so finish it off:
Step 3: the denominator of the fraction. Likewise finish the bottom:
The expression becomes
Step 4: the division. Only now that top and bottom are each a single number may we divide:
The expression becomes
Step 5: the exponent and the root. Both sit at level 2:
The expression becomes
Step 6: the subtraction.
Check the plausibility of the answer. The bracket collapsed to the small number , so squaring it gives only , while the square root contributes . A negative final answer is therefore exactly what we should expect. If you obtained a large positive number, the likely cause is squaring before dividing, or taking to be something other than .
The technique to carry forward. Do not attempt several operations on one line. Each step above changed exactly one thing, which makes any error easy to locate. On a long expression this discipline is worth far more than speed.
Frequently Asked Questions
Does PEMDAS mean multiplication always comes before division?
No. "MD" in PEMDAS is a single level: multiplication and division have equal priority and are evaluated left to right. The letters M and D appear in that order only because "PEDMAS" is harder to pronounce. Whenever division appears to the left of multiplication, division is performed first.
Is PEMDAS the same as BODMAS?
Yes, they describe the same rules. PEMDAS is standard in the United States; BODMAS, BEDMAS, and BIDMAS are used in the UK, Canada, Australia, and other Commonwealth countries. The differences are purely in the English words chosen: parentheses vs. brackets, exponents vs. orders vs. indices. The mathematical priority hierarchy is identical everywhere. See the International Variants section for details.
What does the fraction bar do in the order of operations?
A fraction bar acts as an implicit parenthesis around both the numerator and the denominator. The entire numerator is evaluated first, the entire denominator is evaluated first, and then the division is performed. So , not .
What is the correct answer to ?
The expression is ambiguous. Applying strict left-to-right PEMDAS (treating as ) gives . Applying the convention that juxtaposition has higher priority than division gives . Both are defensible under different conventions. In professional mathematical writing, such expressions are never used; the author would write either or to make the intent clear.
Is equal to or ?
It equals . By convention, exponentiation has higher priority than unary negation, so is read as . To get , write explicitly.
Why do different calculators give different answers?
Calculators implement PEMDAS strictly left to right and do not give implied multiplication any special priority. In expressions like , most modern calculators compute , while older models or some scientific calculators compute . This is a calculator design choice, not a mathematical rule, which is why such notation should be avoided.