multiplication by juxtaposition and order of operations

Discussion in 'Debates' started by perkeyone, May 4, 2011.

  1. perkeyone

    perkeyone something clever

    Ratings:
    +71 / 0 / -0
    recently, as many of you may already know, several facebook polls have been created featuring ambiguously written equations, such as this one...
    [​IMG]
    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...
    [​IMG]
    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.
    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.
    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.
     
    • Like Like x 1
  2. phyrex1an

    phyrex1an Staff Member and irregular helper Staff Member

    Ratings:
    +446 / 0 / -0
    > 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 ;
     
  3. perkeyone

    perkeyone something clever

    Ratings:
    +71 / 0 / -0
    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.

    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)

    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
    its been a while since i used bnf, let me try to absorb this...
     
  4. tom_mai78101

    tom_mai78101 The Helper Connoisseur / Ex-MineCraft Host Staff Member

    Ratings:
    +957 / 4 / -1
    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?
     
  5. Zakyath

    Zakyath Member

    Ratings:
    +238 / 0 / -0
    I haven't read any math in years, but I'm pretty sure you can't count like that. 2(1+2) = 2+4 (2*1+2*2). You got the same result, but it still looks wrong ...
     
  6. perkeyone

    perkeyone something clever

    Ratings:
    +71 / 0 / -0
    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.
     
  7. Zakyath

    Zakyath Member

    Ratings:
    +238 / 0 / -0
    Didn't know you could do it like that... tried with some other numbers and it seems as I was wrong :p
     
  8. Ioannes

    Ioannes Oh man, I shot Marvin in the face.

    Ratings:
    +50 / 0 / -0
    << 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:
    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
     
    • Agree Agree x 1
  9. perkeyone

    perkeyone something clever

    Ratings:
    +71 / 0 / -0
    @ioannes
    what would you say is the answer to this then?
    Code:
    2y/2y=?
     
  10. UndeadDragon

    UndeadDragon Super Moderator Staff Member

    Ratings:
    +450 / 0 / -0
    1. Anything divided by itself is 1.
     
  11. Ioannes

    Ioannes Oh man, I shot Marvin in the face.

    Ratings:
    +50 / 0 / -0
    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.
     
  12. tom_mai78101

    tom_mai78101 The Helper Connoisseur / Ex-MineCraft Host Staff Member

    Ratings:
    +957 / 4 / -1
    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.
     
  13. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    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.
     
  14. Darthfett

    Darthfett Super Mod

    Ratings:
    +612 / 0 / -0
    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
     
  15. Samael88

    Samael88 Evil always finds a way

    Ratings:
    +181 / 0 / -0
    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.
     
  16. Ioannes

    Ioannes Oh man, I shot Marvin in the face.

    Ratings:
    +50 / 0 / -0
    I sure hope this is trolling
     
  17. Samael88

    Samael88 Evil always finds a way

    Ratings:
    +181 / 0 / -0
    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.
     
  18. UndeadDragon

    UndeadDragon Super Moderator Staff Member

    Ratings:
    +450 / 0 / -0
    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.
     
  19. Xienoph

    Xienoph You can change this now in User CP.

    Ratings:
    +43 / 0 / -0
    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
     
  20. Samael88

    Samael88 Evil always finds a way

    Ratings:
    +181 / 0 / -0
    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.
     

Share This Page