Uni-Sine
MathematicsNumber

PEMDAS and the order of operations

PEMDAS is the memory aid for the order of operations, the rules that say which part of a math problem to do first. It stands for Parentheses, Exponents, Multiplication and Division, Addition and Subtraction. Multiplication and division share one step and are done from left to right, and so are addition and subtraction.

What does PEMDAS stand for?

Each letter is one kind of operation, in the order you do them. Many students remember it with the sentence "Please Excuse My Dear Aunt Sally".

LetterStands forMeansExample
PParenthesesDo anything inside grouping symbols first: ( ), [ ], { } and fraction bars(2 + 3) × 4 = 5 × 4
EExponentsPowers and roots3² = 9, √16 = 4
M DMultiplication and DivisionWhichever comes first, working left to right12 ÷ 3 × 2 = 4 × 2
A SAddition and SubtractionWhichever comes first, working left to right10 − 4 + 3 = 6 + 3

Without one agreed order, 7 + 3 × 4 could be 40 or 19 depending on who worked it out. The order of operations makes it 19 for everyone: multiply first, then add. Under the Common Core standards used in many US states, grade 5 covers expressions with parentheses, brackets and braces, and grade 6 adds whole-number exponents.

The order of operations rules, step by step

  1. Parentheses and other grouping symbols. Work out what is inside them first. If they are nested, start with the innermost set.
  2. Exponents. Work out powers and roots.
  3. Multiplication and division, left to right. They have equal rank. Do whichever comes first as you read across.
  4. Addition and subtraction, left to right. They also have equal rank, so again work across from the left.

Why left to right matters

Look at 10 − 4 + 3. Working left to right gives 6 + 3 = 9. If you wrongly add first, you get 10 − 7 = 3. In the same way, 12 ÷ 3 × 2 is 4 × 2 = 8, not 12 ÷ 6 = 2. Thinking of subtraction as adding a negative helps: 10 − 4 + 3 is 10 + (−4) + 3, which is 9 in any order.

PEMDAS examples

These start easy and get harder. Cover the working and try each one first.

Example 1: multiplication before addition

7 + 3 \times 4 = 7 + 12 = 19

Multiplication comes before addition, so the answer is 19. Add parentheses and the answer changes: (7 + 3) × 4 = 10 × 4 = 40.

Example 2: division and multiplication, left to right

20 - 12 \div 4 \times 2

No parentheses or exponents. Division comes first reading left to right, then multiplication, then subtraction:

20 - 3 \times 2 = 20 - 6 = 14

The answer is 14.

Example 3: order of operations with exponents

5 + 2 \times 3^2 = 5 + 2 \times 9 = 5 + 18 = 23

The exponent goes first, so 3² = 9 before you multiply. The answer is 23. A common wrong answer is 5 + 6² = 41, which squares the 2 × 3.

Example 4: parentheses, exponents and all four operations

18 \div (5 - 2) + 4^2 \times 2
  1. Parentheses: 5 − 2 = 3, giving 18 ÷ 3 + 4² × 2.
  2. Exponents: 4² = 16, giving 18 ÷ 3 + 16 × 2.
  3. Multiplication and division, left to right: 18 ÷ 3 = 6 and 16 × 2 = 32, giving 6 + 32.
  4. Addition: 6 + 32 = 38.

Example 5: nested grouping symbols

3[12 - (4 + 2)^2 \div 9]

Start with the innermost parentheses, then work outward through the brackets:

3[12 - 6^2 \div 9] = 3[12 - 36 \div 9] = 3[12 - 4] = 3 \times 8 = 24

The answer is 24. A number right next to a bracket, like the 3 here, means multiply.

Example 6: a fraction bar is a grouping symbol

\frac{8 + 4 \times 3}{2^2 + 1}

Treat the top and the bottom as if each were in parentheses. Top: 8 + 12 = 20. Bottom: 4 + 1 = 5. Then divide: 20 ÷ 5 = 4. If you type this into a calculator, put parentheses around the top and the bottom: (8 + 4 × 3) ÷ (2² + 1).

Negative numbers and exponents

An exponent applies only to what it is touching. In −3², the exponent belongs to the 3, so you square first and then apply the minus sign: −3² = −9. To square the negative number, it needs parentheses: (−3)² = 9.

y = -{ x}^{2}
-4-3-2-11234-15-10-5(−2, −4)(0, 0)(2, −4)
Drag to pan, scroll to zoom. x from -4 to 4, y from -19.2 to 3.2.

Here x is the input and y is the output. Graphing software follows the order of operations too, so y = −x² means square x, then make it negative. Every output is zero or below, and the curve opens downward. At x = 2 the output is −4, not 4. If the minus sign were applied first, as in y = (−x)², every output would be positive and the curve would open upward.

Order of operations with variables

The same rules apply when you substitute numbers into an expression. Evaluate 2x² − 3x + 1 when x = 4:

2(4)^2 - 3(4) + 1 = 2(16) - 12 + 1 = 32 - 12 + 1 = 21

Square the 4 before multiplying by 2, then work the subtraction and addition from left to right. Try one in the Algebra course: substitute the value and press Mark.

Evaluate a randomised expression for a given x.

Press Mark to have your answer marked in the Algebra course.

PEMDAS vs BODMAS, BIDMAS, BEDMAS and GEMDAS

Different countries use different memory aids, but they all describe the same order of operations.

NameWhere it is usedLetters
PEMDASUnited StatesParentheses, Exponents, Multiplication and Division, Addition and Subtraction
BODMASUK, India, Australia and othersBrackets, Orders, Division and Multiplication, Addition and Subtraction
BIDMASUKBrackets, Indices, Division and Multiplication, Addition and Subtraction
BEDMASCanadaBrackets, Exponents, Division and Multiplication, Addition and Subtraction
GEMDASSome US classroomsGrouping symbols, Exponents, Multiplication and Division, Addition and Subtraction

BODMAS puts D before M, and PEMDAS puts M before D, but that changes nothing, because division and multiplication are one step done left to right. GEMDAS says "grouping symbols" to remind you that brackets, braces and fraction bars count, not just parentheses.

What is the answer to 8 ÷ 2(2 + 2)?

This one goes viral every few years. Start with the parentheses: 2 + 2 = 4, giving 8 ÷ 2(4).

  • Strict left to right: 8 ÷ 2 = 4, then 4 × 4 = 16. This is what PEMDAS gives when you follow it literally.
  • Multiplication by juxtaposition first: some people, textbooks and calculators treat 2(4) as a single number because the 2 is written right against the parentheses. Then it is 8 ÷ 8 = 1.

Neither camp is foolish: the expression is ambiguous, and mathematicians avoid writing it. In a real problem you would write (8 ÷ 2)(2 + 2) = 16 or 8 ÷ [2(2 + 2)] = 1, or use a fraction bar, so that nobody has to guess. On a school test, follow PEMDAS strictly and the answer is 16.

Check your understanding with one more.

practice
Pick an answer, then check it.
What is 24 ÷ 4 × 3 − 2²?

Common mistakes

  • Doing all multiplication before any division. They have equal rank. Work left to right: 6 ÷ 2 × 3 = 3 × 3 = 9, not 1.
  • Doing all addition before any subtraction. Same rule: 10 − 4 + 3 = 9, not 3.
  • Squaring a product you have not worked out yet. In 2 × 3², only the 3 is squared, so it is 2 × 9 = 18, not 6² = 36.
  • Losing the sign on a negative. −3² = −9, but (−3)² = 9.
  • Ignoring the fraction bar. Work out the whole top and the whole bottom before dividing.
  • Trusting a basic calculator. A simple four-function calculator often works each step as you type it, so 7 + 3 × 4 can show 40. Scientific and graphing calculators follow the order of operations.
  • Stacked exponents. A tower like 2 to the 3 to the 2 is worked from the top down: 3² = 9 first, then 2⁹ = 512.

Practice problems

Work these out, then check your answers below.

  1. 9 + 6 ÷ 3
  2. (9 + 6) ÷ 3
  3. 4 × 5 − 3²
  4. 40 ÷ 5 × 2 + 1
  5. 2 + 3(7 − 2)²
  6. [15 − (2 + 1) × 4] × 6

Answers: 1) 11, 2) 5, 3) 11, 4) 17, 5) 77, 6) 18.

For more mixed practice, the daily Pre-Algebra & Algebra 1 paper is a short timed practice test of 8 questions, with a new one every day. You can also type any expression into the Equation Notepad to check your answer.

Common questions

What does PEMDAS stand for?
Parentheses, Exponents, Multiplication and Division, Addition and Subtraction. The sentence "Please Excuse My Dear Aunt Sally" helps you remember it.
Do you multiply or divide first in PEMDAS?
Whichever comes first from left to right. Multiplication and division have equal rank, so 12 ÷ 3 × 2 = 4 × 2 = 8.
Do you add or subtract first?
Whichever comes first from left to right. Addition and subtraction have equal rank, so 10 − 4 + 3 = 9.
Is PEMDAS the same as BODMAS?
Yes. They use different words (parentheses or brackets, exponents or orders), but they describe the same order of operations.
Where do square roots go in the order of operations?
With exponents, after parentheses. Anything under the root sign is grouped, so work it out first: √(9 + 16) = √25 = 5.
Why do we need the order of operations?
So that everyone gets the same answer from the same expression. Without it, 7 + 3 × 4 could mean 40 or 19.
What is 6 ÷ 2(1 + 2)?
Following PEMDAS strictly from left to right: 6 ÷ 2 = 3, then 3 × 3 = 9. Some people treat 2(1 + 2) as one term and get 1, which is why mathematicians avoid writing it this way.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Equation Notepad

    Write and evaluate equations with LaTeX rendering

    Open the tool
  • Learn it

    Algebra

    Master equations, inequalities and the language of abstract mathematics

    Start the course
  • Test it

    Pre-Algebra & Algebra 1

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · NumberIntegers: definition, examples and rules for operationsIntegers are whole numbers and their negatives. See examples, integers on a number line, and the rules for adding, subtracting, multiplying and dividing.