Order of operations

From Why start at x, y, z

There are quite a few mnemonics for the order of operations. A common one in the UK is BODMAS:

  • Brackets
  • Orders
  • Division
  • Multiplication
  • Addition
  • Subtraction

Elsewhere, PEMDAS is popular.

But division and multiplication have equal precedence, and so do addition and subtraction. A common convention is that operations with equal precedence are evaluated from left to right.

This leads to all sorts of misunderstandings.

\( 8 \div 2(1+3) = 16 \) or \( 1 \)

Some people think that the presence or omission of a multiplication symbol in the above expression is important: implicit multiplication might bind more tightly than the division symbol.

Several ways of resolving the ambiguity have been suggested, but all the ones I've seen introduce other problems.

Suggested resolutions

Reverse Polish Notation: The expression \((x-2)(x-1)\) would be written instead \(\times \, - \, x \, 2 \, - \, x \, 1\), or something like that. There's no need for brackets or operator precedence, but it is hard to see at a glance what each operator applies to.

Add brackets: around everything??

Make up a new rule: At MathsJam Gathering 2020, Christian Lawson-Perfect suggested adding a rule "M before D except after 3". So \(6 \div 2 \times 3 = 1\), but \(3 \div 2 \times 4 = 6\).

References

Christian Lawson-Perfect has made a tool called SAMDOB which lets you make up your own mnemonic and see how an expression is evaluated.

Colin Beveridge dubbed viral "puzzles" related to misunderstanding the order of operations fake maths.

Adam Townsend and Matthew Scroggs proposed using MEDUSA instead of BODMAS to reduce ambiguities caused by division being done before multiplication or subtraction being doing before addition.