Order of Operations

When a math problem mixes several operations together — addition, subtraction, multiplication, division, exponents, parentheses — which one do you do first? It matters a lot. Pick the wrong order and you'll get the wrong answer every time.

The order of operations is the set of rules that says exactly which calculation to do first. The rules exist so that everyone gets the same answer to the same problem. Without them, the expression \(3 + 4 \times 2\) could equal either 14 or 11 depending on which step you did first. With the order of operations, there's only one correct answer: 11.

PEMDAS: Your Guide to the Order

The order of operations is often remembered using the acronym PEMDAS, which stands for:

  • Parentheses
  • Exponents
  • Multiplication and Division (left to right)
  • Addition and Subtraction (left to right)

Many students remember it with the mnemonic "Please Excuse My Dear Aunt Sally." Some textbooks use GEMDAS instead — Grouping symbols, Exponents, Multiplication/Division, Addition/Subtraction — which means exactly the same thing. Parentheses are one type of grouping symbol.

Here's what each step means:

Parentheses (or Grouping Symbols) come first. Do whatever is inside parentheses, brackets, or other grouping symbols before anything else. If you have nested parentheses (parentheses inside parentheses!), work from the inside out.

Exponents are next. Calculate any powers or square roots after you've handled the parentheses.

Multiplication and Division are equal priority, so you work from left to right. Don't automatically do all multiplication before division—just go left to right and do whichever comes first.

Addition and Subtraction are also equal priority. Again, work left to right.

Why Does Order Matter?

Here's a simple example that shows why the order matters:

$$3 + 4 \times 2$$

If you work left to right without thinking about order, you might do: $$3 + 4 = 7$$ $$7 \times 2 = 14$$

But that's wrong! Multiplication comes before addition in PEMDAS, so you should do: $$4 \times 2 = 8$$ $$3 + 8 = 11$$

The correct answer is 11. See how different that is? Try one yourself: what does \(5 + 3 \times 4\) equal? Show answer\(5 + 3 \times 4 = 5 + 12 = 17\). Multiplication comes before addition. The shared order is what keeps everyone's answer the same.

Working Through Examples

Here are several examples, worked one step at a time.

Example 1: Evaluate \(20 - 3 \times 4\)

Following PEMDAS, multiplication comes before subtraction: $$20 - 3 \times 4$$ $$20 - 12$$ $$8$$

Example 2: Evaluate \(15 \div 3 + 2\)

Division and addition are here. Division comes first: $$15 \div 3 + 2$$ $$5 + 2$$ $$7$$

Example 3: Evaluate \((8 - 3) \times 2\)

Parentheses first, then multiplication: $$(8 - 3) \times 2$$ $$5 \times 2$$ $$10$$

Notice how different this is from \(8 - 3 \times 2\), which would equal \(8 - 6 = 2\). The parentheses completely change the answer!

Example 4: Evaluate \(2^3 + 4 \times 5\)

Exponents first, then multiplication, then addition: $$2^3 + 4 \times 5$$ $$8 + 4 \times 5$$ $$8 + 20$$ $$28$$

A More Complex Example

Here's a problem that uses every step of PEMDAS.

Example: Evaluate \(18 \div (7 - 4) + 2^2 \times 3\)

Work through it one step at a time:

Step 1 - Parentheses: \(7 - 4 = 3\) $$18 \div 3 + 2^2 \times 3$$

Step 2 - Exponents: \(2^2 = 4\) $$18 \div 3 + 4 \times 3$$

Step 3 - Division (going left to right): \(18 \div 3 = 6\) $$6 + 4 \times 3$$

Step 4 - Multiplication: \(4 \times 3 = 12\) $$6 + 12$$

Step 5 - Addition: \(6 + 12 = 18\)

The final answer is 18.

Multiplication and Division: Left to Right

One thing that trips people up is that multiplication and division have the same priority. You don't do all multiplication first and then all division. Instead, you work from left to right, doing whichever operation comes first.

Example: Evaluate \(20 \div 4 \times 5\)

Working left to right: $$20 \div 4 \times 5$$ $$5 \times 5$$ $$25$$

If you incorrectly did multiplication first, you'd get: $$20 \div 4 \times 5$$ $$20 \div 20$$ $$1$$

That's wrong! Always go left to right for operations of equal priority.

The same rule applies to addition and subtraction.

Example: Evaluate \(10 - 3 + 2\)

Working left to right: $$10 - 3 + 2$$ $$7 + 2$$ $$9$$

Using Order of Operations with Variables

The order of operations applies to algebraic expressions too. When you substitute values for variables, you follow PEMDAS to evaluate the expression.

Example 1: Evaluate \(3x + 2\) when \(x = 5\)

Substitute 5 for \(x\): $$3(5) + 2$$

Now follow PEMDAS — multiplication before addition: $$15 + 2 = 17$$

Example 2: Evaluate \(2(x + 4)\) when \(x = 3\)

Substitute 3 for \(x\): $$2(3 + 4)$$

Parentheses first: $$2(7)$$ $$14$$

Example 3: Evaluate \(x^2 - 2x + 1\) when \(x = 4\)

Substitute 4 for \(x\): $$4^2 - 2(4) + 1$$

Exponents first: $$16 - 2(4) + 1$$

Multiplication next: $$16 - 8 + 1$$

Finally, work left to right with subtraction and addition: $$8 + 1 = 9$$

Practice Problems

Try these on your own, then check your answers below.

  1. \(6 + 3 \times 4\) Show answer\(6 + 3 \times 4 = 6 + 12 = 18\) (multiply first)
  2. \((6 + 3) \times 4\) Show answer\((6 + 3) \times 4 = 9 \times 4 = 36\) (parentheses first)
  3. \(20 - 12 \div 4\) Show answer\(20 - 12 \div 4 = 20 - 3 = 17\) (divide first)
  4. \(5 + 2^3\) Show answer\(5 + 2^3 = 5 + 8 = 13\) (exponent first)
  5. \(16 \div 4 \times 2\) Show answer\(16 \div 4 \times 2 = 4 \times 2 = 8\) (left to right)
  6. \(3 + 4 \times 2 - 1\) Show answer\(3 + 4 \times 2 - 1 = 3 + 8 - 1 = 11 - 1 = 10\) (multiply, then left to right)
  7. Evaluate \(4x - 3\) when \(x = 2\) Show answer\(4(2) - 3 = 8 - 3 = 5\)
  8. Evaluate \(x^2 + 3x\) when \(x = 5\) Show answer\(5^2 + 3(5) = 25 + 15 = 40\)

What's Next?

A few patterns worth remembering before moving on. Multiplication and division are equal priority — work them left to right, not all multiplication first. Same for addition and subtraction. And watch the difference between \(2 \times 3^2\) and \((2 \times 3)^2\): the first is \(2 \times 9 = 18\), the second is \(6^2 = 36\). Exponents bind tighter than multiplication unless parentheses say otherwise.

The order of operations underlies every algebra problem you'll meet from here on out. Every time you simplify an expression or solve an equation, PEMDAS is doing the work in the background. Next up: properties of numbers — the rules that describe what you're allowed to rearrange and regroup as you simplify.