Why do we have PEMDAS? Because we need to standardize on something. It’s a convention to make communication easier. We break it all the time. If I give you 1/2x, is that (1/2)*x or 1/(2x)? Most would say the former, but I know a lot of physicists read the latter. If you meant (1/2)*x, why did you write 1/2x and not x/2? It’s still a bit ambiguous, though. But if I gave you y/2x, everybody would read it as y/(2x). So order of operations is actually contextual!

PEMDAS is a contextual convention. A question designed to mess with the convention is outside that context and PEMDAS doesn’t automatically apply. If you asked “according to PEMDAS, what is 8÷2(2+2)”, then that’s 16. Without that frame, though, the answer is “wtf”.

For reference Cedric Villani (2010 Fields Medal) take on this is:
“The right reaction is not to give the result. But to say that the expression is poorly written and that the ambiguity must be removed by adding brackets, for example. Better go on holidays without worrying about this non problem.” [1]

I find it pretty baffling that this post reached so high on the front page.

I find it pretty baffling that this post reached so high on the front page.

This phenomena exists on ‘hacker’ ‘news’, where articles related to ‘math’ are upvoted highly but there are scant comments. My personal opinion is that folks on both sites embellish the idea of ‘math’ but don’t actually understand enough about the post to contribute. E.g. ‘upvote the idea, but any discussion escapes me.’

Agreed. People usually use the convention that concatenation represents some arbitrary common operations. This ‘common operation’ is then pretty arbitrary: 2x represent 2 * x, 1½ represents 1 + ½, and D f(x) represents the derivative of f at the point x. There are lots of ambiguities and weird things, but it mostly works out because of context and conventions. And note that these notational ambiguities are examples from math, where things are defined quite rigorously compared to other fields.

Resists the urge to rant about questions on assessments

May be there is a different convention at play here. My mental grouping order when I read 1/2x or y/2x is different from when I read 1/2*x or y/2*x. I imagine y/2x to be similar to \frac{y}{2x} while y/2*x is not read that way.

In at least a handful of respected academic journals, textbooks, and lectures, multiplication denoted by juxtaposition (also known as implied multiplication) is interpreted as having higher precedence than division. This makes sense intuitively, but most decent calculators have no truck for it, and doggedly follow the left-to-right order for division and multiplication.

So journals and textbooks say to do one thing, the intuitive thing even, but because some calculator lacks a button for it, we just ignore all that? How sad the state of mathematics that the expression of ideas is limited by such mechanical devices.

Sad or not it is how things have always been. If you can’t express an idea in your computation systems, you are unlikely to express them outside of those systems. We use calculators and computers because they’re useful, but they come with a cost nonetheless.

So basically there was no math idea before computers calculators, and there is not a single mathematician who does math without them. I really wonder how I did nearly all my studies in math without using calculators or computers.

More broadly speaking the tools we use to do math shape the math we choose to do and how we do it. This was true with the slide rule, the abacus, napier’s bones, compass and straightedge, chalk and slate, or clay tablet.

These problems (and others, like ‘which bucket fills first’) are created specifically to generate arguments, because the more comments / reactions a post gets, the more algorithmic reach it’s creator gets on facebook/twitter.

Some people leave school math classes believing math is a minefield studded with gotchas. It’s not supposed to be like that, and it’s a real shame so many people end up with that impression. Part of the job of anyone who writes an expression like that is to make sure it can be understood. If it’s ambiguous and someone gets the “wrong” answer, the blame belongs to the person who wrote the ambiguous question.

Perhaps the way it’s rendered isn’t helping - perhaps on purpose - especially when people don’t remember the precedence rules. I never use the division symbol when writing maths - I would have written it like this:

This is the dumbest nerd fight ever. This is the tabs vs spaces of arithmetic. The dress of calculation. The Yanny or Laurel of notation.

Nerds, the notation is ambiguous. Some of you nerds are disambiguating one way and other of you nerds are disambiguating the other way. There is no god-given way to disambiguate that we will all agree on. So, nerds, just agree ahead of time which way you want this to go and stop acting like you know the one true way.

I did read it. I’m just tired of this nerd fight. It’s been all over my radar for the past three days. It bears repeating that the fight is dumb. In unequivocal language that doesn’t fall afoul of Poe’s Law.

Edit: By the way, here is a more interesting one that physicists and mathematicians tend to evaluate differently. Suppose T(x, y) = k(x^2 + y^2). What is T(r, θ)? Physicists tend to answer kr^2 and mathematicians tend to answer k(r^2 + θ^2).

Whoa…is that because physicists would interpret that as T(v) = k(v) where v is a vector, and see (r, θ) and (x, y) as just two views of the same vector?

Sort of, yes, there’s a geometrical thinking behind it. It’s just a huge convention in physics and most of science that certain variable names are reserved for certain coordinate systems, so they think the question is about writing the temperature in Cartesian or polar coordinates.

Mathematicians are a little more used for their variables to be meaningless so they don’t attempt a change of coordinates for the expression.

Choose epsilon smaller than zero and see how that trips mathematicians up :) …

Just kidding :) Physicists employ a lot of patterns in their calculations. One for example is, that we “can” calculate with differentials just like with normal variables. I had room mates who studied math, and we had this game where I would show them a short physics calculation while preparing for my physics exam and they would cringe and point out the spots where a mathematician would stop to clarify whether a function was actually integrable at that spot, or similar things.

You surely know these memes, were a calculation is shown that proofs that “0 = 1” or something similar, right? They are mostly based on dividing by zero at some point. Mathematicians know a lot more of such “loopholes” that need to be watched out for.

Basically nobody will ask such question in real life. As such both answer are equally good. It is exactly the same thing than the OP. Something which never happen have answers depending of who you ask. And the best answer is not answering.

Things like these have recently had me thinking about what a “good style guide” for mathematics should look like, or if it is even possible. It wouldn’t even have to just be one style, could be different ones for different preferences, but at least some coherency across different subjects would really be nice from time to time. Interestingly TeX has done some work in this directory, at least when it comes to notation, but there’s still a lot more that should and could be improved on.

TeX doesn’t make the notation less ambiguous. You can use TeX to write all sorts of ambiguous things. Professional mathematicians do this all the time! This is because they rely on humans to pick the right way to disambiguate things because they know the context where things make sense. Most written mathematics (mathematical logic and other computery subjects excepted) is just shorthand for English (or whatever other natural language), can be read out loud in English, and with natural languages being ambiguous themselves, we manage just fine.

No, you’re totally right that notation hasn’t become less ambiguous. I guess calligraphy would have been a better term instead of notation – and maybe also how a document is structured?

So it isn’t convention to evaluate left to right when there are operators of equal precedence? (In this case, division and multiplication.) Not challenging you. Just an honest question.

Obviously not a common enough convention to prevent Twitter wars. Rewrite your expression in a way that will confuse people less.

It’s actually fairly standard in mathematical expositions I know of to be aware of the ambiguity of the obelus or fraction bar and write expressions so that it’s absolutely clear what is the numerator and what is the denominator.

Ultimately, mathematics is like writing. You write to an audience. If your audience knew what you meant, you’re fine. If they didn’t know what you meant, and you care about that particular audience then you clarify. If there’s risk of ambiguity with your particular audience you can use parentheses to be explicit. Or you can use polish notation with the left to right precedence ;) and no that’s not “reverse polish notation”, that’s for calculators .

I’m pretty sure applying associativity/distributivity makes for 8/(2*2+2*2) = 8/8 = 1. I saw a mathematician on Twitter point out that canonically most would see 8/2x as 8/(2x), not 8/2*x, which is how a computer might see it.

According the the OOO, an equivalent expression is (8/2)(2+2), and your expression corresponds to distributing the denominator across addition as a multiplier instead of a divisor. Properly distributing would be 8(2/2 + 2/2).

Very few programming languages allow multiplication by juxtaposition. I can only think of Maple and Julia which do. Maybe Mathematica too? Not familiar enough with it.

Juxtaposition is probably the most common notation for multiplication after you leave high school.

Please explain me, how Feynman and Landau are incorrect about implied multiplication ? And sorry buddy, the result of wolframalpha and google are all but a way to know the “correct answer”. Moreover, no one a bit serious will write implied multiplication with numbers. And also not a single mathematician will write such an expression. why they would give it a particular meaning. If it is the opposite, what is the value of 1@2= ?

I think the underlying cause is that we usually assign precedence to operators, and concatenation is not a well-defined operator (just a convention that means ‘some common operator, dependent on context’). Now, since concatenation places its two operands together, it is natural to assume that it has a higher precedence than other operators.

In the same spirit: Does 1½*2 equal (1+½)*2=3 or 1+(½*2)=2? Strictly speaking, following PEMDAS here means that you should evaluate these expressions as 1+(½*2)=2.

That is a very interesting take on it. I believe that if the question had been 8 ÷ 2*(2 + 2) programmers would have no problem coming up with 16 (hence the intentional skipping of *).

Oh wow. That’s still 1, to me. Take the spaces out, it’s still 1. ÷ seems like Haskell’s $ operator: everything to the right goes under. Put spaces in the other way, 8÷2 * (2+2), it’s like lint-warning bad writing style. Like multiplying fractions by concatenation:

.2.5.3 == .03

Bad style, even if it’s unambiguous. (OS X Spotlight will actually compute .2.5.3 == .03, curiously/horrifyingly)

My answer is “the question makes no sense.”

Why do we have PEMDAS? Because we need to standardize on

something. It’s a convention to make communication easier. We break it all the time. If I give you`1/2x`

, is that`(1/2)*x`

or`1/(2x)`

? Most would say the former, but I know a lot of physicists read the latter. If you meant`(1/2)*x`

, why did you write`1/2x`

and not`x/2`

? It’s still a bit ambiguous, though. But if I gave you`y/2x`

,everybodywould read it as`y/(2x)`

. So order of operations is actually contextual!PEMDAS is a contextual convention. A question designed to mess with the convention is outside that context and PEMDAS doesn’t automatically apply. If you asked “according to PEMDAS, what is

`8÷2(2+2)`

”, then that’s 16. Without that frame, though, the answer is “wtf”.For reference Cedric Villani (2010 Fields Medal) take on this is: “The right reaction is not to give the result. But to say that the expression is poorly written and that the ambiguity must be removed by adding brackets, for example. Better go on holidays without worrying about this non problem.” [1]

I find it pretty baffling that this post reached so high on the front page.

This phenomena exists on ‘hacker’ ‘news’, where articles related to ‘math’ are upvoted highly but there are scant comments. My personal opinion is that folks on both sites embellish the idea of ‘math’ but don’t actually understand enough about the post to contribute. E.g. ‘upvote the idea, but any discussion escapes me.’

Ironically, this exact submission on HN has very low engagement: https://news.ycombinator.com/item?id=20613244

Agreed. People usually use the convention that concatenation represents some arbitrary common operations. This ‘common operation’ is then pretty arbitrary: 2x represent 2 * x, 1½ represents 1 + ½, and D f(x) represents the derivative of f at the point x. There are lots of ambiguities and weird things, but it mostly works out because of context and conventions. And note that these notational ambiguities are examples from math, where things are defined quite rigorously compared to other fields.

Resists the urge to rant about questions on assessmentsThey would probably write it as

though.

May be there is a different convention at play here. My mental grouping order when I read

`1/2x`

or`y/2x`

is different from when I read`1/2*x`

or`y/2*x`

. I imagine`y/2x`

to be similar to`\frac{y}{2x}`

while`y/2*x`

is not read that way.Indeed…

So journals and textbooks say to do one thing, the intuitive thing even, but because some calculator lacks a button for it, we just ignore all that? How sad the state of mathematics that the expression of ideas is limited by such mechanical devices.

Sad or not it is how things have always been. If you can’t express an idea in your computation systems, you are unlikely to express them outside of those systems. We use calculators and computers because they’re useful, but they come with a cost nonetheless.

So basically there was no math idea before computers calculators, and there is not a single mathematician who does math without them. I really wonder how I did nearly all my studies in math without using calculators or computers.

More broadly speaking the tools we use to do math shape the math we choose to do and how we do it. This was true with the slide rule, the abacus, napier’s bones, compass and straightedge, chalk and slate, or clay tablet.

These problems (and others, like ‘which bucket fills first’) are created specifically to generate arguments, because the more comments / reactions a post gets, the more algorithmic reach it’s creator gets on facebook/twitter.

Another take, less detailed but more “meta” about these memes in general:

https://blogs.scientificamerican.com/roots-of-unity/the-only-way-to-win-is-not-to-play-the-game/

Perhaps the way it’s rendered isn’t helping - perhaps on purpose - especially when people don’t remember the precedence rules. I never use the division symbol when writing maths - I would have written it like this:

this is expected. implicit multiplication has a higher precedence than explicit:

https://github.com/sharkdp/insect/blob/master/docs/reference-syntax.md

https://insect.sh?q=8/2(2%2B2)

https://insect.sh?q=8/2*(2%2B2)

The problem is even explicitly addressed in their FAQ.

P.S. Thanks for introducing me to this tool!

This is the dumbest nerd fight ever. This is the tabs vs spaces of arithmetic. The dress of calculation. The Yanny or Laurel of notation.

Nerds, the notation is ambiguous. Some of you nerds are disambiguating one way and other of you nerds are disambiguating the other way. There is no god-given way to disambiguate that we will all agree on. So, nerds, just agree ahead of time which way you want this to go and stop acting like you know the one true way.

Every single nerd has been saying this the whole time.

Haha, not every single one, but yes, there’s quite a few of us.

You don’t appear to have read the linked article.

Why, because I’m agreeing with it?

I did read it. I’m just tired of this nerd fight. It’s been all over my radar for the past three days. It bears repeating that the fight is dumb. In unequivocal language that doesn’t fall afoul of Poe’s Law.

Edit: By the way, here is a more interesting one that physicists and mathematicians tend to evaluate differently. Suppose T(x, y) = k(x^2 + y^2). What is T(r, θ)? Physicists tend to answer kr^2 and mathematicians tend to answer k(r^2 + θ^2).Whoa…is that because physicists would interpret that as T(v) = k(v) where v is a vector, and see (r, θ) and (x, y) as just two views of the same vector?

Sort of, yes, there’s a geometrical thinking behind it. It’s just a huge convention in physics and most of science that certain variable names are reserved for certain coordinate systems, so they think the question is about writing the temperature in Cartesian or polar coordinates.

Mathematicians are a little more used for their variables to be meaningless so they don’t attempt a change of coordinates for the expression.

Choose epsilon smaller than zero and see how that trips mathematicians up :) …

Just kidding :) Physicists employ a lot of patterns in their calculations. One for example is, that we “can” calculate with differentials just like with normal variables. I had room mates who studied math, and we had this game where I would show them a short physics calculation while preparing for my physics exam and they would cringe and point out the spots where a mathematician would stop to clarify whether a function was actually integrable at that spot, or similar things.

You surely know these memes, were a calculation is shown that proofs that “0 = 1” or something similar, right? They are mostly based on dividing by zero at some point. Mathematicians know a lot more of such “loopholes” that need to be watched out for.

Basically nobody will ask such question in real life. As such both answer are equally good. It is exactly the same thing than the OP. Something which never happen have answers depending of who you ask. And the best answer is not answering.

Things like these have recently had me thinking about what a “good style guide” for mathematics should look like, or if it is even possible. It wouldn’t even have to just be one style, could be different ones for different preferences, but at least some coherency across different subjects would really be nice from time to time. Interestingly TeX has done some work in this directory, at least when it comes to notation, but there’s still a lot more that should and could be improved on.

TeX doesn’t make the notation less ambiguous. You can use TeX to write all sorts of ambiguous things. Professional mathematicians do this all the time! This is because they rely on humans to pick the right way to disambiguate things because they know the context where things make sense. Most written mathematics (mathematical logic and other computery subjects excepted) is just shorthand for English (or whatever other natural language), can be read out loud in English, and with natural languages being ambiguous themselves, we manage just fine.

Edit: But if you insist…No, you’re totally right that notation hasn’t become less ambiguous. I guess calligraphy would have been a better term instead of notation – and maybe also how a document is structured?

So it isn’t convention to evaluate left to right when there are operators of equal precedence? (In this case, division and multiplication.) Not challenging you. Just an honest question.

Obviously not a common enough convention to prevent Twitter wars. Rewrite your expression in a way that will confuse people less.

It’s actually fairly standard in mathematical expositions I know of to be aware of the ambiguity of the obelus or fraction bar and write expressions so that it’s absolutely clear what is the numerator and what is the denominator.

APL goes right to left! There’s definite advantages to doing it that way, too.

Ultimately, mathematics is like writing. You write to an audience. If your audience knew what you meant, you’re fine. If they didn’t know what you meant, and you care about that particular audience then you clarify. If there’s risk of ambiguity with your particular audience you can use parentheses to be explicit. Or you can use polish notation with the left to right precedence ;) and no that’s not “reverse polish notation”, that’s for calculators .

I’m pretty sure applying associativity/distributivity makes for 8/(2*2+2*2) = 8/8 = 1. I saw a mathematician on Twitter point out that canonically most would see 8/2x as 8/(2x), not 8/2*x, which is how a computer might see it.

You cannot distribute within a term like that.

According the the OOO, an equivalent expression is (8/2)(2+2), and your expression corresponds to distributing the denominator across addition as a multiplier instead of a divisor. Properly distributing would be 8(2/2 + 2/2).

Unless you can distribute a term like that. 8/2(x+y) is most likely 8/(2x+2y)

The use of space is also misleading (as was the implicit multiplication). Do these look different to you?

We humans are not as good at counting parentheses as computers, but we can’t help but notice a significant difference in spacing.

The correct answer is undeniably

`4 2`

https://tryapl.org/?a=8%F72%282+2%29&run

https://i.imgur.com/KWAlJMw.png

I’m not sure what I was expecting, but APL seems to have taken the principle of least surprise and inverted it.

Ahahahaha thank you for that

Very few programming languages allow multiplication by juxtaposition. I can only think of Maple and Julia which do. Maybe Mathematica too? Not familiar enough with it.

Juxtaposition is probably the most common notation for multiplication after you leave high school.

Please explain me, how Feynman and Landau are incorrect about implied multiplication ? And sorry buddy, the result of wolframalpha and google are all but a way to know the “correct answer”. Moreover, no one a bit serious will write implied multiplication with numbers. And also not a single mathematician will write such an expression. why they would give it a particular meaning. If it is the opposite, what is the value of 1@2= ?

I think the underlying cause is that we usually assign precedence to operators, and concatenation is not a well-defined operator (just a convention that means ‘some common operator, dependent on context’). Now, since concatenation places its two operands together, it is natural to assume that it has a higher precedence than other operators.

In the same spirit: Does

`1½*2`

equal`(1+½)*2=3`

or`1+(½*2)=2`

? Strictly speaking, following PEMDAS here means that you should evaluate these expressions as`1+(½*2)=2`

.In Lisp, you can write macros named

`2`

, so this isn’t silly at all. It’s a perfectly valid take.(Most lisps disallow this, but some are fine with it.)

That is a very interesting take on it. I believe that if the question had been

`8 ÷ 2*(2 + 2)`

programmers would have no problem coming up with 16 (hence the intentional skipping of`*`

).Oh wow. That’s still 1, to me. Take the spaces out, it’s still 1. ÷ seems like Haskell’s $ operator:

everythingto the right goes under. Put spaces in the other way,`8÷2 * (2+2)`

, it’s like lint-warning bad writing style. Like multiplying fractions by concatenation:`.2.5.3 == .03`

Bad style, even if it’s unambiguous. (OS X Spotlight will actually compute .2.5.3 == .03, curiously/horrifyingly)

This confused me for a minute until I read the footnote and realized that

`2(x)`

wasn’t just`2`

.