RSS

Epic Math: The Precedence of Operators

The Problem

On Facebook and the rest of the Internet millions of people are arguing about the result of this expression:

Depending on the precedence the valid results could be "1" or "9". But because I am no mathematician I would like to present another elegant solution to this problem. Using this solution we can avoid the question about how precedence is defined.

Solution

As the author of the original question has omitted the multiplication dot between the "2" and "(", we can interpret this situation in two ways:

  1. The omitted multiplication dot counts and we have to do the multiplications or
  2. We assume another case in which a symbol is followed by parenthesis: The symbol "2" represents a function.

As the first option is already discussed widely on the Internet we will take a look at the second option: What if "2" is a function of x. Let us assume for the sake of simplicity "2" is a constant function of the form

Thus the problem of precedences has been avoided, but another problem arises: There is another symbol "2" in the argument of the function 2!

This is trivially solved. This symbol "2" stands alone and is not followed by values in parantheses. Therefore it is not the function "2" but the numeral 2.

Now we can evaluate the value of 2(1+2), which is 2. Therefore the expression is equal to 3.

Conclusion

The correct result is -- of course -- 9 as the left operator has precedence, but taking an unexpected loophole is much more fun :-P