Create your own
Lesson illustration

Evaluating Whole-Number Expressions with Order of Operations

Hello, and welcome to the first lesson. This opening module builds the arithmetic habits that will soon carry directly into Python: first you decide what a calculation means, then the computer can calculate the same expression reliably.

Today you will learn to evaluate expressions containing addition, subtraction, multiplication, division, and parentheses. We will use whole-number examples, so every division in the worked examples comes out evenly. By the end, you should be able to write a calculation as a sequence of small, checkable steps rather than trying to do everything in your head at once.


Why calculation order matters

An expression is a collection of numbers and operations that represents one calculation. For example:

If one person adds first, they get . If another multiplies first, they get . The individual arithmetic may be correct in both cases, but mathematics needs one shared convention so that an expression has one agreed result.

Math Antics - Order Of Operations

Watch “Math Antics – Order Of Operations” by mathantics for a visual introduction to why a shared calculation order matters and how parentheses control it.

Watch the problem to see why performing correct operations in a different order can still produce a wrong overall result. Then watch parentheses, focusing on the idea that parentheses form a group whose contents are calculated before anything outside. Skip the exponent section, which is not needed yet, and resume at operation priority for multiplication and division before addition and subtraction, including the essential left-to-right rule.

The shared convention is called the order of operations. A common memory aid is PEMDAS:

  • P: Parentheses
  • E: Exponents
  • M and D: Multiplication and division
  • A and S: Addition and subtraction

We are not using exponents in this lesson, but it helps to know why the letter appears.

A PEMDAS reference chart: parentheses come first; multiplication and division share a level; addition and subtraction share a level. The chart also emphasizes that operations on the same level are completed from left to right.

The important correction to a too-simple reading of PEMDAS is this:

It does not mean “always multiply before divide,” or “always add before subtract.”

Multiplication and division have equal priority. Addition and subtraction also have equal priority. When operations share a priority level, calculate from left to right.


The method: simplify one operation at a time

Use this reliable routine whenever an expression becomes crowded:

  1. Calculate inside parentheses. If parentheses are nested, start with the innermost pair.
  2. Outside the parentheses, do multiplication and division, moving from left to right.
  3. Finally, do addition and subtraction, again moving from left to right.
  4. After every operation, rewrite the entire remaining expression before continuing.

That fourth step matters. It prevents a common mistake: completing one operation correctly but accidentally changing another part of the expression while copying it.

Consider:

The multiplication has priority over the addition:

Now compare it with an expression containing parentheses:

Here, the parentheses explicitly make the addition happen first:

The same three numbers can therefore produce different results. Parentheses are not decoration; they communicate the intended structure of a calculation.

A crucial detail: follow the rules inside parentheses too

“Parentheses first” means simplify the entire grouped part before working outside it. But you still use the usual order of operations inside the group.

For example:

First simplify the parentheses:

Then multiplication comes before addition:

If the parentheses themselves held several operations, such as , you would multiply before adding within that group.


Parentheses within parentheses

Sometimes one group sits inside another. In that situation, begin with the group that is deepest inside.

Consider:

The innermost parentheses are :

Now the remaining parentheses can be simplified:

Then multiply:

The outer parentheses had to wait until their inner calculation became a single number. Think of each pair of parentheses as a small calculation that must be completed before its result can be used by the rest of the expression.


Equal priority means left to right

This is the part of PEMDAS that causes many mistakes.

Multiplication and division

Look at:

Division and multiplication are tied, so start at the left:

It would be incorrect to multiply and first. The expression does not contain parentheses telling you to group those numbers together.

Addition and subtraction

The same principle applies here:

Subtraction and addition are tied, so work left to right:

Do not add and first. That would change the meaning of the expression.

A useful shorthand to remember is:

Priority levelWhat to do
HighestParentheses, starting with the innermost group
NextMultiplication or division, left to right
LastAddition or subtraction, left to right

A full worked example

Let’s combine everything in one expression:

First: parentheses.

Next: multiplication and division from left to right. The multiplication appears first:

Now division:

Finally: addition and subtraction from left to right.

Notice that we did not subtract at the beginning, even though it appears first when reading the expression. Multiplication and division had higher priority.

A clean written solution gives you an audit trail: if the final answer seems strange, you can inspect each line and find the first step that went wrong.


A practical checking habit

Before accepting an answer, scan your work using these questions:

  • Did I fully simplify every pair of parentheses before working outside it?
  • Did I complete all multiplication and division before beginning addition or subtraction?
  • When two operations had the same priority, did I move left to right?
  • Did I rewrite the remaining expression accurately after each step?

A calculator and, later, Python will also follow order-of-operations rules. But neither tool can know whether you meant to write parentheses in the first place. Learning to recognize the structure yourself is what lets you check whether a result makes sense.


Key takeaways

The order of operations makes sure that one arithmetic expression has one agreed answer.

  • Parentheses take priority; nested parentheses are evaluated from the inside outward.
  • Multiplication and division share the same level, so work left to right.
  • Addition and subtraction share the same level, so work left to right.
  • Rewrite the expression after each operation to keep the calculation accurate.

Next lesson, you will run your first Python program and use print() to display arithmetic results. Python follows the same precedence rules you practiced here, so this math becomes the foundation for writing calculations in code.

Can't find a good explanation? Sign up and we'll make it for you

Sign up