1
$\begingroup$

Possible Duplicate:
What is 48÷2(9+3)?

Sorry if this has already been asked, my searches were fruitless...

There's been a buzz lately about the different results given by two different Casio brand calculators for the same expression. It would seem that there's debate on this issue.

The expression is thus:

6 ${\div}$ 2 (1 + 2)

It would appear that the debate is between the scope of the division operator in the equation. Now, as a software developer, I'm accustomed to well-defined operator precedence. The compiler knows exactly in what order terms will be evaluated. Thus, above, the answer is 9.

However, it would appear that the two calculators differ because there's debate about that division operator regarding whether it divides the entire expression or only the first two terms. Rather, is it:

(6 ${\div}$ 2) (1 + 2)

or is it:

(6) ${\div}$ (2 (1 + 2))

Is there an official answer regarding the operator precedence for mathematics in general, outside the realm of computer programming and compilers?

  • 0
    A calculator that interpreted it in the second way would drive me up the wall. (Then again, I’m not really happy with any non-RPN calculator.) I don’t recommend using the expression, simply the left-to-right convention for operations at the same level of precedence **isn’t** as general as it ought to be, but I do consider the second interpretation genuinely incorrect in the absence of a stated convention allowing it.2012-03-30

2 Answers 2

3

Essentially you are asking for evaluation of the expression $6/2*3$ - whether it is understood as $6/(2*3) = 1$ or $(6/2)*3 = 9$.

In my understanding, it's a question of the order of operations. The first way of interpretation [i.e. $6/(2*3)$] assumes a silent insertion of the brackets. I do not understand why one would be allowed to make such assumptions -- after all, the parentheses were not specified in the original problem, what right does one have to insert them there?

An equivalent question would be if to evaluate $6-2+3$ one uses $6-(2+3)$ or $(6-2)+3$, with the first way being clearly strange - when inserting brackets we normally would factor out $-1$ to transform to $6-(2-3)$, same answer as $(6-2)+3$.

So in short, we go left to right, not right to left.

Edit: grammar and expressions

2

Of course, the "real" answer to this question is that we should just specify and agree upon an order of operations once and for all, and not use ambiguous notation....

But in terms of how we interpret these expressions in practice, I disagree with gt6989b's answer. gt wrote $6/2*3$, which I would certainly interpret as $(6/2)*3$. But the original statement was $6\div 2(1+2)$, which I would interpret as $6\div\{2(1+2)\}$.

My theory as to why I would interpret these in "different" ways is that the symbols and their associated spacings are different. In $6/2*3$, I literally see $6/2$ as being more tightly bound then $2*3$ (because of the spacing); if I were writing the expression I would definitely not use $6/2*3$ if I meant $6/(2*3)$. On the other hand, in $6\div 2(1+2)$, I see $2(1+2)$ as being more tightly bound than $6\div 2$; I would definitely not use $6\div 2(1+2)$ if I meant $(6\div 2)(1+2)$.

Similarly, I automatically read $\log 2x$ as $\log(2x)$ and not $(\log 2)x$; I read $\sin \pi/2$ as $\sin(\pi/2)$ and not $(\sin \pi)/2$.

To be clear, I'm reporting my instinctive reactions to these expressions and then trying to theorize why I react that way; I'm not suggesting that we prescribe order of operations as a function of spacing.