I have read and heard in many places that multiplication and division are of equal precedence. So what is the value of:

$$ 80 \div 10 \times 2 $$

Is it

$$(80 \div 10) \times 2 = 16$$


$$ 80 \div (10 \times 2) = 4 $$

? The answer here seems to be that by convention we operate from left-to-right, so the first solution is correct. But I would have thought we should get the same answer either way if multiplication and division are of equal precedence. Isn't the whole point of operator precedence to resolve expressions that would otherwise have more than one solution?

For example, people also say that addition and subtraction are the same level of precedence, but no such ambiguity exists there:

$$ 80 + 10 - 2 = (80 + 10) - 2 = 80 + (10 - 2) = 88 $$

So what is meant when people say that multiplication and division have the same precedence?

  • 4
    $\begingroup$ Well $(80-10)+2 \ne 80-(10+2)$. $\endgroup$ – Rahul Jun 23 '17 at 0:18
  • 1
    $\begingroup$ Actually addition subtraction has the exact same ambiguity. Is 10-8+2 equal to (10-8)+2=4 or is it 10-(8+2)=0? $\endgroup$ – fleablood Jun 23 '17 at 0:22
  • 1
    $\begingroup$ Division and subtraction aren't associative so you can't rearrange the order. "Precidence" is about distribution. $\endgroup$ – fleablood Jun 23 '17 at 0:27
  • $\begingroup$ @fleablood, but precedence is always taught by using parentheses to show the intended order. Just look at the example in the second paragraph here. That doesn't have to do with associativity? $\endgroup$ – gwg Jun 23 '17 at 0:45
  • $\begingroup$ The easy way to avoid this problem is to just write everything as fractions. Honestly, I haven't seen a formula in ages that has such symbols anymore. They're just... fractions. Perhaps the reason for that is the heart of the question you ask? $\endgroup$ – user64742 Jun 23 '17 at 3:16

When there is equal precedence, the standard thing to do is to work from left to right. Hence $$80/10\times 2 = (80/10)\times2=16. $$

It should be noted that this is not completely universal, i.e. some programming languages don't do it this way, as far as I know. Anyway, it doesn't really matter that much because no one actually writes $80/10\times2$, instead they write $(80/10)\times2$ to remove any ambiguity.

  • 2
    $\begingroup$ No one should actually write $80/10 \times 2$, especially if they mean $80/(10 \times 2)$. If you read MSE enough, you'll find out that lots of people would actually write that, and even worse things. $\endgroup$ – Robert Israel Jun 23 '17 at 0:18
  • $\begingroup$ So then what is meant by "equal" precedence? $\endgroup$ – gwg Jun 23 '17 at 0:42
  • $\begingroup$ It means that they come at the same level in the hierarchy of operations, and in case of ambiguity (i.e. multiple operations at the same level) go from left to right. $\endgroup$ – Eff Jun 23 '17 at 0:54
  • 1
    $\begingroup$ You should probably use $\div$ $\div$ rather than $/$ for this. $\endgroup$ – Akiva Weinberger Jun 23 '17 at 3:12
  • 1
    $\begingroup$ While it is certainly true that nobody writes $80/10\times2$, people do write things like $80/3x$ or $1/2\pi$, and sometimes context makes it clear that what is meant is $80/(3x)$ and $1/(2\pi)$, respectively. (Such expressions are even found in textbooks.) $\endgroup$ – mweiss Jun 23 '17 at 5:07

I'm fine with Eff's answer because I don't think my question was particularly clear. But I'd like to offer what I hope is a clearer question and answer.

When learning about order of operations, examples of mathematical ambiguity like the following often come up:

What is $2 + 4 \times 6$?

The teacher then demonstrates to the pupil that by performing this computation in a different order of operations, we get two different answers. So we use order of operations to indicate that the real answer is $2 + (4 \times 6) = 26$, not $(2 + 4) \times 6 = 36$. In other words, order of operations removes the ambiguity of which operation to perform first.

When I heard that two operations have "equal" precedence, my interpretation of that was that it does not matter which order you perform your operations. But mathematically, this cannot be true since:

$$ (80 \div 10) \times 2 \neq 80 \div (10 \times2) $$

While $\div$ and $\times$ have equal precedence.

Clearly, something else is meant by "equal". Implicit in Eff's answer is that by "equal" we mean that the ambiguity cannot be resolved by simple precedence. The ambiguity is resolved by a new left-to-right rule.

To answer my own question, "What does it mean that multiplication and division have the same precedence?" I say: it means that you cannot perform multiplication or division first as a rule and in fact you will get different answers depending on context. The real rule is that you perform operators with equal precedence in a left-to-right computation.

  • 1
    $\begingroup$ This kind of thing is precisely why all mathematics educators ought to learn programming. Every proper programming language reference will not only specify precedence groups, but also the associativity (left-to-right or right-to-left) within each group. Only people who appreciate precision fully can really teach mathematics well. (For example see the C++ operator precedence rules.) $\endgroup$ – user21820 Sep 1 '17 at 13:31

To say the multiplication and division have equal precedence is to say that, in an unparenthesized expression, they are both to be performed before operations of lower precedence, such as addition and subtraction, and that they are both to be performed after operations of higher precedence, such as exponentiation. Equality of precedence further implies that in an unparenthesized expression containing both multiplication and division, neither operation takes priority over the other. This leaves an ambiguity that must be resolved by some other rule—a left-to-right rule in this case.

One thing that precedence does not imply is that order of operations of equal precedence is irrelevant. To see this, you don't even need to look at an expression containing both multiplication and division. You can consider an expression containing only divisions, such as $10\div2\div5$. Clearly precedence rules can't tell you which division is to be performed first since, well, the precedence of division equals the precedence of division. In this case you need a rule that tells you how to associate the factors in the expression. As stated before, the rule use here is the left-to-right rule: $(10\div2)\div5=1$ is meant, and not $10\div(5\div2)=4$. One could say that associativity of division (and of a mixture of multiplications and divisions) defaults to left-to-right in the absence of parentheses.

A final thought: as discussed above, precedence rules resolve some, but not all ambiguities. I would not say that resolving ambiguity is the ``point'' of precedence rules (or of default associativity rules). The most straightforward way to resolve ambiguity would be to require parentheses everywhere, and to declare expressions such as $1+2\times3$ and $10\div2\div5$ to be undefined. Rather, the point of precedence and default associativity rules is to make expressions more human-readable by allowing parentheses to be omitted in certain situations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.