# What is the answer with PEMDAS?

Evaluates an arithmetic expression by the order of operations (PEMDAS): parentheses, exponents, multiplication and division, then addition and subtraction, one exact step at a time.

- Page: https://www.acalculator.org/math/order-of-operations-calculator
- JSON spec: https://www.acalculator.org/math/order-of-operations-calculator.json
- Version: 290410ffaa5d

## Default answer

Example with the default inputs (Expression 3 + 6 × (5 + 4) ÷ 3 − 7): 3 + 6 × (5 + 4) ÷ 3 − 7 = 14.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| e | Expression | An arithmetic expression with numbers, + − × ÷ ^ and parentheses, such as 3 + 4 × (2 − 1)^2. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| result | Answer | The exact value: a whole number, a decimal that ends, or a fraction in lowest terms. |
| decimal | As a decimal | The decimal value of an answer that is a fraction. |
| read | Read as | The expression as the calculator reads it, with every multiplication sign written. |
| steps | Steps | One operation per step, in PEMDAS order, with the expression after each step. |
| note | Note | Shown when a multiplication without a sign follows a division, which people read in two ways. |

## Method

Parentheses first (the deepest, then the leftmost), then exponents (from the right), then multiplication and division from left to right, then addition and subtraction from left to right; one operation per step, in exact fractions.

## Assumptions

- Numbers are read exactly as typed; the answer is exact (a whole number, a decimal that ends, or a fraction).
- −3^2 means −(3^2) = −9; write (−3)^2 for 9. 2^3^2 means 2^(3^2).
- A multiplication written without a sign, as in 2(3 + 1), is an ordinary × and is done left to right with ÷: 8 ÷ 2(2 + 2) = 16.
- Exponents must be whole numbers, so every answer is exact. 0^0 and division by 0 have no answer.

## Worked examples

1. e = 3 + 6 × (5 + 4) ÷ 3 − 7 gives result = 14, steps = Add inside the parentheses: 5 + 4 = 9, so 3 + 6 × 9 ÷ 3 − 7; Multiply: 6 × 9 = 54, so 3 + 54 ÷ 3 − 7; Divide: 54 ÷ 3 = 18, so 3 + 18 − 7; Add: 3 + 18 = 21, so 21 − 7; Subtract: 21 − 7 = 14. Source: Order of operations as in OpenStax Prealgebra 2e, section 2.1: https://openstax.org/books/prealgebra-2e/pages/2-1-use-the-language-of-algebra.
2. e = 3 + 4 × 2 − 6 ÷ 3 gives result = 9.
3. e = 8 ÷ 2(2 + 2) gives result = 16, read = 8 ÷ 2 × (2 + 2), note = A multiplication written without a sign, as in 2(3 + 1), counts as an ordinary × here and is done left to right with ÷. To multiply first, put the product in parentheses..
4. e = -3^2 + (1 - 4)^2 gives result = 0, steps = Subtract inside the parentheses: 1 − 4 = -3, so -3^2 + (-3)^2; Exponent: 3^2 = 9, so -9 + (-3)^2; Exponent: (-3)^2 = 9, so -9 + 9; Add: -9 + 9 = 0.
5. e = 2^3^2 gives result = 512.
6. e = 1 ÷ 3 + 1 ÷ 4 gives result = 7/12, decimal = 0.583333, steps = Divide: 1 ÷ 3 = 1/3, so (1/3) + 1 ÷ 4; Divide: 1 ÷ 4 = 0.25, so (1/3) + 0.25; Add: (1/3) + 0.25 = 7/12.
7. e = (2 + 1) ÷ 9 gives result = 1/3, decimal = 0.333333.
8. e = 0.1 + 0.2 × 3 gives result = 0.7.

## FAQ

### What does PEMDAS stand for?

Parentheses, Exponents, Multiplication and Division, Addition and Subtraction. Work inside parentheses first, then exponents, then multiplication and division from left to right, then addition and subtraction from left to right. Some countries say BODMAS or BIDMAS (Brackets, Orders or Indices, Division and Multiplication, Addition and Subtraction); the rules are the same.

### Does multiplication come before division?

No. Multiplication and division have the same rank, so they are done from left to right, whichever comes first. 12 ÷ 4 × 3 = 3 × 3 = 9, not 12 ÷ 12 = 1. The same is true for addition and subtraction: 10 − 4 + 2 = 8.

### What is 8 ÷ 2(2 + 2)?

By the standard rules it is 16: the parentheses give 8 ÷ 2 × 4, and then left to right, 8 ÷ 2 = 4 and 4 × 4 = 16. Some people give a multiplication written without a sign priority and get 1. The calculator follows the standard rules and shows a note when your expression has this form; add parentheses, 8 ÷ (2(2 + 2)), if you mean 1.

### Is −3² equal to 9 or −9?

It is −9. The exponent applies to 3 only, and the minus sign is taken after: −3² = −(3²) = −9. To square −3, write (−3)² = 9.

### How is 2^3^2 worked out?

Stacked exponents are worked from the top down (from the right): 2^3^2 = 2^(3^2) = 2^9 = 512, not (2^3)^2 = 64.

### Why is the answer a fraction?

The calculator keeps every step exact. When a division does not come out as a decimal that ends, such as 1 ÷ 3, it keeps the fraction 1/3 instead of rounding, and shows the decimal value next to the answer.

### Can I use decimals, negative numbers and brackets?

Yes. Type decimals such as 0.25, negative numbers such as −4 or 5 − (−3), and group with ( ), [ ] or { }. Use * or × to multiply, / or ÷ to divide, and ^ (or **) for exponents.

## Sources

- OpenStax, Prealgebra 2e, section 2.1 Use the Language of Algebra (order of operations): https://openstax.org/books/prealgebra-2e/pages/2-1-use-the-language-of-algebra
- Wikipedia, Order of operations (unary minus, stacked exponents, and mixed division and multiplication): https://en.wikipedia.org/wiki/Order_of_operations
