=Calculator Dad
HomeLearnOrder of operations

Order of operations: PEMDAS, BODMAS and why 8 ÷ 2(2 + 2) starts arguments

The order of operations explained, with worked examples, the history of PEMDAS and BODMAS, and why Casio, TI, Excel and Python do not all give the same answer.

Every few months an expression like 8 ÷ 2(2 + 2) goes viral and splits the internet between two answers, 1 and 16. Both camps are following a rule. They are not following the same one, and neither is wrong in the way the other side thinks.

The rule everyone agrees on

  1. Brackets first, innermost first.
  2. Exponents (powers and roots).
  3. Multiplication and division, together, from left to right.
  4. Addition and subtraction, together, from left to right.

So 1 + 2 × 3 is 7, not 9. And 10 − 4 + 1 is 7, not 5, because subtraction and addition share a level and you work left to right.

A slightly longer example, step by step:

3 + 6 × (5 + 4) ÷ 32 − 7start
3 + 6 × 9 ÷ 32 − 7brackets
3 + 6 × 9 ÷ 9 − 7exponent
3 + 54 ÷ 9 − 7multiply (leftmost first)
3 + 6 − 7divide
2add and subtract, left to right

PEMDAS, BODMAS and the rest

WhereMnemonicStands for
United StatesPEMDASParentheses, Exponents, Multiplication and Division, Addition and Subtraction. Taught as “Please Excuse My Dear Aunt Sally”.
United KingdomBIDMAS or BODMASBrackets, Indices (or Order, or “Of”), Division and Multiplication, Addition and Subtraction
Canada, New ZealandBEDMASBrackets, Exponents, Division and Multiplication, Addition and Subtraction
GermanyPunkt vor Strich“Dots before lines”: the dot-shaped signs (· and :) come before the line-shaped ones (+ and −)

They all hide the same trap. PEMDAS puts M before D and BODMAS puts D before M, which suggests an order that does not exist. Multiplication and division share a level; so do addition and subtraction. A student who takes PEMDAS literally will get 8 ÷ 4 × 2 wrong (it is 4, not 1).

A younger rule than you would think

Doing multiplication before addition settled into algebra in the 1600s as modern notation took shape. The rest took a surprisingly long time.

  • 1892An American textbook simply advises readers to avoid writing expressions that mix ÷ and ×.
  • 1907Another tells students to do all the multiplications first, then the divisions.
  • 1912A third gives the rule used today: multiplication and division together, left to right.
  • 1917The mathematician N. J. Lennes complains in the American Mathematical Monthly that textbook rules do not match how mathematicians actually write, especially with implied multiplication like 2a.
  • 1928Florian Cajori, the great historian of mathematical notation, writes that when a term contains both ÷ and ×, “there is at present no agreement as to which sign shall be used first.”
  • 1935“My Dear Aunt Sally”, for Multiply, Divide, Add, Subtract, appears in an Indiana newspaper.
  • 1985The full “Please Excuse My Dear Aunt Sally” is in print by now, in Newsday.

So the neat four-step rule is roughly a century old, and the mnemonic most Americans learned is younger than the pocket calculator.

So what is 8 ÷ 2(2 + 2)?

Brackets first gives 8 ÷ 2(4). Then the road forks.

  • Strict left to right: 8 ÷ 2 is 4, and 4 × 4 is 16. This is what the school rule gives.
  • Implied multiplication first: 2(4) is read as a single term, 8, so 8 ÷ 8 is 1.

The second reading is not a mistake. It is how many scientists and mathematicians read their own work. The American Mathematical Society's guidelines for authors, archived in 1998, said that multiplication written by putting things side by side is done before division. The American Physical Society's style guide for the Physical Review journals ranks multiplication above division and tells authors to add brackets in ambiguous cases: “do not write a/b/c.” To a physicist, 1/2x means 1/(2x).

When 8 ÷ 2(2 + 2) went viral in July 2019, the mathematician Steven Strogatz wrote about it in The New York Times. Under the school rule the answer is 16, he said, but mathematicians often give implied multiplication priority. His conclusion: “If you want a clearer answer, ask a clearer question.” Mike Breen of the American Mathematical Society put it more simply: “The way it's written, it's ambiguous.”

International standards agree. ISO 80000-1 says a slash should not be followed by a multiplication or division sign on the same line unless brackets are added. In other words, 8 ÷ 2(2 + 2) is not a trick question with a right answer. It is a badly written expression.

What your calculator says

We checked the manufacturers' own documentation. Type 8 ÷ 2(2 + 2) exactly as written, and:

DeviceAnswerWhy
Casio fx-991EX and similar Casio scientifics1Casio's manual ranks multiplication without a sign above ordinary × and ÷.
TI-80, TI-81, TI-82, TI-851Older Texas Instruments models give implied multiplication priority.
TI-83, TI-84, TI-89, TI-Nspire16From the TI-83 on, TI gives implied and written multiplication the same priority.
Basic four-function calculatorHas no brackets. Each step is done as you press, so 1 + 2 × 3 = gives 9.
Excel, Google Sheets, Python16They reject implied multiplication, so you must type 8/2*(2+2), which is plain left to right.

The same Casio and the same TI can disagree on a problem from a school worksheet, which is as good an argument for brackets as any.

Two more traps in spreadsheets and code

You typeWritten mathsExcelPython
-3^2 (Python: -3**2)−99−9
4^3^2 (Python: 4**3**2)262,1444,096262,144

A leading minus sign. In ordinary maths −32 means −(32), which is −9. Excel applies the minus sign before the power, so =-3^2 returns 9. Microsoft documents this: negation sits above exponents in Excel's order. If you mean −9, type =-(3^2). Python follows written maths.

Stacked powers. Written as superscripts, powers are worked from the top down: 432 is 49, which is 262,144. Excel works left to right instead, giving (43)2 = 4,096. Python works top down like written maths.

If you build financial models, these two are worth remembering. They do not throw an error; they just give a different number.

How to write it so nobody argues

  • Use brackets whenever division is followed by anything: write (8 ÷ 2)(2 + 2) if you mean 16 and 8 ÷ (2(2 + 2)) if you mean 1.
  • Prefer a fraction bar to a slash. A number over a line has no ambiguity.
  • In spreadsheets, bracket every negative number you raise to a power.
  • If you have to stop and think about which way an expression goes, so will the person reading it, and so will their calculator.

Quick answers

What is the correct order of operations?

Brackets, then exponents, then multiplication and division from left to right, then addition and subtraction from left to right.

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

16 under the school rule, working left to right. 1 if implied multiplication is done first, which many scientists and some calculators do. The expression is ambiguous; add brackets to say which you mean.

Is PEMDAS the same as BODMAS?

Yes. Both describe the same order. The only difference is the letters: multiplication and division share a level in both, as do addition and subtraction.

Why does my basic calculator say 1 + 2 × 3 = 9?

Basic four-function calculators work out each step as you press the keys, so they add 1 + 2 before multiplying by 3. Scientific calculators apply the order of operations and give 7.

Why does Excel say -3^2 is 9?

Excel applies the minus sign before the power. Type =-(3^2) to get -9.

Sources

  1. Wikipedia, “Order of operations”
  2. Jeff Miller, “Earliest Uses of Symbols of Operation” (1892, 1907 and 1912 textbooks; Cajori quotation)
  3. Florian Cajori, A History of Mathematical Notations (Open Court, 1928–29).
  4. Oliver Knill, Harvard, “Ambiguous PEMDAS” (Lennes 1917; AMS guidelines; ISO 80000-1)
  5. Barry Popik, “Please Excuse My Dear Aunt Sally”
  6. American Physical Society, Physical Review Style and Notation Guide
  7. Cornell University, on Steven Strogatz, “The Math Equation That Tried to Stump the Internet”, The New York Times, 2 August 2019
  8. Casio, fx-570EX/fx-991EX user's guide, calculation priority sequence
  9. Texas Instruments, knowledge base 11773: implied multiplication
  10. Microsoft, “Calculation operators and precedence in Excel”; Python language reference, expressions
  11. New Zealand Ministry of Education, “The order of operations”