Order of Operations Explained: PEMDAS, BODMAS, and BEDMAS
Last updated: December 2024 • 9 min read
Have you ever seen a math problem go viral on social media because people couldn't agree on the answer? Usually, the confusion stems from not understanding the order of operations — the fundamental rules that dictate how mathematical expressions should be evaluated. This guide will make you an expert.
What is the Order of Operations?
The order of operations is a set of rules that tells us the sequence in which mathematical operations should be performed. Without these rules, the same expression could yield different results depending on which operation you do first.
Consider: 2 + 3 × 4
- If you calculate left to right: (2 + 3) × 4 = 5 × 4 = 20
- Using order of operations: 2 + (3 × 4) = 2 + 12 = 14
The correct answer is 14, because multiplication comes before addition in the order of operations.
PEMDAS, BODMAS, and BEDMAS
Different countries use different acronyms to remember the order, but they all mean the same thing:
PEMDAS (USA)
- Parentheses
- Exponents
- Multiplication
- Division
- Addition
- Subtraction
BODMAS (UK, India)
- Brackets
- Orders (powers/roots)
- Division
- Multiplication
- Addition
- Subtraction
BEDMAS (Canada)
- Brackets
- Exponents
- Division
- Multiplication
- Addition
- Subtraction
The Complete Order
- Parentheses/Brackets: Solve everything inside parentheses first, starting with the innermost.
- Exponents/Orders: Calculate powers and roots.
- Multiplication and Division: From left to right (equal priority).
- Addition and Subtraction: From left to right (equal priority).
Important: Multiplication and Division have equal priority — perform them left to right. Same for Addition and Subtraction.
Step-by-Step Examples
Example 1: Basic
Solve: 8 + 2 × 5
Step 1: Multiplication first → 2 × 5 = 10
Step 2: Addition → 8 + 10 = 18
Example 2: With Parentheses
Solve: (8 + 2) × 5
Step 1: Parentheses first → 8 + 2 = 10
Step 2: Multiplication → 10 × 5 = 50
Example 3: With Exponents
Solve: 3 + 2² × 4
Step 1: Exponent first → 2² = 4
Step 2: Multiplication → 4 × 4 = 16
Step 3: Addition → 3 + 16 = 19
Example 4: Complex Expression
Solve: 24 ÷ 4 × 2 + 3² - (5 - 2)
Step 1: Parentheses → (5 - 2) = 3
Expression: 24 ÷ 4 × 2 + 3² - 3
Step 2: Exponent → 3² = 9
Expression: 24 ÷ 4 × 2 + 9 - 3
Step 3: Division (left to right) → 24 ÷ 4 = 6
Expression: 6 × 2 + 9 - 3
Step 4: Multiplication → 6 × 2 = 12
Expression: 12 + 9 - 3
Step 5: Addition and subtraction (left to right) → 12 + 9 = 21, then 21 - 3 = 18
Common Mistakes to Avoid
- Treating MD and AS as separate levels: Multiplication doesn't always come before division. They have equal priority — go left to right.
- Forgetting implicit multiplication: In expressions like 2(3+4), multiply after the parentheses.
- Nested parentheses: Always work from innermost to outermost.
- Negative exponents: Calculate the exponent first, then apply the negative sign if outside the parentheses.
The Viral Math Problem Explained
Remember that viral problem: 8 ÷ 2(2+2) = ?
This causes debate because of ambiguous notation. Strictly following PEMDAS:
Step 1: Parentheses → 2 + 2 = 4
Expression: 8 ÷ 2 × 4
Step 2: Left to right → 8 ÷ 2 = 4
Step 3: 4 × 4 = 16
However, some argue that 2(4) should be treated as a single term, giving 8 ÷ 8 = 1. This is why mathematicians prefer clearer notation using fractions or additional parentheses to avoid ambiguity.
Practice with Our Calculator
Our calculator correctly applies the order of operations. Try it yourself!
Use Calculator →Why Calculators Sometimes Give Different Answers
Have you ever typed the same calculation into two different calculators and got different results? This is almost always due to how each calculator handles order of operations — particularly whether it evaluates left-to-right or applies mathematical precedence rules.
The Famous ÷ Viral Maths Problem
Consider: 6 ÷ 2(1 + 2)
This expression went viral because different interpretations yield different answers:
- Answer 9: Modern calculators apply BODMAS strictly: 6 ÷ 2 × 3 = 3 × 3 = 9 (division and multiplication left to right)
- Answer 1: Some interpret 2(1+2) as a single grouped term: 6 ÷ (2×3) = 6 ÷ 6 = 1
Both interpretations are mathematically defensible based on convention. In professional mathematics and scientific computing, the expression would be written unambiguously with explicit parentheses.
Order of Operations in Programming vs Mathematics
Most programming languages follow mathematical BODMAS/PEMDAS rules, but there are important differences to be aware of:
| Operation | Mathematics | Python | JavaScript | Notes |
|---|---|---|---|---|
| 2 ** 3 ** 2 | 512 (right-assoc) | 512 | 512 | Exponentiation is right-associative in all |
| −2 ** 2 | 4 or −4? | Error | −4 | Python requires (−2)**2; JS evaluates as −(2**2) |
| 1/2 as integer | 0.5 | 0.5 (Python 3) | 0.5 | Python 2 returned 0 for integer division |
| Modulo sign | Sign = divisor | Sign = divisor | Sign = dividend | −7 % 3 = 2 in Python, −1 in JavaScript |
Step-by-Step: Worked Examples
Example 1: Mixed Operations
Solve: 3 + 4 × 2 − (8 ÷ 4)²
- Brackets first: (8 ÷ 4) = 2 → expression becomes 3 + 4 × 2 − 2²
- Exponents: 2² = 4 → expression becomes 3 + 4 × 2 − 4
- Multiplication: 4 × 2 = 8 → expression becomes 3 + 8 − 4
- Left to right addition/subtraction: 3 + 8 = 11, then 11 − 4 = 7
Example 2: Nested Brackets
Solve: 2 × (3 + (4 − 1)²)
- Innermost brackets: (4 − 1) = 3 → expression becomes 2 × (3 + 3²)
- Exponent inside brackets: 3² = 9 → expression becomes 2 × (3 + 9)
- Remaining brackets: (3 + 9) = 12 → expression becomes 2 × 12
- Multiplication: 2 × 12 = 24
Frequently Asked Questions
Do calculators follow order of operations?
Scientific calculators and computer programs typically follow order of operations automatically. Simple four-function calculators may not — they often calculate left to right as you enter operations.
Why was this convention created?
The order of operations evolved to create consistency in mathematical notation. It became standardized in the 1800s as mathematics became more formalized.
Does the order apply in programming?
Yes! Programming languages follow similar rules, called "operator precedence." However, specific details may vary slightly between languages.
Alex van den Berg
Financial Educator & Mathematics Writer
Alex has 8+ years of experience in personal finance education and mathematics instruction. He writes practical guides on financial calculations, everyday maths, and how to use digital tools to make smarter money decisions.