Order of Operations: Getting the Same Answer Every Time
Why we need an agreed order
Look at 2 + 3 × 4. If you work from left to right, you get 5 × 4 = 20. If you multiply first, you get 2 + 12 = 14. Both look reasonable, but a written expression must mean one thing only, otherwise two people reading the same recipe, formula or homework question would get different answers. So mathematicians agreed on a fixed order, and under that order the answer is 14.
The rule is not a law of nature. It is a convention, like driving on one side of the road. What matters is that everyone uses the same one, and that you know when a calculator is following it and when it is not.
The standard order, step by step
- Brackets (parentheses): work out anything inside brackets first, starting with the innermost pair.
- Powers and roots (exponents, orders, indices): 3^2, √16 and so on.
- Multiplication and division, which have equal rank, worked from left to right.
- Addition and subtraction, which also have equal rank, worked from left to right.
Different countries teach this with different memory words, but they all describe the same order.
| Memory word | Stands for | Often taught in |
|---|---|---|
| PEMDAS | Parentheses, Exponents, Multiplication/Division, Addition/Subtraction | United States |
| BODMAS | Brackets, Orders, Division/Multiplication, Addition/Subtraction | United Kingdom, India, Australia and others |
| BIDMAS | Brackets, Indices, Division/Multiplication, Addition/Subtraction | United Kingdom |
| BEDMAS | Brackets, Exponents, Division/Multiplication, Addition/Subtraction | Canada, New Zealand |
Notice that PEMDAS puts M before D while BODMAS puts D before M. That difference is only in the spelling. Neither word means "always multiply before you divide". Multiplication and division share one step, and so do addition and subtraction.
The left-to-right rule that people forget
Because multiplication and division have equal rank, you take them in the order they appear, reading from left to right. The same goes for addition and subtraction.
- 24 ÷ 4 × 2 = 6 × 2 = 12. Doing the multiplication first would give 24 ÷ 8 = 3, which is wrong.
- 10 − 4 + 3 = 6 + 3 = 9. Doing the addition first would give 10 − 7 = 3, which is wrong.
- 3 − 3 × 6 + 2: multiply first, 3 × 6 = 18, then go left to right: 3 − 18 + 2 = −13.
A neat way to avoid the subtraction trap is to think of subtraction as adding a negative number. 10 − 4 + 3 is 10 + (−4) + 3, and you can add those three numbers in any order you like: the answer is still 9. In the same way, division is multiplying by a reciprocal: 24 ÷ 4 × 2 is 24 × ¼ × 2, which is 12 in any order.
Brackets inside brackets
When brackets are nested, start with the innermost pair and work outwards. Some books use square brackets for the outer layer to make this easier to read.
Example: 2 × [3 + (4 − 1) × 2]
- Innermost bracket: 4 − 1 = 3.
- Inside the square bracket: 3 + 3 × 2 = 3 + 6 = 9 (multiplication before addition).
- Outside: 2 × 9 = 18.
A fraction bar acts as an invisible bracket around the top and around the bottom. The fraction with 12 + 8 on top and 6 − 2 underneath is 20 ÷ 4 = 5. If you type it on one line as 12 + 8 ÷ 6 − 2, the calculator correctly divides first and gives about 11.33, a completely different number. On one line you must write (12 + 8) ÷ (6 − 2).
Powers come before multiplication: 2 × 3^2 = 2 × 9 = 18, while (2 × 3)^2 = 6^2 = 36. Signs in front of powers are covered in the scientific calculator guide.
The viral puzzle: 8 ÷ 2(2 + 2)
Every few years an expression like 8 ÷ 2(2 + 2) or 6 ÷ 2(1 + 2) spreads online, and people split into two camps. One camp answers 16, the other answers 1. Here is where the split comes from.
- Strict left to right: the bracket gives 4, so the expression is 8 ÷ 2 × 4. Division and multiplication have equal rank, so 8 ÷ 2 = 4, then 4 × 4 = 16.
- Implied multiplication first: many people, and many textbooks and scientific calculators, read a number written directly against a bracket, as in 2(2 + 2), as a single block. Then the expression is 8 ÷ (2 × 4) = 8 ÷ 8 = 1.
Both readings exist in real use, which is exactly why the puzzle never dies. In algebra, nearly everyone reads 1/2x as 1 divided by 2x, which is the "block" reading. Yet a strict rule list says nothing special about missing × signs. The honest answer is that the expression is ambiguous, and a careful writer would never publish it.
The calculators on this site use the block reading, like most scientific calculators, so 8 ÷ 2(2 + 2) gives 1 and 1 ÷ 2π gives about 0.159. If you mean 16, type the × sign: 8 ÷ 2 × (2 + 2) = 16. If you mean 1, add brackets: 8 ÷ (2 × (2 + 2)) = 1. Either way, the extra symbols remove all doubt.
Another puzzle that circulates is 9 − 3 ÷ (1/3) + 1. Brackets first give 1/3. Then division: 3 ÷ (1/3) = 9, because dividing by a third is the same as multiplying by 3. Finally, left to right: 9 − 9 + 1 = 1.
Why a simple calculator can give a different answer
Many small pocket calculators and some phone calculators work by immediate execution. Each time you press an operator key, they finish the calculation so far and show a running total. They do not wait to see the whole expression, so they ignore the order of operations.
| Keys pressed | Immediate execution | Formula calculator |
|---|---|---|
| 2 + 3 × 4 = | (2 + 3) × 4 = 20 | 2 + 12 = 14 |
| 10 − 2 × 3 = | 8 × 3 = 24 | 10 − 6 = 4 |
| 70 + 80 + 90 ÷ 3 = | 240 ÷ 3 = 80 | 70 + 80 + 30 = 180 |
Look at the last row carefully. Someone trying to average three scores might type it that way. The immediate-execution calculator happens to give the intended average, 80, while the formula calculator correctly applies the rules and gives 180. The right way to type an average on any formula calculator is (70 + 80 + 90) ÷ 3 = 80. The averages guide explains this calculation in more depth.
You can usually tell which type you have by typing 2 + 3 × 4 =. If it shows 20, it executes immediately. If it shows 14, it follows the order of operations. The basic calculator on this site shows the whole expression as you type and follows the standard order, so 2 + 3 × 4 gives 14.
Chaining calculations safely
Real problems often have several steps. Suppose you buy 3 notebooks at 4.50 each and 2 pens at 2.25 each. The total is 3 × 4.50 + 2 × 2.25 = 13.50 + 4.50 = 18.00.
- On a formula calculator, type it exactly as written: 3 × 4.5 + 2 × 2.25 gives 18.
- On an immediate-execution calculator, the same keys give ((3 × 4.5) + 2) × 2.25 = 34.875, which is badly wrong. Work out each product separately, write it down or store it in memory, and add the results at the end.
- When you continue from a previous answer, check how it will be combined. On this site, pressing an operator after a result carries the result forward, so "= then × 2" doubles the whole previous answer.
When in doubt, add brackets. They never change a correct answer, and they protect you from both kinds of calculator.
Common mistakes
- Multiplying before dividing every time. PEMDAS lists M first, but 24 ÷ 4 × 2 is 12, not 3.
- Adding before subtracting every time. 10 − 4 + 3 is 9, not 3.
- Typing a fraction without brackets. (a + b) ÷ (c + d) needs both pairs of brackets on one line.
- Forgetting that powers come first. 2 × 3^2 is 18, not 36.
- Trusting a running total. A pocket calculator's running total ignores precedence.
- Leaving out the × sign in ambiguous places. Write 8 ÷ 2 × 4 or 8 ÷ (2 × 4), never 8 ÷ 2(4).
FAQ
Is PEMDAS different from BODMAS?
No. They give the same answer to every expression. Both treat multiplication and division as one level and addition and subtraction as another, worked from left to right.
So what is the real answer to 8 ÷ 2(2 + 2)?
It depends on whether implied multiplication is treated as a block. Strict left to right gives 16; the block reading gives 1. Because the expression is ambiguous, the sensible fix is to rewrite it with an explicit × sign or extra brackets.
Do spreadsheets follow the same rules?
Mostly, but some treat a leading minus sign differently from standard maths, so −3^2 may give 9. Use brackets to be sure.
Why do some calculators show the answer only after I press =?
Formula calculators need the whole expression before they can apply the order of operations. The calculator on this site shows a preview as you type, which updates when you add more terms.
Open the calculator: Calculator →
Related guide
- How to Calculate Percentages: Simple Methods
- Discount Guide: Sale Prices and Stacked Deals
- Percent Change: Increase, Decrease and Growth
- How Age Is Calculated: Years, Months and Days
- Days Between Dates: Counting, Adding and Countdowns
- Time Calculation Guide: Hours, Minutes, Differences
- Fractions: Add, Subtract, Multiply and Divide
- Scientific Calculator Guide: Angles, Powers, E Notation
- Rounding Numbers: Decimal Places and Significant Figures
- Averages Explained: Mean, Weighted Average, Median, Mode
- Ratios and Proportions: Recipes, Maps and Fair Splits
- Leap Years, Month Lengths and Finding the Weekday
- Decimal Hours, Minutes and the 12/24-Hour Clock
- Fractions, Decimals and Percents: Converting Between Them
- Logarithms Made Simple: log, ln and Real-World Scales