# 5.3: Order of Operations

- Page ID
- 19650

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

Learning Outcomes

*Use the order of operations to correctly perform multi-step arithmetic**Apply the order of operations to statistics related complex questions.*

When we are given multiple arithmetic operations within a calculation, there is a, established order that we must do them in based on how the expression is written. Understanding these rules is especially important when using a calculator, since calculators are programmed to strictly follow the order of operations. This comes up in every topic in statistics, so knowing the order of operations is an essential skill for all successful statistics students to have.

## PEMDAS

The order of operations are as follows:

**P**arentheses**E**xponents**M**ultiplication and**D**ivision**A**ddition and**S**ubtraction

When there is a tie, the rule is to go from left to right.

Notice that Multiplication and division are listed together as item 3. If you see multiplication and division in the same expression the rule is to go from left to right. Similarly, if you see addition and subtraction in the same expression the rule is to from go left to right. The same goes for two of the same arithmetic operators.

Example \(\PageIndex{1}\)

Evaluate: \(20-6\div3+\left(2\times3^2\right)\)

**Solution**

We start with what is inside the parentheses: \(2+3^2\). Since exponents comes before addition, we find \(3^2=9\) first. We now have

\[20-6\div3+\left(2\times9\right) \nonumber\]

We continue inside the parentheses and perform the multiplication: \(2\times9=18\).

This gives

\[20-6\div3+18 \nonumber\]

Since division comes before addition and subtraction, we next calculate \(6\div3=2\) to get

\[20-18+18 \nonumber\]

Since subtraction and addition are tied, we go from left to right. We calculate: \(20-18=2\) to get

\[2+18\:=20 \nonumber\]

The key to arriving at the correct answer is to go slow and write down each step in the arithmetic.

## Hidden Parentheses

You may think that since you always have a calculator or computer at hand, that you don't need to worry about order of operations. Unfortunately, the way that expressions are written is not the same as the way that they are entered into a computer or calculator. In particular, exponents need to be treated with care as do fractions bars.

Example \(\PageIndex{3}\)

Evaluate \(2.1^{6-2}\)

**Solution**

First, note that we use the symbol "^" to tell a computer or calculator to exponentiate. If you were to enter 2.1^6-2 into a computer, it would give you the answer of 83.766121 which is not correct, since the computer will first expontiate and then subtract. Since the subtraction is within the exponent, it must be performed first. To tell a calculator or computer to perform the subtraction first, we use parentheses:

2.1^(6 - 2) = 19.4481

Example \(\PageIndex{4}\): z-scores

The "z-score" is defined by:

\[z=\frac{x-\mu}{\sigma} \nonumber\]

Find the z-score rounded to one decimal place if:

\[x=2.323,\:\mu=1.297,\:\sigma=0.241 \nonumber\]

**Solution**

Once again, if we put these numbers into the z-score formula and use a computer or calculator by entering \(3.323\:-\:1.297\:\div\:0.241\) we will get -0.259 which is the wrong answer. Instead, we need to know that the fraction bar separates the numerator and the denominator, so the subtraction must be done first. We compute

\[\frac{2.323-1.297}{0.241}\:=\left(2.323-1.297\right)\div0.241=\:4.25726141 \nonumber\]

Now round to one decimal place to get 4.3. Notice that if you rounded before you did the arithmetic, you would get exactly 5 which is very different. 4.3 is more accurate.

Exercise

Suppose the equation of the regression line for the number of pairs of socks a person owns, \(y\), based on the number of pairs of shoes, \(x\), the person owns is

\[\hat y=6+2x \nonumber\]

Use this regression line to predict the number of pairs of socks a person owns for a person who owns 4 pairs of shoes.