Math question (order of operations)

There’s the mirror image of that: Reverse Polish Notation, also known as “postfix”, where operators follow their operands. RPN is used by some calculators (most famously from Hewlett-Packard), as well as a few computer programming languages like Forth and Postscript.

No, this doesn’t work. - 6 * 1 0 is perfectly meaningful, but then that + comes out of nowhere (and is only given the one argument / 2 2, rather than the two it needs).

Remember, to create Polish notation, just follow the usual “function(argument1, argument2, etc.)” convention in math, then remove all the (superfluous) parentheses and commas. (Or, in other words, write the expression tree, and then transcribe it in preorder traversal)

So the OP’s 6-(1*0)+(2/2) would become +(-(6, *(1, 0)), /(2, 2)) = + - 6 * 1 0 / 2 2.

And the OP’s (6-1)0+2/2 would become +((-(6, 1), 0), /(2, 2)) = + * - 6 1 0 / 2 2.

[For reverse Polish notation, you do the same thing, but with function names coming after their arguments (i.e., the expression tree in postorder traversal). This is natural in programming because this reflects how computation actually proceeds: first you evaluate the arguments, then you apply the function to them, eventually evaluating the whole expression this way from the bottom-up.

So in reverse Polish notation, the OP’s 6-(1*0)+(2/2) would become 6 1 0 * - 2 2 / +, and the OP’s (6-1)*0+2/2 would become 6 1 - 0 * 2 2 / +]

Yes, but it does “let you punch the whole line in,” which to clarify means that it has a memory for what you previously typed in. Cheaper ones just know: 2 numbers and an operator. So it’s like Windows Calculator’s standard mode, not scientific.

You’re right of course, I was unsure about the equation which is why I said “I think…”

Please Excuse My Dear Aunt Sally.

A number of the other answers gave 5.

I am guessing that they resolved the multiplication and division:

6 - 1X0 + 2/2 becomes 6 - 0 + 1

But then carried forward with addition before subtraction:

6 - 0 + 1 where the addition resolves to 1, leaving 6 - 1 = 5.

Really? OoOps is what? 2nd or 3rd grade? If an adult did not know basic primary school English most people would say that’s idiotic

Good to know after 3 years we finally got *that *conundrum resolved. :smiley:

Not the best analogy. It’s more like ending a sentence in a preposition.

Some pedants will try to claim it’s an absolute violation of the laws of English grammar (which don’t really exist either, but that’s a separate matter) while others will take the more sensible and historically sound argument that sentence ending prepositions occur all the time.

As mentioned ad nauseum at this point, there’s no “Academy of Mathematics” that determines absolute rules. We have a few rules of thumb, enforced by nobody in particular, to reduce ambiguity in expressions. But ambiguity still exists.

The “correct” response to this sort of ambiguity, which is not actually addressed by the usual order of operations lessons and if there is a “correct” response at all, is not to blindly rely on non-existent rules but to ask for a clarification from the writer and to gently chide them for writing such an ambiguous expression in the first place.

An equally acceptable but less predictable course of action is to ask your arithmetic teacher the class policy, because the deliberate use of this type of ambiguity is generally as a lesson to a class - in this particularly case a lesson that is unnecessary as the better lesson is to avoid such ambiguities entirely in actual practice.

With two mouths! :eek:

I never said it, but I wrote it on the board.

I said, “Please excuse my dear Aunt Sally.”

The hardest part was getting them to realize that multiplication and division were done in the order you saw them, the same with addition and subtraction. Since “my” came before “dear” in the sentence, they wanted to do all the multiplication before starting the division.

The puzzle was wandering across Facebook, again, yesterday and I found it interesting that it was prevalent in the Facebook responses, yet no one here even considered it.

Speaking as a former math teacher, I say the whole Order Of Operations thing is just plain silly. This NEVER comes up in real life, not even the real life of real mathematicians. You will NEVER walk into a meeting between a bunch of mathematicians where one of them says out loud “So my formula is six minus one times zero plus two divided by two” and that person expects everyone listening to magically figure out that the answer is 7. That would be ridiculous.

First of all, the formula would almost certainly contain some letters like a, x, or y, maybe even a Greek letter, not simply a bunch of numerals. Secondly, the formula would almost always be written down, either on a piece of paper, or on a chalk board, or projected on a slide, and the WAY it’s written would give subtle clues about exactly in which order the speaker intended you to do the operations. For example, if the two numbers being multiplied were written very close together, and the number it’s subtracted from is relatively far away, that tells you that the multiplication is more important. Like this…

6 - ab
given a = 1 and b = 0

It should be obvious from the closeness of the a and b that the person who wrote the formula expects you to multiply them together before subtracting from 6. And if the person had intended for you to do it the other way, s/he would have written…

( 6 - a ) b

so either way, there’d be no confusion, because the parenthesis indicate that the b is not just being multiplied by the a but also by the 6.

And if the person actually was speaking out loud, with no written formula, s/he would use a pause for emphasis, such as “Six minus ay [pause] times bee” instead of “Six minus aybee”.

The whole “order of operations” debate seems to be grounded on the assumption that mathematicians sit around all day trying to think of ways to trick each other into getting wrong answers. The FACT is that people who are doing math, and expect other people to be able to follow along with it, will use a little common sense to clear up any confusion. Only a troll would intentionally write a confusing formula on a chalk board and sit back smugly while everyone struggles to figure out the ambiguities of it. And yet Algebra textbooks seem to want math teachers to do just that, as if the students will be gaining some valuable life skill from it. I say hogwash.

So, my answer to the OP is that if someone wrote down that formula and asked you to figure it out, the correct response would be to find the person who wrote the formula and insist that they clarify it, because they did their job badly.

It does come into play in programming.
In C and C++, you can define symbols like
#define MY_SIZE 8
#define HEADER_SIZE 4
#define TOTAL_SIZE MY_SIZE + HEADER_SIZE

That gives us TOTAL_SIZE as 12. Maybe.
In code, a rookie might refer to
TOTAL_SIZE * 2
because they have two of the item. But the way it actually works is we have
MY_SIZE + HEADER_SIZE * 2
And because of order of operations, that turns into MY_SIZE + (HEADER_SIZE * 2)
Which is 16.
The correct mechanism is to use parens in the define:
#define TOTAL_SIZE (MY_SIZE + HEADER_SIZE)
Not understanding how order of operations works, at least from a programming perspective and as defined by the langues, can cause real problems.

Really? Because as a current math teacher I see this on a daily basis when my students try to parse a complicated calculation (like the amortization of a loan) into their calculator or translating a formula into Excel.

ETA: It is teachers like sbunny that make the students’ job so much harder later on in school.

As a mathematician, I’m Team sbunny8. Some familiarity with the notational conventions is to be desired. But let’s not give them more significance than they deserve.

And, again, this whole stupid unnecessary mess would be avoided if we just wrote expression trees directly!

But, instead, we write arithmetic expressions by A) linearizing them using B) an inorder traversal with C) delimiters generally suppressed, from which disambiguation demands D) a convention such as “order of operations”. If we didn’t do A) [e.g., if we wrote expressions in terms of their tree-structure directly, as we typically do when considering mathematical trees in other contexts], we wouldn’t have any need for the later things. If we didn’t do B) [e.g., if we linearized with consistently pre-order traversal, as we already use for most functions], we wouldn’t have any need for the later things. If we didn’t do C) [e.g., if we linearized with mandatory parentheses around function’s inputs, as we already use for most functions of multiple arguments], there would be nothing to drill schoolchildren and yell at adults over. It’s only because of the combined effect of all of these unnecessarily poor conventions that we’re stuck wasting energy on threads of this sort, when we could be doing actual math (or anything else) instead!

Writing ASTs is a tad space inefficient, however. And it wouldn’t play too nicely with computers.

As a PhD student in computer science, who reads a lot of papers with pure math (especially probability), I can say that the mathematical community is going to make their job way harder than anything else. I can’t tell you how many times I’ve had to actively reason through an expression to be able to tell whether a summation encompassed the entire expression or just the first term.

In programming, if anything is ambiguous, or might be ambiguous, or is just a bit complex, it gets parenthesized out the ass until it is no longer ambiguous. Or at least that’s how it works in any civilized codebase. Only a yahoo memorizes the precedence and associativity rules for C, for example: If you’re making an expression with multiple operators, you parenthesize every sub-expression and chain sub-expressions (and nested sub-expressions) in such a way that the intent is clear, to the compiler, your co-workers, and yourself six months from now.

So more complex versions of PEDMAS are coded into every single compiler and interpreter of every widely-used programming language, but only fools rely on a full knowledge of those rules to make expressions readable. Parentheses are there for a reason.

If you write your ASTs as parenthesized lists, they play with computers very nicely, and they’re no more space inefficient than any other textual representation of source code.

For example:



(+
    (* 6 3)
    (* 
        (+ 5 7) 
        (/ 2 
            (+ 7 13))))