Order of operations with variables: what actually comes first?

Parentheses and exponents set the structure; multiplication, division, addition, and subtraction then move left to right within their own level.

LaTeX article Updated July 13, 2026

3+2(x4)23+2(x-4)^2

Read the structure before calculating

An expression is a set of nested instructions. Grouping symbols tell you which part acts as one unit, while an exponent belongs only to its base unless parentheses enlarge that base.

A quick pause to mark the groups prevents the most common error: applying an operation to more of the expression than the notation allows.

32=(32)=9(3)2=9-3^2=-(3^2)=-9\qquad(-3)^2=9

Multiplication and division share a level

The familiar acronym can make it sound as if multiplication must happen before division. They have equal priority, so evaluate whichever appears first when reading left to right.

Addition and subtraction work the same way. A subtraction can be rewritten as addition of a negative, which makes the left-to-right rule easier to see.

24÷62=42=824\div6\cdot2=4\cdot2=8

Variables do not change the rule

A variable is simply a number whose value is not yet fixed. Substitute with parentheses, then use the same structure you would use for a numerical expression.

Keeping substituted negatives in parentheses is especially important because the exponent and the negative sign may not belong to the same base.

x=2:5x2=5(2)2=1x=-2:\quad 5-x^2=5-(-2)^2=1

Worked example

Common mistakes

  • Treating the acronym as a strict left-to-right list.
  • Letting an exponent apply beyond its actual base.
  • Substituting a negative value without parentheses.

Keep these ideas

  • Grouping defines the expression's shape.
  • Equal-priority operations move left to right.
  • Substitute first, then simplify.
Vocab
Variable
Math glossaryVariable
xx

A symbol whose value may vary or be unknown.

Learn more
Expression
Math glossaryExpression
2x+32x+3

A mathematical phrase without a top-level equality or inequality claim.

Learn more
Equation
Math glossaryEquation
2x+3=112x+3=11

A statement that two expressions are equal.

Learn more
Solution
Math glossarySolution
x=4x=4

A permitted value that makes a mathematical statement true.

Learn more
Inverse operation
Math glossaryInverse operation
x+33=xx+3-3=x

An operation that undoes another operation.

Learn more
Math glossary