1. 30
  1.  

  2. 34

    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, 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”.

    1. 18

      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.

      1. https://www.francetvinfo.fr/societe/education/on-a-demande-a-cedric-villani-de-resoudre-ce-probleme-de-maths-qui-donne-mal-a-la-tete-aux-internautes_3563309.html
      1. 3

        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.’

        1. 4

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

      2. 8

        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

        1. 8

          but I know a lot of physicists read the latter.

          They would probably write it as

              1
              --
              2x
          

          though.

          1. 5

            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.

            1. 4

              Indeed…

              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.

              1. 3

                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.

                1. 2

                  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.

                  1. 2

                    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.

              2. 2

                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.

              3. 13

                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/

                1. 3

                  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.

                2. 6

                  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:

                  8 (2+2)
                  -
                  2
                  
                  1. 6

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

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

                    ≫ 8/2(2+2)
                    8 / (2 × (2 + 2))
                    = 1
                    

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

                    ≫ 8/2*(2+2)
                    (8 / 2) × (2 + 2)
                    = 16
                    

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

                    1. 4

                      The problem is even explicitly addressed in their FAQ.

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

                    2. 11

                      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.

                      1. 6

                        Nerds, the notation is ambiguous.

                        Every single nerd has been saying this the whole time.

                        1. 2

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

                        2. 4

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

                          1. 2

                            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).

                            1. 1

                              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?

                              1. 2

                                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.

                                1. 2

                                  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.

                              2. 1

                                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.

                            2. 2

                              Nerds, the notation is ambiguous

                              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.

                              1. 2

                                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…

                                1. 2

                                  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?

                              2. 2

                                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.

                                1. 5

                                  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.

                                  1. 2

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

                                2. 5

                                  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 .

                                  1. 4

                                    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.

                                    1. 2

                                      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).

                                      1. 1

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

                                    2. 4

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

                                      • 8 / 2*4
                                      • 8/2 * 4

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

                                      1. 3

                                        The correct answer is undeniably 4 2

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

                                        1. 6

                                          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.

                                          1. 2

                                            Ahahahaha thank you for that

                                            1. 1

                                              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.

                                          2. 2

                                            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= ?

                                            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.

                                              1. 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.)

                                                1. 1

                                                  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 *).

                                                  1. 2

                                                    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)

                                                  2. 1

                                                    Next, we evaluate the call to the function 2 passing in the argument 4:

                                                    8 ÷ 8

                                                    This confused me for a minute until I read the footnote and realized that 2(x) wasn’t just 2.