multiplication by juxtaposition and order of operations

perkeyone

something clever
im moving this to the beginning of the post said:
my question to you all is...

since this method of representing multiplication can be ambiguous, what changes, if any, do you think could be made to either the syntax of multiplication or (the wording of) the order of operations to avoid said ambiguity.

i am not asking whether you think the answer is 1 or 9. i am not asking for your math professor's expert opinion. i am asking for a set of rules for which such an equation would have only one valid interpretation.
recently, as many of you may already know, several facebook polls have been created featuring ambiguously written equations, such as this one...

upon seeing this question, my first reaction was that there couldnt possibly be that many dumb people... i took a moment to calculate it in my head and found that i had a distinct urge to group the 2 with the parentheses (which would yield an answer of 1) but after some consideration i felt that my urge went against order of operations. i tried to verify my answer...
6÷2(1+2) - Wolfram|Alpha said:
http://www.wolframalpha.com/input/?i=6÷2(1+2)

mathematica plaintext input: (6/2) (1 + 2)

mathematica plaintext output: 9
6÷2(1+2) - Google Search said:
http://www.google.com/search?client...bih=685&q=6%F72%281%2B2%29&btnG=Google+Search
(6 ÷ 2) * (1 + 2) = 9
More about calculator.
Search for documents containing the terms 6÷2(1+2).

in two of these cases, the implied multiply was replaced by a multiplication symbol and in the other, a new set of parentheses was added. i was unsure whether this had any effect on the result and judging by how divided the answers on facebook were i decided to research the issue a bit. my first stop, of course was wikipedia.
Multiplication - Wikipedia said:
http://en.wikipedia.org/wiki/Multiplication#Notation_and_terminology
In algebra, multiplication involving variables is often written as a juxtaposition (e.g. xy for x times y or 5x for five times x). This notation can also be used for quantities that are surrounded by parentheses (e.g. 5(2) or (5)(2) for five times two).
wikipedia didnt seem to explicitly describe any change in operator precedence for this case, so i decided to keep looking. using the term "multiplication by juxtaposition" from the wiki article, a google search yielded several threads about this same topic. these were two of the sources they cited.
The Order of Operations: More Examples said:
http://www.purplemath.com/modules/orderops2.htm
This next example displays an issue that almost never arises but, when it does, there seems to be no end to the arguing.
Code:
    * Simplify 16 ÷ 2[8 – 3(4 – 2)] + 1.

            16 ÷ 2[8 – 3(4 – 2)] + 1
                = 16 ÷ 2[8 – 3(2)] + 1
                = 16 ÷ 2[8 – 6] + 1
                = 16 ÷ 2[2] + 1   (**)
                = 16 ÷ 4 + 1
                = 4 + 1
                = 5
The confusing part in the above calculation is how "16 divided by 2[2] + 1" (in the line marked with the double-star) becomes "16 divided by 4 + 1", instead of "8 times by 2 + 1". That's because, even though multiplication and division are at the same level (so the left-to-right rule should apply), parentheses outrank division, so the first 2 goes with the [2], rather than with the "16 divided by". That is, multiplication that is indicated by placement against parentheses (or brackets, etc) is "stronger" than "regular" multiplication. Typesetting the entire problem in a graphing calculator verifies this hierarchy:



Note that different software will process this differently; even different models of Texas Instruments graphing calculators will process this differently. In cases of ambiguity, be very careful of your parentheses, and make your meaning clear. The general consensus among math people is that "multiplication by juxtaposition" (that is, multiplying by just putting things next to each other, rather than using the "×" sign) indicates that the juxtaposed values must be multiplied together before processing other operations. But not all software is programmed this way, and sometimes teachers view things differently. If in doubt, ask!

(And please do not send me an e-mail either asking for or else proffering a definitive verdict on this issue. As far as I know, there is no such final verdict. And telling me to do this your way will not solve the issue!)
Math Forum - Ask Dr. Math said:
http://mathforum.org/library/drmath/view/57021.html
...that "multiplication indicated by juxtaposition is carried out before
division." Thus, in general, for any variables a, b and c, we would
have a/bc = a/(bc) (assuming, of course, that b and c are nonzero).
Indeed, this convention is consistent with what I have seen in many
mathematical books at various levels; for example, on p. 84 of
Allendoerfer and Oakley, _Principles of Mathematics_, 1969 (my
pre-college math book), we find:

(a / b) x (c / d) = a c / b d

which is generally true only if the right side is interpreted as:

(a c) / (b d)

Notably, the above equality would *not* be generally true were we to
interpret the right side as:

[(a c) / b] d

per the first Web page above (and many others), which states that one
should "do multiplication and division as they come." However, perhaps
this page is tacitly ignoring "implicit multiplication" (by
juxtaposition) and only considering "explicit multiplication" (via
some multiplication sign) - a distinction is made at:

Order of Operations - Dr. Math Archives
http://mathforum.org/dr.math/problems/wuandheil.05.19.99.html
so, all i really managed to find out, is that not everyone agrees on this issue.
as a computer science major, i know that having only one valid interpretation of an expression is very important in my field, particularly when designing a compiler.

my question to you all is...

since this method of representing multiplication can be ambiguous, what changes, if any, do you think could be made to either the syntax of multiplication or (the wording of) the order of operations to avoid said ambiguity.

i am not asking whether you think the answer is 1 or 9. i am not asking for your math professor's expert opinion. i am asking for a set of rules for which such an equation would have only one valid interpretation.
 

phyrex1an

Staff Member and irregular helper
Staff member
> i am asking for a set of rules for which such an equation would have only one valid interpretation.
Um, didn't you just answer that in your own post? Either you say that "multiplication by juxtaposition" binds in the same way as multiplication, this gives you no ambiguities, or you say that it binds harder than both multiplication and division (and probably to the left like they do) which doesn't give any ambiguities either.
The ambiguities arise because some people use the first way and others the second thus using different rules to parse the same string, of course you get different results then...
If you want to solve the ambiguities by changing the syntax then just remove juxtaposition.

Here is the bnfc for the case of juxtaposition binding in the same way as multiplication (no ambiguities in the grammar ofc):
Code:
entrypoints Exp ;

EAdd. Exp ::= Exp "+" Exp1 ;
ESub. Exp ::= Exp "-" Exp1 ;
EMul. Exp1 ::= Exp1 "*" Exp2 ;
EDiv. Exp1 ::= Exp1 "/" Exp2 ;
EJux. Exp1 ::= Exp1 "(" Exp ")" ;
EInt. Exp2 ::= Integer ;
coercions Exp 3 ;
 

perkeyone

something clever
Um, didn't you just answer that in your own post?
im sorry i didnt mean to make it seem as if i had found an answer.
i meant for the last 2 quotes to be support for the "jux-first" thinkers.

Either you say that "multiplication by juxtaposition" binds in the same way as multiplication, this gives you no ambiguities, or you say that it binds harder than both multiplication and division (and probably to the left like they do) which doesn't give any ambiguities either.
The ambiguities arise because some people use the first way and others the second thus using different rules to parse the same string, of course you get different results then...
right, so... if someone were rewrite the mnemonic for order of operations
(PEMDAS where i live but slightly different in other parts of the world),
would it be sufficient to just add a "j" before the "m"?
(that would make it look kinda like the word "pajamas" lol)
or would there still be some exception to the rule?
(i cant think of any at the moment)

If you want to solve the ambiguities by changing the syntax then just remove juxtaposition.
while i agree that eliminating juxtaposition would also eliminate the ambiguity that it creates, i find it extremely useful in an expression such as...
Code:
4x/4x // =1 (calculating jux before mult/div)
if jux. was eliminated you would be forced to write it out
Code:
(4*x)/(4*x) // =1
4*x/4*x // =x^2
Here is the bnfc for the case of juxtaposition binding in the same way as multiplication (no ambiguities in the grammar ofc):
Code:
entrypoints Exp ;

EAdd. Exp ::= Exp "+" Exp1 ;
ESub. Exp ::= Exp "-" Exp1 ;
EMul. Exp1 ::= Exp1 "*" Exp2 ;
EDiv. Exp1 ::= Exp1 "/" Exp2 ;
EJux. Exp1 ::= Exp1 "(" Exp ")" ;
EInt. Exp2 ::= Integer ;
coercions Exp 3 ;
its been a while since i used bnf, let me try to absorb this...
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
This is my opinion:

In mathematical perspective, we look at formulae from top to bottom, directly straight towards the paper. From there, we are able to see obvious precedences in them. So, we see:

6/2(1+2) = 6/(2*3) = 6/6 = 1.

However, computers and machines, especially in the programming languages of C, C++, PHP, Javascript, and Java, computing math formulae starts with the equal sign, which is left-associate, but not all programming languages are like that. I only meant the majority of machines uses these languages. That means, they compute math formulae from the left.

Let's say the machines/computers I've mentioned above are left-handed parsers (they read strings/literals from the left). So, if machines were parsing this math formulae, we would see like this output:

6/2(1+2) = (6/2)(1+2) = 3 * 3 = 9.

It doesn't say that we can't trust machines/computers to do math for us. It's just how parsing and precedences affect the decisions made within their ALU.

If you're a detective, using deductive reasoning, we could say that about 2 million voters rely on machines to do their calculations, and the lesser 1 million voters do the calculations in their heads without using the machines to check their answers.

That implies that in this era, too many people rely on technology to do the work for themselves.

EDIT:

Also, isn't Texas Instruments calculators made with FORTRAN? And don't FORTRAN parse math formulae from right to left? Or was that COBOL or Ada?
 

perkeyone

something clever
It's just how parsing and precedences affect the decisions made within their ALU.
from researching the issue i found that different calculators get different answers.
casios usually get the answer 1, and ti calculators can get both 1 and 9 depending on the model.
(many calculators wont allow you to make the formula that way)
they have different rules of precedence

@zakyath
he added the 1 and 2, then moved the other 2 inside the parentheses.



----might edit later.
 

Ioannes

Oh man, I shot Marvin in the face.
<< What high school logic telsl me >>

9

Because 6/2*(1+2) is 6/2*3 and the operations are now completed from left to right.

Also, I don't think some of the sources above are correct. :)

http://www.purplemath.com/modules/orderops2.htm, for example,
The confusing part in the above calculation is how "16 divided by 2[2] + 1" (in the line marked with the double-star) becomes "16 divided by 4 + 1", instead of "8 times by 2 + 1". That's because, even though multiplication and division are at the same level (so the left-to-right rule should apply), parentheses outrank division, so the first 2 goes with the [2], rather than with the "16 divided by". That is, multiplication that is indicated by placement against parentheses (or brackets, etc) is "stronger" than "regular" multiplication.

And why exactly does the [2] have to not go with the Left-to-right principle and be any special? There's no operation in these brackets that it is in, just the digit 2 - so there is no prioritizing. Moreover, why are Purplemath even keeping the brackets - by all means they should omit them once they have done all the operations and gotten a [2]. And, to reiterate (no pun intended), all the operations remaining are outside these alien brackets and, hence, subject to the Left-to-right principle. ;)


As for the Dr. Math link,
"multiplication indicated by juxtaposition is carried out before
division." Thus, in general, for any variables a, b and c, we would
have a/bc = a/(bc) (assuming, of course, that b and c are nonzero)


:thdown:
This is the first time in my life that I see anyone making a difference between multiplication indicated by juxtaposition and the supposed any other sort of multiplication. Apparently, the American Mathematical Society that he quotes make a difference and in their order of operations we have

1. Parentheses
2. Exponents
3. Multiplication by juxtaposition
4. Multiplication and division from left to right
5. Addition and subtraction
:nuts:
However, there is no reason to prioritize "multiplication by juxtaposition" (or even consider it a special kind of operation) that I know of. Not when I studied math. :rolleyes:



I really can't think of any example where there is a real contradiction that the existing rules of math don't resolve, not in the high-school math that I know of anyways. Let me modify one of Dr. Math's examples:
Code:
his approach also makes practical sense, since it frequently happens 
that one has a series of multiplications divided by another series of 
multiplications (e.g., consider a binomial coefficient); for example, 
one might desire to write the fraction:

     5 x 4 x 3
     ---------
       2 x 3

more compactly (and without parentheses) as:

     5 x 4 x 3 / 2 x 3

especially if this is to be written in-line (i.e., *within* the 
surrounding text) rather than separately displayed as above.
In the two cases you seem to get different results. Well, I'm sorry, but you are wrong, because your in-line representation is incorrect: it has to be

Code:
 ( 5 x 4 x 3 ) / ( 2 x 3 )
instead of just

Code:
     5 x 4 x 3 / 2 x 3
Why? Because the fraction line in the fraction-representation indicates that the top half (the numerator) is divided not simply by 2 but by 2x3. Therefore, the correct in-line notation is ( 5 x 4 x 3 ) / ( 2 x 3 ).
:cool:
Code:
     5 x 4 x 3 / 2 x 3 is actually a totally different fraction. It is:

        5 x 4 x 3  
      ------------ x 3
             2


P.s.
Ah, the guys on Physicsforums have also encountered this:

http://www.physicsforums.com/showthread.php?t=494675
 

Ioannes

Oh man, I shot Marvin in the face.
@ioannes
what would you say is the answer to this then?
Code:
2y/2y=?
I suppose you think 2y/2y is the fraction
Code:
2 x y
------
2 x y
, don't you?
:rolleyes:
It probably is, and the correct answer is, indeed, 1. And if we do it how I'm arguing we'll get
Code:
[ 2 x y ] / 2 x y =
= [ 2y / 2 ] x y=
= y x y = 
= y^2

However, I still think I'm right - the reason for that is that 2y/2y is an incorrect way to represent the fraction
Code:
2 x y                                                                           2 x y
------           what you are really writing up there is a different fraction: -------- x y
2 x y                                                                             2

If you want to write that fraction in-line it ought to be [2y]/[2y]. I know people omit those brackets because it's more convenient, but this practice is illogical and erroneous and wrong.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
What is truly important, is how we should get the message out there in a correctly formatted definition, or use a de-facto standard that all people use and communicate in a concise and correct way.

I would actually give out $100,000 grand prize for those who can solve the most ambiguous math problems in the world, just by relying on multiplication by juxtaposition and other operators. And making sure there are 4 answers that's all possibly correct in terms of calculating / computing / solving / guessing.
 

tooltiperror

Super Moderator
Staff member
PEMDAS is so misleading, because after parenthesis you still have to do other grouping.

Code:
6/2(1+2) =

     6       
----------
  2(1+2)

     6
----------
     6
Six sixths are one. Five fifths are one. One whole is one.
 

Darthfett

Super Mod
An expression like 1/2x is interpreted as 1/(2x) by TI-82, but as (1/2)x by TI-83.[2] While the first interpretation may be expected by some users, only the latter is in agreement with the standard rules stated above.
http://en.wikipedia.org/wiki/Order_of_operations

Standard rules say you can't just do whatever you like if you have the same precedence, they say go from left to right. Thus, 2y/2y = y^2.

If you want clarification, turn all divisions from the form a / b into the form a * (1/b). 2y/2y in that form = 2 * y * (1/2) * y
 

Samael88

Evil always finds a way
6/2(1+2)
6/(2+3)
6/6=1

That is how I calculate it, that is how I have learned math and that is how I do to get the correct answer on most of the problems that comes up in the book.
1. Multiply into the brackets.
2. Calculate the brackets.
3. Divide.

I can't see how this can turn into a debate?

I can however see how schools around the world has failed since there are 2,1Million people out there that does not know their math priorities.
 

Ioannes

Oh man, I shot Marvin in the face.
6/2(1+2)
6/(2+3)
6/6=1

That is how I calculate it, that is how I have learned math and that is how I do to get the correct answer on most of the problems that comes up in the book.
1. Multiply into the brackets.
2. Calculate the brackets.
3. Divide.

I can't see how this can turn into a debate?

I can however see how schools around the world has failed since there are 2,1Million people out there that does not know their math priorities.
I sure hope this is trolling
 

Samael88

Evil always finds a way
Nah, It was meant like the real deal.
However I just realized that I was wrong in my post, it is supposed to be like this:
6/2(1+2)
6/2(3)
6/(6) = 1
My mistake, but now it should be correct.
 

UndeadDragon

Super Moderator
Staff member
I agree with Samael. I was taught that way (brackets, indicies, dividing, multiplying, addition, subtraction) and it is how maths works. I don't really see the debate, as there can only be one answer.
 

Xienoph

You can change this now in User CP.
Nah, It was meant like the real deal.
However I just realized that I was wrong in my post, it is supposed to be like this:
6/2(1+2)
6/2(3)
6/(6) = 1
My mistake, but now it should be correct.
Ioannes does the explaining much better than I can (also, his Wiki link has the answer), so I'll just reiterate.

I think the spaces between the digits and the operators introduce grouping bias. So I'll post my reply in monospace.

Code:
Then what is 6 / 2 * 3?
I guess the debate here is whether 2 ( 3 ) is the same as 2 * 3. I.e: 6 / 2 ( 3 ) =? 6 / 2 * 3

I was taught that 2 ( 3 ) is a shorthand for 2 * 3. So the answer according to that teaching is:
6 / 2 * ( 1 + 2 )
= 6 / 2 * 3
= 3 * 3
= 9

Going back to the OP's question, prefix notation should solve this ambiguity:
6 / ( 2 * 3 ) = / 6 * 2 3
( 6 / 2 ) * 3 = * / 6 2 3
 

Samael88

Evil always finds a way
Xienoph, you are correct so far so that it is "2 * 3", but then you are doing the dividing before your multiplying which is a big no.
It is always multiplication before dividing! And most certainly in this case since you have this:
Code:
2 ( 3 ) they belong together, you can't just take away the two and divide it with the other crap.
the two has to be multiplied into the parenthesis before you can remove it, thus making it like this:
6 / 2 * ( 1 + 2 )
= 6 / 2 * ( 3 )
= 6 / 6
= 1

Do you see it? You can't just remove the parenthesis without putting the number two there. Even my damn calculator did not get it and it was really damn expensive, that is probably what is so funny with the equation to begin with, the fact that all calculators get it wrong I mean.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • C Cherry.Grove:
    My one game was basically Among Us but you sabotaged an entire medieval city simulated drastically inefficiently with dynamic NPCs :S
  • C Cherry.Grove:
    of course I never finished it x D
  • jonas jonas:
    xD
  • jonas jonas:
    I think you can still run the original game, just there's a chance your map won't work with the newer patches
  • jonas jonas:
    what development framework have you been looking at for mobile development?
  • jonas jonas:
    I'm currently creating (as a hobby) a space invaders like game for mobile using Xamarin, after starting a few larger projects that I also may not have finished :rolleyes::p
  • The Helper The Helper:
    Awesome! you should look at the Atari VCS platform it does not have a huge user base but the one it has is super active at around 11k and they have no games in there store
  • The Helper The Helper:
    basically it is linux
  • The Helper The Helper:
    OMG it is BanLord as Blackveiled on the forum
  • The Helper The Helper:
    what is up buddy
  • jonas jonas:
    thanks for the tip, that sounds cool. Never heard about the VCS before but seems like it should be a good match
  • tom_mai78101 tom_mai78101:
    The winter vacation left a toll on me. I missed staying up late and sleeping in late.
  • C Cherry.Grove:
    i haven't looked into it yet
  • C Cherry.Grove:
    If I could use something Python compatible it would save me some learning
  • C Cherry.Grove:
    But Unity might be easiest
  • C Cherry.Grove:
    looking at old posts here makes me happy. Makes me be all like "wow I was pretty smart in 2009"
  • C Cherry.Grove:
    mostly failing at life through adulthood really demotivated me for a while
  • C Cherry.Grove:
    ....what I don't get is why the fuck they would force us to permanently convert to a version of the game everyone fucking hated : \
  • C Cherry.Grove:
    Raid Shadow Legends texture pack smh
  • jonas jonas:
    Most people fail at life throughout their adulthood. Sometimes we get to learn from it. Usually it just feels like crap.
    +1
  • The Helper The Helper:
    What does not kill you makes you stronger is what they say
  • C Cherry.Grove:
    for real! :cool:
  • Varine Varine:
    Are we still on the topic of failing? I failed lots!
  • jonas jonas:
    If you ever want to talk about it we're here. The way I see it, you're still around. That required a few very difficult successes if you ask me:)

    Staff online

    Members online

    Affiliates

    Hive Workshop NUON Dome
    Top