Skip to main content
Logo image

Section A.5 Order of Operations

When you write something down, it’s important that the people who read it will understand what you actually meant. But language can be ambiguous. If we say in English, “two times three squared”, do we mean that:
  • \(2\) is multiplied by \(3\text{,}\) and then the result is squared? That would mean first we have \(6\text{,}\) and then we square \(6\) to end with \(36\text{.}\)
  • Or that \(2\) is multiplied by “three squared”? That would mean first we square \(3\) to get \(9\text{,}\) and then we multiply by \(2\) to end with \(18\text{.}\)
So it makes a difference, and the English phrase “two times three squared” is arguably ambiguous.
English is allowed to be ambiguous. But math needs to be unambiguous and mean the same thing for everyone who reads it. So for this reason, there are some rules that we’ve all agreed to that control what a math expression really means. These rules are called the “order of operations”, which we review here.
Figure A.5.1. Alternative Video Lesson

Subsection A.5.1 Grouping Symbols

Consider the expression \(2\cdot3^2\text{.}\) There are two math operations here: at some point two things will be multiplied, and at some point something will be raised to a power. The result depends on which operation you decide to do first: If you multiply \(2\cdot3\text{,}\) and then square the result, you end with \(36\text{.}\) If you square \(3\text{,}\) and then multiply that result by \(2\text{,}\) you end with \(18\text{.}\) So if we want all people everywhere to interpret \(2\cdot3^2\) in the same way, then only one of these can be correct.
One tool that we have to clearly tell readers which thing to do first is a pair of grouping symbols, like parentheses and brackets. If you intend to do the multiplication first, then writing \((2\cdot3)^2\)clearly tells your reader to do that. And if you intend to execute the power first, then writing \(2\cdot\left(3^2\right)\) clearly tells your reader to do that.
To visualize the difference between \(2\cdot \left(3^2\right)\) or \((2\cdot 3)^2\text{,}\) consider these garden plots:
two squares, side by side; each square is labeled as 3 yd wide and 3 yd high, and labeled as having area 9 yd^2
Figure A.5.2. 3 ydis squared, then doubled: \(2\cdot\left(3^2\right)\)
a square whose width is labeled as 2*3 yd = 6 yd wide and whose height is also 6 yd; the square’s area is labeled as being area 36 yd^2
Figure A.5.3. 3 yd is doubled, then squared: \((2\cdot3)^2\)
If we find \(3^2\text{,}\) we have the area of one of the small square garden plots on the left. Then if we double that, we have \(2\cdot\left(3^2\right)\text{,}\) the area of the entire left garden plot.
But if we find \((2\cdot3)^2\text{,}\) then first we are doubling \(3\text{.}\) So we are getting the area of a large square garden plot whose sides are twice as long. We end up with the area of the entire garden plot on the right.
The point is that these amounts are different.

Checkpoint A.5.4.

Calculate the value of \(30-((2+3)\cdot2)\text{,}\) respecting the order that the grouping symbols are telling you to execute the arithmetic operations.
Explanation.
The grouping symbols tell us what to work on first. In this exercise, we have grouping symbols within grouping symbols, so any operation in there (the addition) should be executed first:
\begin{equation*} \begin{aligned} 30-\left((2+3)\cdot2\right)\amp=30-\left(\highlight{5}\cdot2\right)\\ \amp=30-\highlight{10}\\ \amp=\highlight{20} \end{aligned} \end{equation*}

Subsection A.5.2 Order of Operations

If math expressions used grouping symbols for every arithmetic operation, we wouldn’t need “order of operations”. Some computer systems work that way, requiring the use of grouping symbols all the time. But it is more common to allow math expressions that don’t have grouping symbols everywhere, like \(5+3\cdot2\text{.}\) Should the addition \(5+3\) be done first, or should the multiplication \(3\cdot2\) be done first? We have a set of rules the world has agreed to, known as the “order of operations”. They tell us what to do first.
The order of operations is nothing more than an agreement that we all have made to prioritize doing arithmetic operations in a certain order.
List A.5.5. Order of Operations
(P)arentheses and other grouping symbols
Grouping symbols “group” the expression inside them, and the arithmetic within that group needs to be done first.
(E)xponentiation
After grouping symbols, exponentiation has the highest priority. Raise things to powers before doing any other arithmetic.
(M)ultiplication, (D)ivision, and Negation
After all exponentiation is done, start doing multiplication, division, and negation. These things all have equal priority. If there are more than one of them in your expression, do these things in order from left to right as you would naturally read the expression.
(A)ddition and (S)ubtraction
After all other arithmetic is done, addition and subtraction are all that is left. They have equal priority. If there are more than one of them in your expression, do these things in order from left to right as you would naturally read the expression.
To help remember the order of operations, consider the acronym PEMDAS. You might use mnemonic devices to help remember this such as “Please Excuse My Dear Aunt Sally”, “People Eat More Donuts After School”, etc.
We’ll start with a few examples that only invoke a few operations each.

Example A.5.6.

Use the order of operations to simplify the following expressions.
  1. \(10+2\cdot 3\text{.}\) With this expression, we have addition and multiplication. The order of operations says the multiplication has higher priority, so do that first:
    \begin{align*} 10+2\cdot 3\amp =10+\nextoperation{2\cdot 3}\\ \amp=10+\highlight{6}\\ \amp=\highlight{16} \end{align*}
  2. \(4+10\div 2 - 1\text{.}\) According to the order of operations, the first thing to do is the division. After that, we’ll apply the addition and subtraction working left to right:
    \begin{align*} 4+10\div2-1\amp=4+\nextoperation{10\div2}-1\\ \amp=\nextoperation{4+\highlight{5}}-1\\ \amp=\highlight{9}-1\\ \amp=\highlight{8} \end{align*}
  3. \(7-10+4\text{.}\) This expression only has subtraction and addition. These operations tie for priority (even though “A” comes before “S” in PEMDAS). So we work left to right to do them:
    \begin{align*} 7-10+4\amp=\nextoperation{7-10}+4\\ \amp=\highlight{-3}+4\\ \amp=1 \end{align*}
  4. \(20\div 4\cdot 7\text{.}\) This expression has only division and multiplication. Again, we have two operations that tie for priority, so we do them in order from left to right:
    \begin{align*} 20\div 4\cdot 5\amp=\nextoperation{20\div 4} \cdot 5\\ \amp=\highlight{5}\cdot5\\ \amp=\highlight{25} \end{align*}
  5. \((6+7)^2\text{.}\) Here we have addition inside parentheses, and an exponent of \(2\) outside. We must do the arithmetic inside the parentheses first:
    \begin{align*} (6+7)^2\amp= (\nextoperation{6+7})^2\\ \amp= \highlight{13}^2\\ \amp= \highlight{169} \end{align*}
  6. \(4(2)^3\text{.}\) This expression has multiplication and an exponent. There are parentheses, but no operation inside them. Parentheses used this way are just to make it clear that the \(4\) and \(2\) are separate numbers, not to be confused with the number \(42\text{.}\) Exponentiation has the higher priority, so we’ll do that part first, and then multiply:
    \begin{align*} 4(2)^3 \amp= 4\nextoperation{(2)^3}\\ \amp= 4(\highlight{8})\\ \amp= \highlight{32} \end{align*}

Remark A.5.7.

There are several different ways to write multiplication. We can use the symbols \(\cdot\text{,}\) \(\times\text{,}\) and \(*\) to mean multiplication. We can also write two things right next to each other with no symbol in between them to mean multiplication. That is what is happening in Item f, where the \(4\) is written right next to the \((2)^3\) with no symbol in between.
Using a symbol for multiplication is called “explicit multiplication” and not writing any symbol at all is called “implicit multiplication”. For this textbook, explicit and implicit multiplication have the same priority in the order of operations. However there are some conventions out in the real world where implicit multiplication has a higher priority in the order of operations than explicit multiplication. You may have seen memes with expressions like \(6\div2(3)\) that play on how the real world has more than one convention for the order of operations.

Checkpoint A.5.8. Practice with order of operations.

Simplify this expression one step at a time, using the order of operations.

(a)

\(5-3(7-4)^2={}\)
Explanation.
\begin{equation*} \begin{aligned} 5-3(\nextoperation{7-4})^2\amp=5-3\nextoperation{(3)^2} \end{aligned} \end{equation*}

(b)

\(\phantom{5-3(7-4)^2}={}\)
Explanation.
\begin{equation*} \begin{aligned} \amp=5-\nextoperation{3(9)} \end{aligned} \end{equation*}

(c)

\(\phantom{5-3(7-4)^2}={}\)
Explanation.
\begin{equation*} \begin{aligned} \amp=5-27 \end{aligned} \end{equation*}

(d)

\(\phantom{5-3(7-4)^2}={}\)
Explanation.
\begin{equation*} \begin{aligned} \amp=-22 \end{aligned} \end{equation*}

Checkpoint A.5.9.

Simplify \(24\div(15\div 3+1)+2\text{.}\)
Explanation.
With the expression \(24\div(15\div 3+1) +2\text{,}\) we’ll simplify what’s inside the parentheses according to the order of operations, and then take \(24\) divided by that expression as our last step:
\begin{equation*} \begin{aligned} 24\div(15\div 3+1) +2\amp= 24\div(\nextoperation{15\div 3}+1) +2\\ \amp=24\div(\nextoperation{\highlight{5}+1}) +2\\ \amp=\nextoperation{24\div \highlight{6}}+2\\ \amp=\highlight{4}+2\\ \amp=\highlight{6} \end{aligned} \end{equation*}

Checkpoint A.5.10.

Simplify \((20-4^2)\div(4-6)^3\text{.}\)
Explanation.
The expression \((20-4^2)(4-6)^3\) has two sets of parentheses, so our first step will be to simplify what’s inside each of those first according to the order of operations. Once we’ve done that, we’ll apply the exponent and then finally divide:
\begin{equation*} \begin{aligned} (20-4^2)\div(4-6)^3 \amp= (20-\nextoperation{4^2})(4-6)^3\\ \amp= (\nextoperation{20-\highlight{16}})(4-6)^3\\ \amp= \highlight{4}(\nextoperation{4-6})^3\\ \amp= 4\nextoperation{(\highlight{-2})^3}\\ \amp= \nextoperation{4(\highlight{-8})}\\ \amp= \highlight{-32} \end{aligned} \end{equation*}

Subsection A.5.3 Absolute Value and Implied Grouping

Grouping symbols are more than just parentheses and brackets. Each of the following operations implies some grouping.
Absolute Value Bars
Absolute value bars group the expression inside just like a set of parentheses would. In the expression \(3\abs{2-5}\text{,}\) the first thing to do is subtract \(2-5\) since that is inside the absolute value bars.
Radicals
The same is true with a radical symbol. Everything inside the radical is grouped. For example with \(4+2\sqrt{12-3}\text{,}\) the first arithmetic to do is subtract \(12-3\text{.}\)
Fraction Bars
A fraction bar can create two groups, one in the numerator and one in the denominator. With the expression \(\frac{2+3}{5-2}\div4\text{,}\) the first arithmetic to take care of is adding \(2+3\) and subtracting \(5-2\text{.}\) These two groups can be worked on separately in any order.
Exponents
Content that is inside an exponent is treated as one group, as with \(2+^{2\cdot3}\text{.}\) In that example, the first arithmetic to take care of is multiplying \(2\cdot3\text{.}\)
Each of these implied groupings also ask you to do something once the arithmetic on the inside is completed. Actually taking the absolute value or the square root, perhaps. Doing the division in the case of a fraction. Raising something to a power. But before doing those things, all of the arithmetic inside the groups should be take care of.

Example A.5.11.

Use the order of operations to simplify the following expressions.
  1. \(4-3\abs{5-7}\text{.}\) The absolute value bars group the \(5-7\) so we must do that subtraction first. Then we take the absolute value and continue:
    \begin{align*} 4-3\abs{5-7} \amp= 4-3\abs{\nextoperation{5-7}}\\ \amp= 4-3\nextoperation{\abs{\highlight{-2}}}\\ \amp= 4-\nextoperation{3(\highlight{2})}\\ \amp= 4-\highlight{6}\\ \amp= \highlight{-2} \end{align*}
    It would be a mistake to subtract \(4-3\) first, because that \(3\) is multiplied by the \(\abs{5-7}\text{.}\) So subtracting \(4-3\) would violate the order of operations.
  2. \(8-\sqrt{5^2-8\cdot 2}\text{.}\) The radical is grouping \(5^2-8\cdot 2\text{,}\) which must be simplified first. Then we take the square root and continue:
    \begin{align*} 8-\sqrt{5^2-8\cdot 2} \amp= 8-\sqrt{\nextoperation{5^2}-8\cdot 2}\\ \amp= 8-\sqrt{\highlight{25}-\nextoperation{8\cdot 2}}\\ \amp= 8-\sqrt{\nextoperation{25-\highlight{16}}}\\ \amp= 8-\nextoperation{\sqrt{\highlight{9}}}\\ \amp= 8-\highlight{3}\\ \amp= \highlight{5} \end{align*}
  3. \(\dfrac{2^4+3\cdot 6}{5-18\div 2}\text{.}\) We recognize that the fraction bar is creating two groups. We should simplify the numerator and denominator separately according to the order of operations, and proceed from there:
    \begin{align*} \frac{2^4+3\cdot 6}{5-18\div 2} \amp= \frac{\nextoperation{2^4}+3\cdot 6}{5-\nextoperation{18\div 2}}\\ \amp=\frac{\highlight{16}+\nextoperation{3\cdot 6}}{\nextoperation{5-\highlight{9}}}\\ \amp=\frac{\nextoperation{16+\highlight{18}}}{\highlight{-4}}\\ \amp=\frac{\highlight{34}}{-4}\\ \amp=-\frac{17}{2} \end{align*}

Checkpoint A.5.12. Implied Grouping.

Use the order of operations to evaluate
\begin{equation*} \dfrac{3^{3-1}+3\abs{9-10}}{\sqrt{3+18\div3}} \text{.} \end{equation*}
Explanation.
We start by identifying the innermost, highest priority operations:
\begin{equation*} \begin{aligned} \frac{3^{3-1}+3\abs{9-10}}{\sqrt{3+18\div3}}\amp=\frac{3^{\nextoperation{3-1}}+3\abs{\nextoperation{9-10}}}{\sqrt{3+\nextoperation{18\div3}}}\\ \amp=\frac{3^{\highlight{2}}+3\nextoperation{\abs{\highlight{-1}}}}{\sqrt{\nextoperation{3+\highlight{6}}}}\\ \amp=\frac{\nextoperation{3^2}+3(\highlight{1})}{\sqrt{\highlight{9}}}\\ \amp=\frac{\highlight{9}+\nextoperation{3(1)}}{\nextoperation{\sqrt{9}}}\\ \amp=\frac{\nextoperation{9+\highlight{3}}}{\highlight{3}}\\ \amp=\frac{\highlight{12}}{3}=\highlight{4} \end{aligned} \end{equation*}

Checkpoint A.5.13.

Simplify \(\dfrac{2\abs{9-15}+1}{\sqrt{(-5)^2+12^2}}\text{.}\)
Explanation.
To simplify this expression, the first thing we want to recognize is the role of the main fraction bar, which groups the numerator and denominator. This implies we’ll simplify the numerator and denominator separately according to the order of operations, and then reduce the fraction that results:
\begin{equation*} \begin{aligned} \frac{2\abs{9-15}+1}{\sqrt{(-5)^2+12^2}}\amp=\frac{2\abs{\nextoperation{9-15}}+1}{\sqrt{\nextoperation{(-5)^2}+12^2}}\\ \amp=\frac{2\nextoperation{\abs{\highlight{-6}}}+1}{\sqrt{\highlight{25}+\nextoperation{12^2}}}\\ \amp=\frac{\nextoperation{2(\highlight{6})}+1}{\sqrt{\nextoperation{25+\highlight{144}}}}\\ \amp=\frac{\nextoperation{\highlight{12}+1}}{\nextoperation{\sqrt{\highlight{169}}}}\\ \amp=\frac{\highlight{13}}{\highlight{13}}\\ \amp=\highlight{1} \end{aligned} \end{equation*}

Subsection A.5.4 Understanding \((-a)^m\) versus \(-a^m\)

We noted in the order of operations that using the minus sign to negate a number has the same priority as multiplication and division.
How would you write a math expression that takes the number \(-4\) and squares it? Is it OK to write \(-4^2\text{?}\) How about \((-4)^2\text{?}\)
These expressions mean very different things. The second option, \((-4)^2\) is squaring the number \(-4\text{.}\) The parentheses make this clear. The result is \(16\text{.}\)
The first expression \(-4^2\) is different. There are two actions here: a negation and exponentiation. According to the order of operations, the exponentiation has higher priority, so we should do \(4^2\) first.
\begin{align*} -4^2\amp=-\nextoperation{4^2}\\ \amp=-16 \end{align*}
and this is not the same as \((-4)^2\text{,}\) which is positive \(16\text{.}\)

Warning A.5.14. Negative Numbers Raised to Powers.

You may find yourself needing to raise a negative number to a power, and using a calculator to do the work for you. If you do not understand the issue described above, then you may get incorrect results.
  • Entering -4^2 into a calculator or computer will result in \(-16\text{.}\)
  • Entering (-4)^2 into a calculator or computer will result in \(16\text{.}\)
Try entering these into your own calculator.

Checkpoint A.5.15. Negating and Raising to Powers.

Compute the following. In each part, the first expression asks you to exponentiate and then negate the result. The second expression has a negative number raised to a power.

(a)

\(-3^4={}\) and \((-3)^4={}\)
Explanation.
\(-3^4=-81\) and \((-3)^4=81\)

(b)

\(-4^3={}\) and \((-4)^3={}\)
Explanation.
\(-4^3=-64\) and \((-4)^3=-64\)

(c)

\(-1.1^2={}\) and \((-1.1)^2={}\)
Explanation.
\(-1.1^2=-1.21\) and \((-1.1)^2=1.21\)
You might notice in Checkpoint 15 that \(-4^3\) and \((-4)^3\) each have the same result, \(-64\text{.}\) It’s true that the results are the same, but the two expressions say different things. With \(-4^3\text{,}\) you raise to a power first, then negate. With \((-4)^3\text{,}\) you negate first, then raise to a power. It’s like two different roads that happen to lead to the same place, which happens sometimes.

Exercises A.5.5 Exercises

Skills

Exercise Group.

Use the order of operations to simplify the expression.
1.
\(3 - 9 + 7\)
2.
\(4 + 7\cdot2\)
3.
\(5 - 3\cdot7\)
4.
\(6 + 9(8)\)
5.
\(7 - 6(4)\)
6.
\(3 + 35\div7\)
7.
\(9 - 3\div3\)
8.
\(5 + 24/6\)
9.
\(4 - 6/3\)
10.
\(90 \div 15/3\)
11.
\(9 + 6^{2}\)
12.
\(4 - 2^{3}\)
13.
\(7 \cdot 4^{3}\)
14.
\(24 \div 2^{3}\)
15.
\(96 / 2^{4}\)
16.
\(9 \cdot 3\mathbin{^\wedge}4\)

Exercise Group.

Use the order of operations to simplify the expression that has grouping symbols.
17.
\(5 - [ 4 + 2 ]\)
18.
\(2 - ( 8 - 9 )\)
19.
\(7 \cdot ( 3 + 6 )\)
20.
\((4 + 7) \cdot 3\)
21.
\(2 \cdot ( 3 - 4 )\)
22.
\([7 - 5] \cdot 8\)
23.
\(4 [ 9 + 5 ]\)
24.
\([9 + 4] 3\)
25.
\(6 [ 8 - 9 ]\)
26.
\([4 - 3] 7\)
27.
\(54 \div ( 2 + 4 )\)
28.
\((58 + 5) \div 9\)
29.
\(24 \div ( 10 - 4 )\)
30.
\((66 - 3) \div 7\)
31.
\(72 \div [ 6 \cdot 3 ]\)
32.
\(1323 \div [ 21 \div 7 ]\)
33.
\([ 1 + 1 ] ^{4}\)
34.
\([ 5 - 2 ] ^{3}\)
35.
\([ 3 \cdot 2 ] ^{2}\)
36.
\(( 10 \div 5 ) ^{4}\)
37.
\(-( 5 + 8 )\)
38.
\(-( 2 - 4 )\)
39.
\(-( 8 \cdot 6 )\)
40.
\(-[ 45 \div 9 ]\)
41.
\(-[ 5 ^{2}]\)
42.
\([ -3 ]^{4}\)

Exercise Group.

Use the order of operations to simplify the expression that has absolute value or implied grouping.
43.
\(8 - \abs{4 - 3}\)
44.
\(9 \cdot \abs{2 - 6}\)
45.
\(\abs{2 - 7} \cdot 3\)
46.
\(3 \abs{5 - 6}\)
47.
\(\abs{4 - 9} 8\)
48.
\(35 \div \abs{-4 - 3}\)
49.
\(\abs{31 - 7} \div 4\)
50.
\(\abs{-2 - 2}^{3}\)
51.
\(-\abs{8 + 6}\)
52.
\(-\abs{8 - 3}\)
53.
\(\sqrt{91+9}+21\)
54.
\(6+\sqrt{-7+8}\)
55.
\(\sqrt{6-2}-3\)
56.
\(8-\sqrt{22-6}\)
57.
\(5\sqrt{23+2}\)
58.
\(3\sqrt{42-6}\)
59.
\(9\sqrt{50\cdot2}\)
60.
\(3\sqrt{144\div2}\)
61.
\(3 - \dfrac{3 \cdot 16}{72 \div 6}\)
62.
\(\dfrac{12 \cdot 8}{17 - 9} \cdot 6\)
63.
\(9 \cdot \dfrac{6 \cdot 3}{18 \div 3}\)
64.
\(\dfrac{4 \cdot 4}{14 - 6} \cdot 5\)
65.
\(6 \cdot 4^{12 - 9}\)
66.
\(5^{5 \div 5} - 6\)
67.
\(6^{-8 + 9} + 6\)
68.
\(7^{7 - 5} \cdot 6\)

Challenge

69.

In this challenge, your job is to create expressions, using addition, subtraction, multiplication, and parentheses. You may use the numbers, \(1, 2, 3\text{,}\) and \(4\) in your expression, using each number only once. For example, you could make the expression: \(1+2 \cdot 3 - 4\text{.}\)
  1. The greatest value that it is possible to create under these conditions is .
  2. The least value that it is possible to create under these conditions is .
You have attempted of activities on this page.