Order of Operations

Arithmetic

The order of operations is the standard set of rules that determines the sequence in which calculations are performed in a mathematical expression.

Formula

\text{PEMDAS: Parentheses, Exponents, Multiply/Divide (left to right), Add/Subtract (left to right)}

Definition

The order of operations is a set of rules that tells you which math operation to do first when an expression has more than one operation. A common memory aid is PEMDAS: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction.

Example

$2 + 3 \times 4 = 2 + 12 = 14$ (multiply first). NOT $(2+3) \times 4 = 20$ unless parentheses are written. Always do multiplication before addition.

Key Insight

"Please Excuse My Dear Aunt Sally" helps you remember PEMDAS. The rules exist so that everyone gets the same answer from the same expression.

Definition

The order of operations: (1) Parentheses and grouping symbols, (2) Exponents and roots, (3) Multiplication and Division from left to right (same priority), (4) Addition and Subtraction from left to right (same priority). Operations at the same priority level are resolved left to right.

Example

$3 + 6^2 / (2 \times 3) - 1 = 3 + 36 / 6 - 1 = 3 + 6 - 1 = 8$. Steps: (1) parentheses: $2\times3=6$, (2) exponent: $6^2=36$, (3) division: $36/6=6$, (4) left-to-right addition/subtraction.

Key Insight

Multiplication and division are at the same level: $12 / 4 \times 3 = 3 \times 3 = 9$ (left to right), NOT $12 / 12 = 1$. This left-to-right rule resolves the ambiguity.

Definition

Order of operations is a syntactic convention for parsing mathematical expressions unambiguously. In formal grammars, it is encoded in operator precedence and associativity rules. Formal languages for mathematics (e.g., Reverse Polish Notation) eliminate the need for precedence rules by making the parse tree explicit.

Example

The expression $2^{3^2}$ is ambiguous without associativity: right-associative (standard) gives $2^{(3^2)} = 2^9 = 512$; left-associative gives $(2^3)^2 = 8^2 = 64$. Mathematics and most programming languages use right-associativity for exponentiation.

Key Insight

Operator precedence is a design decision, not a mathematical law. Different programming languages make different choices (e.g., APL evaluates right to left with no precedence). The PEMDAS convention is standard in mathematics education but is ultimately a convention for disambiguation.