# The Horror of PEMDAS

Slate has an interesting article, by Tara Haelle, discussing a math problem that recently received some attention on Facebook. The problem is to evaluate this expression:

$6 \div 2(1+2)$

Obviously, the challenge here is not the arithmetic itself. It is to figure out the order in which to do the operations. I suspect most people would naturally do
the parentheses first, leading to this:

$6 \div 2(3)$,

but what now? We could argue that we should first multiply the two by the three, leading to this:

$6 \div 6$,

which is obviously equal to 1. Alternatively, we could break up the expression this way:

$(6 \div 2) \times 3$,

which is equal to 9. The first one strikes me, personally, as more natural, but as it happens, the accepted convention says the second one is correct.

You surely learned the acronym PEMDAS back in elementary school. (Perhaps you also learned the mnemonic, “Please excuse my dear aunt Sally.”) The acronym stands for: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. That is, it tells you the order in which to carry out the operations in an expression like this. Even with the acronym, however, there is still some interpreting to be done. Doing the parentheses and the exponents first rarely causes confusion, but it needs to be understood that multiplication and division are done at the same time, working from left to right.

As I said, this is purely a convention. It’s not that the first interpretation is unreasonable, it’s just that, as it happens, that’s not the convention that’s been agreed upon. Haelle provides a very good discussion of these conventions, as well as some of the various notations that have been used for division over the years.

Frankly, though, PEMDAS is an abomination. I periodically teach courses intended for future elementary school mathematics teachers, and we inevitably spend a lot of time teaching about PEMDAS. The powers that be have decided that interpreting ambiguous algebraic expressions is a terribly important skill.

As a mathematician I find this all stupid and offensive. You see, no mathematician would ever write something as ridiculous as the expression with which we started. In fact, mathematicians never use the $\div$ symbol for division. I just now had to look up how to make LaTeX produce such a thing. We always use the fraction notation. For example, if we meant our first interpretation we could have written:

$\frac{6}{2(1+2)}$,

whereas the second interpretation could have been written

$\frac{6}{2} \left( 1+2 \right)$,

which rather takes the fun out of the problem, since either one is completely unambiguous. Especially in research-level math, we routinely write very complicated algebraic expressions with tons of elaborately arranged symbols. It’s hard enough to decipher these expressions without adding the burden of an ambiguous order of operations. We’ve actually gotten pretty good at writing things clearly. It’s amazing what you can do with the careful use of parentheses and brackets, along with some sensibly chosen notation.

Yet we take school children at the peak of their curiosity, and teach them that math is all about memorizing arbitrary conventions for interpreting unnecessarily ambiguous algebraic expressions. And then we wonder why people hate math!

On a related note, I’m not a big fan of using a diagonal line for fractions. It can be useful for simple fractions, like 1/2 or 2/3. Formatting things in the more usual “vertical” manner can mess up the line spacing. But what are we to make of something like this: 1/2+3? Is that the fraction 1/5, or are we adding the whole number 3 to the fraction 1/2? Ugh!

One more thing. Mathematicians routinely refer to the top and bottom of a fraction. We say numerator and denominator too, but top and bottom is just fine. The reason it’s fine is that if you talk about the top and bottom of a fraction everyone knows what you mean, and clarity is what we care about. But if any schoolkid uses such language, he gets told that he is wrong to do so, and that he has to learn the jawbreakers if he wants to do math. Ridiculous!

1. #1 Thanny
March 15, 2013

As far as I’m concerned, using juxtaposition instead of a multiplication symbol turns “2(1+2)” into an atom, which should be treated as shorthand for “(2 x (1+2))”.

2. #2 Stephen Lucas
Harrisonburg VA
March 15, 2013

Another way around the problem of order of operations is move to postfix notation, which is unambiguous, and an excuse to revive old HP calculators. In this setting 6/(2(1+2)) becomes
6 2 1 2 + * /
while (6/2)*(1+2) becomes
6 2 / 1 2 + *
Or, use parentheses or actual fractions as you suggest!

3. #3 Lenoxus
March 15, 2013

I used to be much more paranoid about computer-based and graphing calulators misinterpreting me, so I went parenthasis-crazy. I’ve since loosened up and relied on the calculator’s inherent order of operations. It’s somewhat surprising how most real-world problems require few parenthases to write out, but perhaps it would also seem that way if the order were SADMEP and we therefore simplified equations that way. I wonder what a good test of that would be…

One nice thing about the Google and Bing calculators (used by simply entering an equation in the search bar) is that they give the answer along with a restatement of the original question using lots of parenthases, so that you can be sure of how the calculator did the problem. I believe WolframAlpha does the same thing, but with a LaTeX-style notation.

In short, while teachers should definitely emphasize that the OOO is a mere convention and it varies, I wouldn’t discard it altogether, because it does have a certain efficiency (It’s possibly inefficient to write (6/(2*(1+2))). Of course, there may be more efficient methods still.

4. #4 Eric Lund
March 15, 2013

The symbol that is used for division in elementary and junior high school math in the US has other meanings in different cultures, which is one big reasons why mathematicians (and other scientists and engineers) don’t use it. I have seen that symbol used to denote a range (I don’t recall which culture does that, but English is not the first language of that country).

I agree with Thanny that there should have been an explicit multiplication symbol in the problem, because omitting it implies an intention to group the 2 with the (1+2).

The C language has a quite lengthy standard on operator precedence. I have seen it condensed into two rules: 1. Multiplication and division take precedence over addition and subtraction. 2. Use parentheses for everything else.

5. #5 Blaine
March 15, 2013

Using c/c++ the expression does equal 9 as pointed out.

One other oddity about computers. On a computer association fails so

a + ( b + c ) does not equal ( a + b ) + c

I always like to torment students by ‘proving’ that real numbers don’t exist because they cannt be computed, only rational numbers exist. But they have measure zero. Oh the insanity.

Maybe someday with quantum computers…then we may have true super-turing computation.

6. #6 deepak shetty
March 15, 2013

In fact, mathematicians never use the div symbol for division.
Programmers just add Parentheses everywhere – when in doubt

7. #7 Anthony
March 15, 2013

Actually, this is undefined in most computer languages, since 2(1+2) typically means the function 2 with an argument of (1+2), and 2 is not a legal function (and even if it were a legal function, probably would not be the x2 function).

8. #8 MNb
March 15, 2013

As a Dutchman I obviously haven’t learned PEMDAS, but Mijnheer Van Dalen Wacht Op Antwoord. All Dutch math, physics and chemistry teachers use fraction notation for dividing. In Suriname the matter is undecided, which is a horror indeed. In my classes and on high school fraction notation is usage; but during the central exams of middle school sometimes the PEMDAS convention is used.
The diagonal line for fractions is close to forbidden in both Suriname and The Netherlands.

“top and bottom is just fine”
Fun. There is no equivalent for this in Dutch; just “teller” and “noemer”, which both are short enough.

9. #9 eric
March 15, 2013

clarity is what we care about

Isn’t THAT the lesson that should be taught to future teachers as well as HS students? When you write an equation, know how to analyze it for ambiguity and know how to eliminate it. When faced with an ambiguous equation, ask the author what they meant if you can. If not, do it both ways and use you brain (gasp!) to try and figure out which answer makes the most sense.
Now, it would be naive of me to say that those suggestions will solve all problems with ambiguous math. But if they solve 80% of them, its probably still better than just memorizing PEDMAS and applying it without thinking about the answer.

10. #10 kiwi
Nashua NH
March 15, 2013

Want more insanity … use Windows Calculator to evaluate 1 + 2 * 3 in Standard Mode and Scientific Mode

11. #11 Poincare
March 15, 2013

Regarding the first sentence of your blog post Jason, let me remind you of one the major points you made at Hopkins last week: This discussion is not about Mathematics; it is about Arithmetic.

12. #12 Another Matt
March 15, 2013

3x/4y

is that (3x)/(4y) or (3xy)/4 ?

Given that nobody would write 3x/4y when they meant (3xy)/4, the former is the only natural interpretation of the string.

But code interpreters/compilers are not really supposed to be “natural,” so by all means, when in doubt overuse parentheses in coding. And note that 3*x/4*y, with the extra symbols, now starts to look really fishy.

13. #13 Andre
March 16, 2013

Eric Lund: According to Wikipedia, the country that uses the division sign (obelus) for range is Poland (and possibly Italy).

Jason: The one sentence I haven’t seen written about this equation is the following: “The problem is that this is a poorly constructed equation.” I know that’s what you are clearly saying in this piece, but I think it needs to be explicitly stated. I read that whole Slate article waiting for this to be said. The fault isn’t in what order the operations are done in, but in the fact that whoever came up with the equation did so poorly.

We talk about this all the time in english classes, but it’s not something that often is broached explicitly in mathematics. In middle school (or earlier) students will discuss sentences like the following “The stolen money was found by the security guard.” Was the finder the security guard or was the money located near him? But when do they approach this concept in math class? When do students learn that obeli are terrible?

Of course, the reason you would never construct the equation in that way (and the reason you would never use an obelus) is because you are a better writer (of equations) than that.

PS: I also think you’re a good writer of sentences.

14. #14 Gibbon1
March 19, 2013

Personally I learned to think of fractions as ‘constants’ meaning you can just treat them as a number that hasn’t been evaluated yet. 2pi/3.563 is what? who cares right now. we know it’s a number and that’s all we need to know.

More it seems to me that teaching of fractions is a rump skill left over when people needed to do numbers in their head. There are a lot of short cuts you can use, if you understand fractions. But of course when kids attempt to actually put those sorts of short cuts into practice, they get thumped on the head.

Later still imaging my chagrin when after learning in algerbra to ‘simplify’ equations, one learned to unsimplify equations in differential equations.

Too long no one will read: But I have a text book on spread spectrum wireless. What is interesting about the book is each chapter is two parts, the first part described a problem, how people tried to solve it. The second part described how people actually solve the problem today. If only I had math books like that in school.

15. #15 hermes fake bags cheap
http://hermesfakebagscheap.blogspot.com/
March 23, 2013

Ssense for \$1,725.Pair with: A cocktail dress that goes “pop” in the subtlest of ways, like Helmut Lang‘s leather louis vuitton hlouis vuitton