News for hackers. Stuff that matters.
Re:6÷2(1+2)=? by latimer on Sunday March 17, 2013 @07:16PM (#5391516)
Re:6÷2(1+2)=? by d0m on Sunday March 17, 2013 @07:32PM (#5391582)
>> The issue stems from the incorrect (but often subconscious) belief that there exists a Bible of Mathematics somewhere

Well, yes, I thought so. Most mathematical expressions are pretty standard and I'm surprising that there is no a definitive answer to this question.

The way I see it is:

  6/2(1+2)
  6/2(3)
  6/2*3
  3*3
  9
If I wanted to apply 23 first, I'd write: 6/(23). Maybe I thought like that because that's how all calculators I've used work.
Re:6÷2(1+2)=? by baddox on Sunday March 17, 2013 @07:35PM (#5391592)
I am very surprised that people would evaluate the multiplication via juxtaposition after the division symbol. According to that method, 6 ÷ 2x would be evaluated as 3x, which I find extremely unlikely to be the intention of that expression.
Re:6÷2(1+2)=? by d0m on Sunday March 17, 2013 @07:39PM (#5391602)
Well, 6 ÷ 2x is similar to:

  6
  __
  2x
You've explicitly put spaces around it.

However, if you look at it like:

  6/2*x  
Does 3x seems that unlikely?
Re:6÷2(1+2)=? by baddox on Sunday March 17, 2013 @07:51PM (#5391640)
Again, my point is that my interpretation depends on whether it's multiplication via the multiplication symbol, like 6/2*x, or multiplication via juxtaposition, like 6/2x.
Re:6÷2(1+2)=? by yaakov34 on Sunday March 17, 2013 @07:25PM (#5391553)
I don't understand his idea of comparing the independence of the Continuum Hypothesis from the other axioms of set theory, which is a very deep and important result about (in essence) one of the limits of mathematical reasoning, with this little notational difficulty, which frankly is of very little interest, especially to mathematicians (you do run into this when writing parsers, sometimes...) He actually manages to say that this is "as stupid as" asking for a proof of the Continuum Hypothesis. Reminds me of people who get hung up on whether 1 is a prime number. Yes, no, maybe - people have defined it this way and that, it's a convention you can make without changing anything fundamental about mathematical reasoning.

Different systems of axioms lead to very different mathematical objects (compare Euclidean and non-Euclidean geometries). Different conventions lead to the exact same thing written slightly differently - if we say that clockwise rotation corresponds to positive change in angle (the opposite of current convention), we'll exchange plus and minus signs in a bunch of formulas, and nothing else.

Re:6÷2(1+2)=? by StevenXC on Sunday March 17, 2013 @07:39PM (#5391604)
My (intended) implication was that answering the question

> What is 6÷2(1+2)?

without establishing the axioms of arithmetic is as impossible as answering

> Does CH hold in ZF?

without establishing some axioms of set theory.

Put another way, asking 6÷2(1+2) on the SAT is as ill-advised as asking an Introduction to Proofs course to tackle the Continuum Hypothesis with just some naive set theory.

Re:6÷2(1+2)=? by yaakov34 on Sunday March 17, 2013 @07:48PM (#5391630)
Again, I think that's a very bad comparison - resolving this difficulty is not "impossible". You can choose whatever convention you like, and all that changes is the notation. Of course it's a bad test question, but it is not "impossible" or even remotely difficult for mathematics - it's just a matter of choosing a notation.

You seem to think that this question has something to do with the "axioms of arithmetic" - no, it doesn't, it's a matter of how you write things by convention. Operator precedence is not and has never been an "axiom". We can define plus to have the highest precedence, and get the exact same arithmetic we have now, written differently.

On the other hand, deciding the Continuum Hypothesis is "impossible" in a very fundamental way - Kurt Godel and Paul Cohen, two of the greatest mathematical logicians in history, proved that the Continuum Hypothesis is undecidable by mathematical reasoning as we can best formulate it, i.e. it is independent of the ZFC axioms. That's not a matter of choosing a notation for it.

Re:6÷2(1+2)=? by StevenXC on Sunday March 17, 2013 @08:43PM (#5391757)
Whether you consider the properties of arithmetic to be axioms or some other word which describes a fact assumed without proof is a matter of semantics.

The point was that without a precise foundation for mathematics we cannot proceed - anything further is overanalysis for an article I wrote mainly for folks without our mathematical background. :-)

Re:6÷2(1+2)=? by yaakov34 on Sunday March 17, 2013 @09:03PM (#5391805)
There is a fundamental difference between conventions of notation, and properties of the thing being notated, in this case arithmetic. I'm frankly surprised that someone with a mathematical background keeps mixing up the two. There are a dozen people in this thread of comments posting different notations - prefix, postfix, what have you. Do you think these define a different arithmetic? Now of course it's stupid to ask people a question without defining what you mean by your notation - you might as well mumble something and expect them to decipher it. But that is in no way equivalent to asking a question which is undecidable in mathematical logic (which is not necessarily a stupid thing to do). And features of some particular notation do not in any way, shape, or form, or by any stretch of semantics, constitute axioms, or properties, or anything else which belongs to arithmetic itself. Do you really disagree with that?
Re:6÷2(1+2)=? by grannyg00se on Sunday March 17, 2013 @07:29PM (#5391576)
(/ 6 (* 2 (+ 1 2)))

The answer is 1.

(* (/ 6 2) (+ 1 2)) would give nine but c'mon...that multiplication way over on the left came outta nowhere.

Re:6÷2(1+2)=? by mseepgood on Sunday March 17, 2013 @07:47PM (#5391624)
I prefer 6 2 1 2 + * / and 6 2 / 1 2 + * notation.
Re:6÷2(1+2)=? by armadillowarran on Sunday March 17, 2013 @07:23PM (#5391545)

  6/2(1+2)=6/2*(1+2)=6/2*3=(6/2)*3=(3)*3=9
This is pretty well defined, I feel:

- Expand implicit multiplication to explicit multiplication (e.g. 2(1+2) becomes 2*(1+2))

- Left-to-right precedence for operators of equal-precedence (divide and multiply)

The 2 is no more bound to the parenthesis than it is to the division operator.

Am I missing something?

Re:6÷2(1+2)=? by gizmo686 on Sunday March 17, 2013 @07:33PM (#5391589)
When you have 6/2(3), it is not well define if the correct expansion is 6/(23) or (6/2)3. In my experience with math, the intuitive answer is that implicit multiplication takes precedence. For example, say instead of 6/2(3), you had 6/2x. Following your convention, that would expand to (6/2)x, not 6/(2x). You might say that the () around the last number make a difference. However that would imply that 6/2x!=6/2(x). Which I find deeply unsettling if true.

Ultimitly, this is why we tend to use notation which uses placement to resolve these issues unambiguasly, without alot of parentheses.

Re:6÷2(1+2)=? by armadillowarran on Sunday March 17, 2013 @07:42PM (#5391611)
I find it interesting you feel this way.

In my experience, it is pretty well defined:

0. Evaluate (the inside of!) parenthesis, then

1. Evaluate exponentials, then

2. Evaluate division and multiplication operators, left to right

  e.g. 1 / 2 * 3 / 4 = (1/2) * 3/4 = ((1/2)*3)/4
3. Evaluate addition and subtraction operators, left to right

Your issue seems to stem from the left-to-right concept (in order in which operators are encountered as you read, left-to-right).

Your example of 6/2x to me is clearly (6/2)x. What is 1/2x ? In my experience, textbook authors/professors/math teachers tend to be disambiguous and either use the horizontal line for clarity or use parenthesis.

I attended public schools in Ontario, Canada if it makes any difference.

Edit: Oh yeah, also I have never felt that implicit operators would take precedence. Interesting!

Re:6÷2(1+2)=? by sil3ntmac on Sunday March 17, 2013 @07:23PM (#5391544)
I have never understood why you would process multiplication and division as separate reduction steps, besides for simplification in elementary-school learning materials. It seems completely arbitrary. Division is just multiplying by an inverse, and subtraction is just adding negative numbers. PEMDAS seems like something that is taught to you, and then never correctly explained.
Re:6÷2(1+2)=? by taproot on Sunday March 17, 2013 @08:08PM (#5391676)
BEDMAS (what I was taught in school) really throws some confusion in there concerning PEMDAS. Heh. We've started using PEMA in NZ to lessen confusion. I assume they go on to explain where division / subtraction went.
Re:6÷2(1+2)=? by EllaMentry on Sunday March 17, 2013 @07:51PM (#5391637)
This is not mathematics, this is symbol manipulation. The author is correct, the answer here is that it is a badly expressed problem - with multiple possible solutions depending on the assumptions the audience makes.

In mathematics allowing your audience to make assumptions is very very bad...people are terrible at making and applying assumptions - just look at any studies into eye witness testimony.

Machines are just as bad, as they are loaded with assumptions of their programmers.

As a Computer Scientist, I absolutely hate coming across badly expressed formulas. Abstraction is key - why are there parentheses around the 1+2, what makes those separate...why not just write 3?? - In fact there are no variables in this problem, it is constant, just give me the constant...or tell me why you have defined it this way.

Implicit operations and ordering may save you a couple of characters but generate essays worth of confusion.

Re:6÷2(1+2)=? by baddox on Sunday March 17, 2013 @07:18PM (#5391521)
Obviously, the author is right that there is no universal objective definition of the order of operations. Still, I find it surprising that anyone with a high school level mathematics education would perform the division via the obelus (÷) before the multiplication via juxtaposition.
Re:6÷2(1+2)=? by ulyssesgrant on Sunday March 17, 2013 @07:23PM (#5391542)
In high school (and college) I've always been taught that multiplication and division have equal precedence and should be evaluated in the order in which they are encountered.
Re:6÷2(1+2)=? by baddox on Sunday March 17, 2013 @07:27PM (#5391567)
Was multiplication by juxtaposition ever mentioned explicitly? I was taught to give them equal precedence, but that was explicitly for the division symbol and the multiplication symbol (* or x). Juxtaposition, like 2x or 2(2+1), was always considered to have greater precedence than the division and multiplication symbols.
Re:6÷2(1+2)=? by Semaphor on Monday March 18, 2013 @05:22AM (#5393199)
Nope, never heard that in my 13 years of school in Germany.
Re:6÷2(1+2)=? by sil3ntmac on Sunday March 17, 2013 @07:26PM (#5391558)
Psst... the programmers at google might have a bone to pick with you.
Re:6÷2(1+2)=? by baddox on Sunday March 17, 2013 @07:28PM (#5391570)
I strongly suspect that to be an oversight.
Re:6÷2(1+2)=? by DrJ on Sunday March 17, 2013 @07:24PM (#5391548)
also note that the author skips the multiplication operator. Especially odd (to me) since he is using parenthesis to imply multiplication and the values are not variables but values.
Re:6÷2(1+2)=? by baddox on Sunday March 17, 2013 @07:32PM (#5391587)
If the expression were 6÷2x(1+2)=?, then my intuition would be to evaluate from left to right (division before multiplication). But removing the x symbol makes me want to perform the multiplication via juxtaposition first, just like if it were 6÷2x. Would anyone really interpret 6÷2x as 3x?

note: I had to use an x instead of the asterisk to represent multiplication, since I don't know how to escape the asterisk in Markdown.

Re:6÷2(1+2)=? by naftaliharris on Sunday March 17, 2013 @07:31PM (#5391580)
> In the real world of mathematics, this is as stupid a question as me asking “Is there a mathematical size bigger than the amount of integers but less than the amount of real numbers?” [1] because you can’t answer it without going through a lot of trouble to specify the “axioms” (basic assumed rules for doing mathematics) you want used on the problem.

I don't think this analogy holds very well--a curious student could reasonably and earnestly ask about the continuum hypothesis, since it's not at all obvious from first principles that the answer depends so heavily on obscure set axioms. On the other hand, the order of operations question seems to have been designed to confuse people and stir up meaningless, unresolvable arguments over PEMDAS.

Re:6÷2(1+2)=? by Zenst on Sunday March 17, 2013 @07:32PM (#5391585)
Computers will conclude the answer is 1 as they will prioritise the multiply.

Now us humans will get 9 as they will do the 6/2 and then multiply the result with the (1+2) for 3x3.

Now given the multiply is implied and computers like to have that symbol in many languages and the divide sign as again a form not overly used in programming languages, then it is clearly expressed in a form for human consumption. With that we imply the 6 divided by 2 is in its own bracket and will think it is 9, then we will think again if we know computers and then think 1.

Moral being whilst lots of brackets and braces can look untidy, they do clarify beyond doubt.

Re:6÷2(1+2)=? by andrewmunsell on Sunday March 17, 2013 @07:37PM (#5391595)
No, they won't. Computers will compute it as nine because they evaluate the parenthesis, then go left to right.

6 / 2 (1 + 2)

6 / 2 * 3

3 * 3

9

Re:6÷2(1+2)=? by ColinWright on Sunday March 17, 2013 @07:10PM (#5391498)
I blogged about this nearly two years ago:

http://www.solipsys.co.uk/new/AMatterOfConvention.html?HN

Re:6÷2(1+2)=? by StevenXC on Sunday March 17, 2013 @07:19PM (#5391523)
Yeah, tale as old as time, right? It's making the rounds on social media currently, so I thought it was relevant.

I agree with your interpretation FTA:

> DON'T DO THIS!

> It's ambiguous, and should not be written like this because it leads to problems.

Re:6÷2(1+2)=? by ari_elle on Sunday March 17, 2013 @07:17PM (#5391518)
Nice, i would have said 9 just because that's how C interprets it.

float x = 6 / 2 * (2 + 1); // x == 9

Re:6÷2(1+2)=? by beatgammit on Sunday March 17, 2013 @07:50PM (#5391633)
Right, but you also had to explicitly add the asterisk for multiplication. I thought the same thing, but the remarks on juxtaposition do have a point. For example, if an integer were callable, you'd do the function call--2(2+1)--independantly of the division.
Re:6÷2(1+2)=? by lucb1e on Sunday March 17, 2013 @07:32PM (#5391584)
The title (on his website) contains the wrong formula. I've skimmed the post a few times, wondering why the correct answer wasn't twelve... Then I saw it :/
Re:6÷2(1+2)=? by brodney on Sunday March 17, 2013 @07:09PM (#5391497)
Is it 1+3 or 1+2? Title does not match content.
Re:6÷2(1+2)=? by StevenXC on Sunday March 17, 2013 @07:13PM (#5391511)
Thanks for the catch!
Re:6÷2(1+2)=? by rubbingalcohol on Sunday March 17, 2013 @07:24PM (#5391546)
It's funny because in other interpretations the "%" symbol evaluates to the modulus operator and this brings up another possible result. 6 mod 2(1+2) = 6 mod 6 ~= 0 mod 6
Re:6÷2(1+2)=? by Aloisius on Sunday March 17, 2013 @07:18PM (#5391520)
Wouldn't it have been easier to just express this question as 6/2*3? The addition part doesn't seem to add anything to the point of the article (no pun intended).
Re:6÷2(1+2)=? by StevenXC on Sunday March 17, 2013 @07:22PM (#5391537)
The question is taken from a Facebook post making the rounds. The parentheses are important however, as they introduce a new ambiguity: does the implied multiplication from the open parenthesis trump the division symbol on the left?

Put another way, does it fall into the Parentheses section or the Multiplication section of the PEMDAS order of operations? (Or whatever mnemonic your country uses.)

Re:6÷2(1+2)=? by Aloisius on Sunday March 17, 2013 @11:51PM (#5392330)
Why would the multiplication fall in the parenthesis section when it clearly isn't in a set of parenthesis? 6÷2(1+2) expands to 6÷2*(1+2). The items inside the parenthesis first and there should be no ambiguity about that.
Re:6÷2(1+2)=? by poindontcare on Sunday March 17, 2013 @07:22PM (#5391534)
Re:6÷2(1+2)=? by Samuel_Michon on Sunday March 17, 2013 @07:25PM (#5391554)
I think you meant: http://www.wolframalpha.com/input/?i=6%C3%B72%281%2B2%29

But that's just how WolframAlpha does it. The article is about the ambiguity in the mnemonic we're taught in school. I thought the correct answer was going to be '1'.

Re:6÷2(1+2)=? by andrewmunsell on Sunday March 17, 2013 @07:24PM (#5391547)
Rather:

http://www.wolframalpha.com/input/?i=6%C3%B72%281%2B2%29

Of course, this is because it's evaluated left to right and the implied multiplication doesn't get put "under" the division.

Re:6÷2(1+2)=? by ibotty on Monday March 18, 2013 @05:17AM (#5393179)
just as a data point:

as google, wolfram alpha (a mathematica "frontend") interprets it as (6/2)*(1+2).

https://www.wolframalpha.com/input/?i=6÷2(1+2)&dataset=

(and even with a variable juxtapositioned it's interpreted like that.)

but right, that's no real metric for mathematical use. (i still think the result is 1.)

Re:6÷2(1+2)=? by Datsundere on Sunday March 17, 2013 @07:28PM (#5391571)
It's one. He himself said parenthesis takes precedence. So:

6 / 2(3) <== Parenthesis still there

6 / 6

1

Re:6÷2(1+2)=? by taproot on Sunday March 17, 2013 @08:13PM (#5391690)
wooosh

--

It's 9, you've added some invisible brackets in there.

6 / 2 * (1 + 2)

6 / 2 * 3

3 * 3

9

Re:6÷2(1+2)=? by Kaivo on Sunday March 17, 2013 @07:26PM (#5391556)
When converting it from infix to postfix, it returns 6 2 / 1 2 + * which returns 9. I prefer this point of view.
Re:6÷2(1+2)=? by braum on Sunday March 17, 2013 @07:20PM (#5391525)
I was taught to handle parenthesis first before multiplication or division so the answer is clear to me to be 1.
Re:6÷2(1+2)=? by andrewmunsell on Sunday March 17, 2013 @07:28PM (#5391568)
Well, is the implied multiplication technically part of the parenthesis, though? I've always been taught the stuff inside the parenthesis takes precedence, but outside is irrelevant because it's not technically "part" of the parenthesis statement.

It's like how programming works:

6 / 2 * add(1, 2)

This would obviously evaluate to 9, because the "add" function would simply return a value and the rest of the statement would be evaluated from left to right. In this case, the first 2 is not related to the "add" function in any way.

Re:6÷2(1+2)=? by robryan on Sunday March 17, 2013 @07:24PM (#5391549)
You handle the contents of the parenthesis first. 2(3) is just shorthand for 2*3 so you would handle the division and multiplication in the order given.
Re:6÷2(1+2)=? by s800 on Sunday March 17, 2013 @07:11PM (#5391505)
That "divide-by" symbol can suck my left nut.
Re:6÷2(1+2)=? by montogeek on Sunday March 17, 2013 @07:53PM (#5391646)
1
Re:6÷2(1+2)=? by drivebyacct2 on Sunday March 17, 2013 @07:25PM (#5391550)
The way you know this question is dumb? It was written by someone who either doesn't understand how to write math to be readable, or was written by a troll. The use of that division sign, ironically, doesn't make it any easier to determine, although there's surely a subset of FB idiots (the same that would waste time on this in the first place) that wouldn't understand it written as 6/2(1+2).
Re:6÷2(1+2)=? by d0m on Sunday March 17, 2013 @07:36PM (#5391593)
You wasted time on this by writing this comment.. not sure why you're discriminating others as idiots.
Re:6÷2(1+2)=? by drivebyacct2 on Sunday March 17, 2013 @08:03PM (#5391669)
I'm 96% sure you missed the point of my post.