Why Your Calculator Gives a Different Answer: −3², 6÷2(1+2), and Other Order-of-Operations Traps
Two calculators, two answers, same keystrokes. A clear explanation of PEMDAS, implied multiplication, unary minus, and how to type expressions so every calculator agrees.
Type 6÷2(1+2) into two different calculators and you may get 9 on one and 1 on the other. Neither is "broken". They implement different — and both defensible — conventions. If you write firmware, spreadsheets, or exam answers, you need to know exactly where the ambiguity lives.
The baseline: PEMDAS / BODMAS
- Parentheses (Brackets)
- Exponents (Orders)
- Multiplication and Division — equal precedence, left to right
- Addition and Subtraction — equal precedence, left to right
The most common misreading is treating M before D. Under the standard rule, 8 ÷ 4 × 2 = 4 (left to right), not 1.
Trap 1: −3² is −9, not 9
In standard mathematical notation and in almost every programming language, exponentiation binds tighter than unary minus: −3² = −(3²) = −9. To square a negative number you must write (−3)² = 9.
Excel is the famous exception: =-3^2 returns 9 because Excel gives unary minus higher precedence. If you port a formula from Excel to Python, MATLAB, or a scientific calculator, this silently flips signs.
| Input | Math / Python / MATLAB / most calculators | Excel |
|---|---|---|
| −3^2 | −9 | 9 |
| (−3)^2 | 9 | 9 |
| 0 − 3^2 | −9 | −9 |
Trap 2: implied multiplication — 6÷2(1+2)
There are two conventions for a number placed next to a parenthesis:
- Strict PEMDAS:
2(1+2)is just2 × (1+2), same precedence as ÷, evaluated left to right →6 ÷ 2 × 3 = 9. - Implied multiplication binds tighter (PEJMDAS):
2(1+2)is a single term, so6 ÷ [2(3)] = 1. This is how physicists read1/2π— nobody means (1/2)·π.
Casio calculators historically returned 1; many TI models return 9; some Casio firmware switched to 9 after complaints, then some switched back. Wolfram Alpha gives 9. There is no authority to appeal to — the expression is badly written. Fix it with parentheses: (6÷2)(1+2) or 6÷(2(1+2)).
Trap 3: stacked exponents are right-associative
2^3^2 means 2^(3^2) = 2^9 = 512, not (2^3)^2 = 64. Python, MATLAB and standard notation agree. Some calculators and Excel evaluate left to right and return 64. Again: parentheses.
Trap 4: the fraction bar is a parenthesis
On paper, a horizontal fraction bar groups everything above and below it. When you flatten it to one line, you must add the parentheses the bar implied:
a + b
─────── → (a + b) / (c × d) NOT a + b / c × d
c · d
The same applies to square roots and exponents: √(x²+y²) becomes sqrt(x^2 + y^2), and e^(−t/τ) needs exp(-t/tau), not exp(-t)/tau.
Trap 5: percent keys are not arithmetic
On many basic calculators, 200 + 10 % gives 220 (adds 10% of 200), while 200 × 10 % gives 20. Scientific calculators usually treat % as ÷100 instead. When writing a formula, write × 1.10 or × 0.10 and leave the % key alone.
How to write expressions everyone agrees on
- Parenthesize every negative base before an exponent:
(-x)^2. - Parenthesize every numerator and denominator that has more than one term.
- Never rely on implied multiplication next to a division sign; write
*explicitly. - Parenthesize stacked exponents.
- Replace
%with a decimal factor.
Extra parentheses cost nothing. A wrong sign in a control-loop gain, or a factor of 2π in a resonance frequency, costs a lot more.
Quick self-test
| Expression (standard rules) | Answer |
|---|---|
| 12 − 4 ÷ 2 × 3 | 6 |
| −2² + 5 | 1 |
| 3 × 2^2^1 | 12 |
| (8 − 2)/(1 + 2) | 2 |
| 10 − 3 − 2 | 5 (left to right, not 9) |
The World Calculator uses a standard parser with explicit precedence — type the examples and watch the history panel.
Open the free calculator →