Skip to main content
Mathematics LibreTexts

1.2: Order of Operations

  • Page ID
    19850
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The order in which we evaluate expressions can be ambiguous. Take, for example, the expression \(-4+2 \cdot 8\). If we perform the addition first, then we get \(-16\) as a result (the question mark over the equal sign indicates that the result is questionable).

    \[\begin{align*} -4+2 \cdot 8 &\overset{?}{=} -2 \cdot 8\\ &\overset{?}{=}-16 \end{align*} \nonumber \]

    On the other hand, if we perform the multiplication first, then we get \(12\) as a result.

    \[\begin{align*} -4+2 \cdot 8 &\overset{?}{=} -4 + 16\\ &\overset{?}{=}12 \end{align*} \nonumber \]

    So, what are we to do? Of course, grouping symbols would remove the ambiguity.

    Grouping Symbols

    Parentheses, brackets, and absolute value bars can be used to group parts of an expression. For example:

    \[3+5(9-11) \quad \text{or} \quad-2-[-2-5(1-3)] \quad \text{or} \quad 6-3|-3-4| \nonumber \]

    In each case, the rule is “evaluate the expression inside the grouping symbols first.” If the grouping symbols are nested, evaluate the expression in the innermost pair of grouping symbols first.

    Thus, if the example above is grouped as follows, we are forced to evaluate the expression inside the parentheses first.

    \[\begin{aligned} (-4+2) \cdot 8 &=-2 \cdot 8 \color{Red}\text { Parentheses first: }-4+2=-2 \\ &=-16 \quad \color{Red} \text { Multiply: }-2 \cdot 8=-16 \end{aligned} \nonumber \]

    Another way to avoid ambiguities in evaluating expressions is to establish an order in which operations should be performed. The following guidelines should always be strictly enforced when evaluating expressions.

    Rules Guiding Order of Operations

    When evaluating expressions, proceed in the following order.

    1. Evaluate expressions contained in grouping symbols first. If grouping symbols are nested, evaluate the expression in the innermost pair of grouping symbols first.
    2. Evaluate all exponents that appear in the expression.
    3. Perform all multiplications and divisions in the order that they appear in the expression, moving left to right.
    4. Perform all additions and subtractions in the order that they appear in the expression, moving left to right.

    Example \(\PageIndex{1}\)

    Simplify: \(-3-4 \cdot 8\).

    Solution

    Because of the established Rules Guiding Order of Operations, this expression is no longer ambiguous. There are no grouping symbols or exponents present, so we immediately go to rule three, evaluate all multiplications and divisions in the order that they appear, moving left to right. After that we invoke rule four, performing all additions and subtractions in the order that they appear, moving left to right.

    \[\begin{aligned} -3-4 \cdot 8&= -3-32 \quad \color{Red} \text { Multiply first: } 4 \cdot 8=32 \\ &= -3+(-32) \quad \color{Red} \text { Add the opposite. } \\ &= -35 \quad \color{Red} \text { Add: }-3+(-32)=-35\\ \text{Thus, } -3-4 \cdot 8&= -35 \end{aligned} \nonumber \]

    Exercise \(\PageIndex{1}\)

    Simplify: \(-4+2 \cdot 8\).

    Answer

    \(12\)

    Writing Mathematics

    When simplifying expressions, observe the following rule to neatly arrange your work:
    One equal sign per line.

    This means that you should not arrange your work horizontally.

    \[-2-4 \cdot(-8)=-2-(-32)=-2+32=30 \nonumber \]

    That’s three equal signs on a single line. Rather, arrange your work vertically, keeping equal signs aligned in a column.

    \[\begin{aligned}-2-4 \cdot(-8) &=-2-(-32) \\ &=-2+32 \\ &=30 \end{aligned} \nonumber \]

    Example \(\PageIndex{2}\)

    Simplify: \(54/(-9)(2)\).

    Solution

    There are no grouping symbols or exponents present, so we immediately go to rule three, evaluate all multiplications and divisions in the order that they appear, moving left to right.

    \[\begin{aligned} 54 /(-9)(2) &=-6(2) \quad \color{Red}\text { Divide first: } 54 /(-9)=-6 \\ &=-12 \quad \color{Red}\text { Multiply: }-6(2)=-12 \\ \text{Thus, } 54 /(-9)(2)&= -12 \end{aligned} \nonumber \]

    Exercise \(\PageIndex{2}\)

    Simplify: \(-24 /(-3)(2)\).

    Answer

    \(16\)

    Example \(\PageIndex{2}\) can be a source of confusion for many readers. Note that multiplication takes no preference over division, nor does division take preference over multiplication. Multiplications and divisions have the same level of preference and must be performed in the order that they occur, moving from left to right. If not, the wrong answer will be obtained.

    \(\color{Red}\text {Warning!}\)

    Here is what happens if you perform the multiplication in Example \(\PageIndex{2}\) before the division.

    \[\begin{aligned} 54 /(-9)(2) &=54/(-18) \quad \color{Red}\text { Multiply: } (-9)(2)=-18 \\ &=-3 \quad \color{Red}\text { Divide: } 54/(-18)=-3 \end{aligned} \nonumber\]

    \(\color{Red}\text{This is incorrect!}\) Multiplications and divisions must be performed in the order that they occur, moving from left to right.

    Example \(\PageIndex{3}\)

    Simplify:

    1. \((-7)^{2}\)
    2. \(-7^{2}\)

    Solution

    Recall that for any integer a, we have \((-1)a =-a\). Because negating is equivalent to multiplying by \(-1\), the Rules Guiding Order of Operations require that we address grouping symbols and exponents before negation.

    1. Because of the grouping symbols, we negate first, then square. That is, \[\begin{aligned}(-7)^{2} &=(-7)(-7) \\ &=49 \end{aligned} \nonumber \]
    2. There are no grouping symbols in this example. Thus, we must square first, then negate. That is, \[\begin{aligned}-7^{2} &=-(7 \cdot 7) \\ &=-49 \end{aligned} \nonumber \]

    Thus, \((-7)^2 = 49\), but \(-7^2 = -49\). Note: This example demonstrates that \((-7)^2\) is different from \(-7^2\).

    Exercise \(\PageIndex{3}\)

    Simplify: \(-15^{2}\).

    Answer

    \(-225\)

    Let’s try an example that has a mixture of exponents, multiplication, and subtraction.

    Example \(\PageIndex{4}\)

    Simplify: \(-3-2(-4)^{2}\).

    Solution

    The Rules Guiding Order of Operations require that we address exponents first, then multiplications, then subtractions.

    \[\begin{aligned} -3-2(-4)^{2} &=-3-2(16) \quad \color{Red} \text{ Exponent first: } (-4)^2 = 16 \\ &=-3-32 \quad \color{Red} \text{ Multiply: } 2(16)=32 \\ &=-3+(-32) \quad \color{Red} \text{Add the opposite.} \\ &=-35 \quad \color{Red} \text{ Add: } -3+(-32) = -35 \\ \text{Thus, } -3-2(-4)^{2} &= -35 \end{aligned} \nonumber \]

    Exercise \(\PageIndex{4}\)

    Simplify: \(-5-4(-2)^{3}\).

    Answer

    \(27\)

    Grouping Symbols

    The Rules Guiding Order of Operations require that expressions inside grouping symbols (parentheses, brackets, or curly braces) be evaluated first.

    Example \(\PageIndex{5}\)

    Simplify: \(-2(3-4)^{2}+5(1-2)^{3}\).

    Solution

    The Rules Guiding Order of Operations require that we first evaluate the expressions contained inside the grouping symbols.

    \[\begin{aligned} -2(3-4)^{2} + 5(1-2)^{3} &=-2(3+(-4))^{2}+5(1+(-2))^{3} \quad \color{Red} \text{ Add the opposites.}\\ &=-2(-1)^{2}+5(-1)^{3} \quad \color{Red} \text{ Parenthesis first: } 3+(-4)=-1 \text{ and } 1+(-2)=-1\\ \text {Evaluate the exponents next, perform the multiplications, then add.}\\ &= -2(1)+5(-1) \quad \color{Red} \text{ Exponents: } (-1)^2=1 \text{ and } (-1)^3=-1\\ &=-2(1)+5(-1) \quad \color{Red} \text{ Multiply: } -2(1)=-2 \text{ and } 5(-1)=-5 \\ &=-7 \quad \color{Red} \text{ Add } -2+(-5)=-7 \\ \text{Thus, } -2(3-4)^{2} + 5(1-2)^{3} &= -7 \end{aligned}\nonumber\]

    Exercise \(\PageIndex{5}\)

    Simplify: \(-2-3(-2-3)^{3}\).

    Answer

    \(373\)

    Absolute Value Bars as Grouping Symbols

    Like parentheses and brackets, you must evaluate what is inside them first, then take the absolute value of the result.

    Example \(\PageIndex{6}\)

    Simplify: \(-8-|5-11|\).

    Solution

    We must first evaluate what is inside the absolute value bars.

    \[\begin{aligned} -8-|5-11| &=-8-|5+(-11)| \quad \color{Red} \text{ Add the opposites.}\\ &=-8-|-6| \quad \color{Red} \text{ Add: } 5+(-11)=-6\\ \text {The number } -6 \text{ is } 6 \text{ units from zero on the number line. Hence, } |-6|=6 \\ &= -8-6 \quad \color{Red} \text{ Add: } |-6|=6\\ &= -8+(-6) \quad \color{Red} \text{ Add the opposite. } \\ &=-14 \quad \color{Red} \text{ Add. } -2+(-5)=-7 \\ \text{Thus, } -8-|5-11| &= -14 \end{aligned}\nonumber\]

    Exercise \(\PageIndex{6}\)

    Simplify: \(-|-4-6|\).

    Answer

    \(-10\)

    Nested Grouping Symbols

    When grouping symbols are nested, the Rules Guiding Order of Operations tell us to evaluate the innermost expressions first.

    Example \(\PageIndex{7}\)

    Simplify: \(-3-4[-3-4(-3-4)]\).

    Solution

    The Rules Guiding Order of Operations require that we first address the expression contained in the innermost grouping symbols. That is, we evaluate the expression contained inside the brackets first.

    \[\begin{aligned}
    -3-4[-3-4(-3-4)] &=-3-4[-3-4(-3+(-4))] \quad \color{Red} \text{ Add the opposite.}\\
    &=-3-4[-3-4(-7)] \quad \color{Red} \text{ Add: } -3+(-4)=-7\\
    \text {Next, we evaluate the expression contained inside the brackets. } \\
    &= -3-4[-3-(-28)] \quad \color{Red} \text{ Multiply: } 4(-7)=-28\\
    &= -3-4[-3+28] \quad \color{Red} \text{ Add the opposite. } \\
    &= -3-4[25] \quad \color{Red} \text{ Add: } -3+28=25 \\
    \text{Now we multiply, then subtract.}\\
    &= -3-100 \quad \color{Red} \text{ Multiply: } 4\{25\}=100 \\
    &= -3+(-100) \quad \color{Red} \text{ Add the opposite. } \\
    &= -103 \quad \color{Red} \text{ Add: } -3+(-100)=-103 \\
    \text{Thus, } -3-4[-3-4(-3-4)] &= -103 \end{aligned} \nonumber \]

    Exercise \(\PageIndex{7}\)

    Simplify: \(-2-2[-2-2(-2-2)]\).

    Answer

    \(-14\)

    Evaluating Algebraic Expressions

    Variable

    A variable is a symbol (usually a letter) that stands for an unknown value that may vary.

    Let’s add the definition of an algebraic expression.

    Algebraic Expression

    When we combine numbers and variables in a valid way, using operations such as addition, subtraction, multiplication, division, exponentiation, the resulting combination of mathematical symbols is called an algebraic expression.

    Thus,

    \[2a, \quad x+5, \quad \text{and} \quad y^{2} \nonumber \]

    being formed by a combination of numbers, variables, and mathematical operators, are valid algebraic expressions.

    An algebraic expression must be well-formed. For example, \[2+-5x \nonumber \] is not a valid expression because there is no term following the plus sign (it is not valid to write \(+−\) with nothing between these operators). Similarly, \[2+3(2 \nonumber \] is not well-formed because parentheses are not balanced.

    In this section we will evaluate algebraic expressions for given values of the variables contained in the expressions. Here are some simple tips to help you be successful.

    Tips for Evaluating Algebraic Expressions

    1. Replace all occurrences of variables in the expression with open parentheses. Leave room between the parentheses to substitute the given value of the variable.
    2. Substitute the given values of variables in the open parentheses prepared in the first step.
    3. Evaluate the resulting expression according to the Rules Guiding Order of Operations.

    Example \(\PageIndex{8}\)

    Evaluate the expression \(x^{2}-2xy+y^{2}\) at \(x=-3\) and \(y=2\).

    Solution

    Following Tips for Evaluating Algebraic Expressions, first replace all occurrences of variables in the expression \(x^{2}-2xy+y^{2}\) with open parentheses. Next, substitute the given values of variables (\(-3\) for \(x\) and \(2\) for \(y\)) in the open parentheses.

    \[\begin{aligned} x^{2}-2 x y+y^{2} &=(\;\; )^{2}-2(\;\;)( )+( )^{2} \\ &=({\color{Red}-3})^{2}-2({\color{Red}-3})({\color{Red}2})+({\color{Red}2})^{2} \end{aligned} \nonumber \]

    Finally, follow the Rules Guiding Order of Operations to evaluate the resulting expression.

    \[\begin{aligned} x^{2} &-2 x y+y^{2} \quad \color{Red} \text{ Original Expression. } \\ &=(\;\;)^{2}-2(\;\;)()+()^{2} \quad \color{Red} \text{ Replace variables with parenthesis. } \\ &=({\color{Red}-3})^{2}-2({\color{Red}-3})({\color{Red}2})+({\color{Red}2})^{2} \quad \color{Red} \text{ Substitute } -3 \text{ for } x \text{ and } 2 \text{ for } y \\ &=9-2(-3)(2)+4 \quad \color{Red} \text{ Evaluate exponenets first. } \\ &=9-(-6)(2)+4 \quad \color{Red} \text{ Left to right, multiply: } 2(-3)=-6\\ &=9-(-12)+4 \quad \color{Red} \text{ Left to right, multiply: } (-6)2=-12\\ &=9+12+4 \quad \color{Red} \text{ Add the opposite. } \\ &=25 \quad \color{Red} \text{ Add. }\\ \text{Thus, if } x=-3 \text{ and } y=2 \text{ , then } x^{2}-2 x y+y^{2}=25 \end{aligned} \nonumber\]

    Exercise \(\PageIndex{8}\)

    If \(x=-2\) and \(y=-1\), evaluate \(x^{3}-y^{3}\).

    Answer

    \(-7\)

    Evaluating Fractions

    If a fraction bar is present, evaluate the numerator and denominator separately according to the Rules Guiding Order of Operations, then perform the division in the final step.

    Example \(\PageIndex{9}\)

    Evaluate the expression \[\dfrac{ad-bc}{a+b} \nonumber\] at \(a=5, b=-3, c=2,\) and \(d=-4\).

    Solution

    Following Tips for Evaluating Algebraic Expressions, first replace all occurrences of variables in the expression \((ad−bc)/(a+b)\) with open parentheses. Next, substitute the given values of variables (\(5\) for \(a\), \(-3\) for \(b\), \(2\) for \(c\), and \(-4\) for \(d\)) in the open parentheses.

    \[\begin{aligned} \dfrac{a d-b c}{a+b} &=\dfrac{(x)-(x)}{( )+( )} \\ &=\dfrac{({\color{Red}5})({\color{Red}-4}-)-({\color{Red}-3})({\color{Red}2})}{({\color{Red}5})+({\color{Red}-3})} \end{aligned} \nonumber\]

    Finally, follow the Rules Guiding Order of Operations to evaluate the resulting expression. Note that we evaluate the expressions in the numerator and denominator separately, then divide.

    \[\begin{aligned}
    \dfrac{a d-b c}{a+b} &=\dfrac{(x)-(x)}{( )+( )} \quad \color{Red} \text{ Replace variables with parentheses. } \\
    &=\dfrac{({\color{Red}5})({\color{Red}-4}-)-({\color{Red}-3})({\color{Red}2})}{({\color{Red}5})+({\color{Red}-3})} \quad \color{Red} \text{ Substitute: } 5 \text{ for } a,-3 \text{ for } b, 2 \text{ for } c, -4\text{ for } d \\
    &=\dfrac{-20-(-6)}{2} \quad \color{Red} \text{ Numerator: } (5)(-4)=-20,(-3)(2)=-6 \text{, Denominator: } 5+(-3)=2 \\
    &=\dfrac{-20+6}{2} \quad \color{Red} \text{ Numerator: Add the opposite. } \\
    &=\dfrac{-14}{2} \quad \color{Red} \text{Numerator: } -20+6=-14 \\
    &=-7 \quad \color{Red} \text{ Divide } \\
    \text{Thus, if } x=-3 \text{ and } y=2 \text{ , then } x^{2}-2 x y+y^{2}=25
    \end{aligned} \nonumber \]

    Exercise \(\PageIndex{9}\)

    If \(a=-7, b=-3, c=-15\) and \(d=-14\), evaluate: \(\dfrac{a^{2}+b^{2}}{c+d}\)

    Answer

    \(-2\)

    Using the Graphing Calculator

    The graphing calculator is a splendid tool for evaluating algebraic expressions, particularly when the numbers involved are large.

    Example \(\PageIndex{10}\)

    Use the graphing calculator to simplify the following expression: \[-213-35[-18-211(15-223)] \nonumber \]

    Solution

    The first difficulty with this expression is the fact that the graphing calculator does not have a bracket symbol for the purposes of grouping. The calculator has only parentheses for grouping. So we first convert our expression to the following:

    \[-213-35(-18-211(15-223)) \nonumber \]

    Note that brackets and parentheses are completely interchangeable. The next difficulty is determining which of the minus signs are negation symbols and which are subtraction symbols. If the minus sign does not appear between two numbers, it is a negation symbol. If the minus sign does appear between two numbers, it is a subtraction symbol. Hence, we enter the following keystrokes on our calculator. The result is shown in Figure \(\PageIndex{1}\).

    fig 1.2.1.png

    Figure \(\PageIndex{1}\): Calculating \(-213-35[-18-211(15-223)]\)

    Thus, \(-213-35[-18-211(15-223)]=-1,535,663\).

    Exercise \(\PageIndex{10}\)

    Use the graphing calculator to evaluate: \[-2-2[-2-2(-2-2)] \nonumber \]

    Answer

    \(-14\)

    Example \(\PageIndex{11}\)

    Use the graphing calculator to evaluate: \[\dfrac{5+5}{5+5} \nonumber \]

    Solution

    You might ask “Why do we need a calculator to evaluate this exceedingly simple expression?” After all, it’s very easy to compute.

    \[\begin{aligned} \dfrac{5+5}{5+5} &=\dfrac{10}{10} \quad \color{Red} \text{ Simplify numerator and denominator. } \\ &=1 \quad \color{Red} \text{ Divide: } 10/10=1 \end{aligned} \nonumber \]

    Well, let’s enter the expression \(5+5/5+5\) in the calculator and see how well we understand the Rules Guiding Order of Operations (see first image in Figure \(\PageIndex{2}\)). Whoa! How did the calculator get \(11\)? The answer is supposed to be \(1\)! Let’s slow down and apply the Rules Guiding Order of Operations to the expression \(5+5/5+5\).

    \[\begin{aligned} \dfrac{5+5}{5+5} &= 5+\dfrac{5}{5}+5 \quad \color{Red} \text{ Divide first. } \\ &=5+1+5 \quad \color{Red} \text{ Divide: } \dfrac{5}{5}=1 \\ &= 11 \quad \color{Red} \text{ Add: } 5+1+5=11 \end{aligned} \nonumber \]

    Aha! That’s how the calculator got \(11\).

    \[5+5 / 5+5 \quad \text { is equivalent to } \quad 5+\dfrac{5}{5}+5 \nonumber \]

    Let’s change the order of evaluation by using grouping symbols. Note that:

    \[\begin{aligned} (5+5) /(5+5) &=10 / 10 \quad \color{Red} \text { Parentheses first. } \\ &= 1 \quad \color{Red} \text { Divide: } 10/10 = 1 \end{aligned} \nonumber \]

    That is:

    \[(5+5) /(5+5) \quad \text { is equivalent to } \quad \dfrac{5+5}{5+5} \nonumber \]

    Enter \((5+5)(5+5)\) and press the ENTER key to produce the output shown in the second image in Figure \(\PageIndex{2}\)).

    fig 1.2.2.png

    Figure \(\PageIndex{2}\)): Calculating \(\dfrac{5+5}{5+5}\)

    Exercise \(\PageIndex{11}\)

    Use the graphing calculator to evaluate: \[\dfrac{10+10}{10+10} \nonumber \]

    Answer

    \(1\)

    The graphing calculator has memory locations available for “storing”values. They are lettered A-Z and appear on the calculator case, in alphabetic order as you move from left to right and down the keyboard. Storing values in these memory locations is an efficient way to evaluate algebraic expressions containing variables. Use the ALPHA key to access these memory locations.

    fig 1.2.3.png

    Figure \(\PageIndex{3}\)): Upper half of the TI-84.

    Example \(\PageIndex{12}\)

    Use the graphing calculator to evaluate \(|a|-|b|\) at \(a=-312\) and \(b=-875\).

    Solution

    First store \(-312\) in the variable \(A\) with the following keystrokes. To select the letter \(A\), press the ALPHA key, then the MATH key, located in the upper left-hand corner of the calculator (see Figure \(\PageIndex{3}\)).

    fig 1.2.5a.png

    Next, store \(-875\) in the variable B with the following keystrokes. To select the letter \(B\), press the ALPHA key, then the APPS key.

    fig 1.2.5b.png

    The results of these keystrokes are shown in the first image in Figure \(\PageIndex{4}\).

    Now we need to enter the expression |a|−| b|. The absolute value function is located in the MATH menu. When you press the MATH key, you’ll notice submenus MATH, NUM, CPX, and PRB across the top row of the MATH menu. Use the right-arrow key to select the NUM submenu (see the second image in Figure \(\PageIndex{4}\)). Note that abs( is the first entry on this menu. This is the absolute value function needed for this example. Enter the expression \(\operatorname{abs}(\mathrm{A})-\operatorname{abs}(\mathrm{B})\) as shown in the third image in Figure \(\PageIndex{4}\). Use the ALPHA key as described above to enter the variables A and B and close the parentheses using the right parentheses key from the keyboard. Press the ENTER key to evaluate your expression.

    fig 1.2.4.png

    Figure \(\PageIndex{4}\): Evaluate \(|a|-|b|\) at \(a=-312\) and \(b=-875\).

    Thus, \(|a|-|b|=-563\).

    Exercise \(\PageIndex{12}\)

    Use the graphing calculator to evaluate \(|a-b|\) at \(a=-312\) and \(b=-875\).

    Answer

    \(563\)

    Contributors


    This page titled 1.2: Order of Operations is shared under a CC BY-NC-ND 3.0 license and was authored, remixed, and/or curated by David Arnold via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.