How’d They Calculate That?

News Brief by Kip Hansen

 

featured_image_how_countThere are two recent stories in the NY Times that bring up a curious seemingly inconsequential oddity of mathematical computing.  They are both written by Steven Strogatz in time order they were: “The Math Equation That Tried to Stump the Internet” and then, two days later, “That Vexing Math Equation? Here’s an Addition”.  Steven Strogatz is a professor of mathematics at Cornell and the author of “Infinite Powers: How Calculus Reveals the Secrets of the Universe.

So what’s this all about?  A Tweet — that’s right — a Tweet on what Strogatz calls “Mathematical Twitter”. The tweet was this:

oomfies solve this

problem

— em ♥︎ (@pjmdolI) July 28, 2019

 

That’s easy!  The correct answer is:

16or1

Yes, that’s right, the correct answer is either 16 or 1, depending on an interesting point of mathematics. The featured image gives us some insight into what’s going on here.   Strogatz explains it this way:

“The question above has a clear and definite answer, provided we all agree to play by the same rules governing “the order of operations.” When, as in this case, we are faced with several mathematical operations to perform — to evaluate expressions in parentheses, carry out multiplications or divisions, or do additions or subtractions — the order in which we do them can make a huge difference.”

 When we resort to our handy electronic scientific calculators, we find that my answer is absolutely right!

dueling_calculators

(This image was supplied by a twitter participant…see the twitter thread).

The Texas Instruments TI-84Plus C returns an answer of “16” while our Casio fx-115MS returns “1”.

A quick survey of online scientific calculators returns mixed results as well:

also_equals_16

equals_one

And maybe a bit more accurate:

equals_error

Math guys and gals know that the problem is order of operations and there are conventions for which operations come first, second, third and so on.  In high school we learn the convention as one of the following (depending on where you went to school):

BODMAS is an acronym and it stands for Bracket, Of, Division, Multiplication, Addition and Subtraction. In certain regions, PEDMAS (Parentheses, Exponents, Division, Multiplication, Addition and Subtraction) is the synonym of BODMAS.

PEMDAS is an acronym for the words parenthesis, exponents, multiplication, division, addition, subtraction. Given two or more operations in a single expression, the order of the letters in PEMDAS tells you what to calculate first, second, third and so on, until the calculation is complete. If there are grouping symbols in the expression, PEMDAS tells you to calculate within the grouping symbols  first.

Strogatz  says:  “Strict adherence to this elementary PEMDAS convention, I argued, leads to only one answer: 16.”   Ah, but his editor ( and a slew of readers ) “…strenuously insisted the right answer was 1.”

To get Strogatz’s “16” one has to do this:  8/2 = 4  then do 4 x (2+2) or 4 x 4 = 16.

How to get “1” is explained in this quote from Strogatz:

“What was going on? After reading through the many comments on the article, I realized most of these respondents were using a different (and more sophisticated) convention than the elementary PEMDAS convention I had described in the article.

In this more sophisticated convention, which is often used in algebra, implicit multiplication is given higher priority than explicit multiplication or explicit division, in which those operations are written explicitly with symbols like × * / or ÷. Under this more sophisticated convention, the implicit multiplication in 2(2 + 2) is given higher priority than the explicit division in 8÷2(2 + 2). In other words, 2(2+2) should be evaluated first. Doing so yields 8÷2(2 + 2) = 8÷8 = 1. By the same rule, many commenters argued that the expression 8÷2(4) was not synonymous with 8÷2×4, because the parentheses demanded immediate resolution, thus giving 8÷8 = 1 again.”

So, if everyone followed exactly the same conventions, both when writing equations and in solving them, all would be well and we’d all get the answer we expected.

But…..

This [more sophisticated] convention is very reasonable, and I agree that the answer is 1 if we adhere to it. But it is not universally adopted. The calculators built into Google and WolframAlpha use the more elementary convention; they make no distinction between implicit and explicit multiplication when instructed to evaluate simple arithmetic expressions.

Moreover, after Google and WolframAlpha evaluate whatever is inside a set of parentheses, they effectively delete the parentheses and no longer prioritize the contents. In particular, they interpret 8÷2(2 + 2) as 8÷2×(2 + 2) = 8÷2×(4), and treat this synonymously with 8÷2×4. Then, according to elementary PEMDAS, the division and multiplication have equal priority, so we work from left to right and obtain 8÷2×4 = 4×4 and arrive at an answer of 16. For my article, I chose to focus on this simpler convention.

Our dear mathematician concludes:

 “Likewise, it’s essential that everyone writing software for computers, spreadsheets and calculators knows the rules for the order of operations and follows them.” 

But I have already shown that writers software do not all follow the same conventions….Strogatz points out that even sophisticated software like WolframAlpha and Google’s built-in calculator in GoogleSearch don’t follow the  sophisticated rules and get “16”.

wolfram_alpha_16

google_search_16

The final statement by Strogatz is:  “Some spreadsheets and software systems flatly refuse to answer the question — they balk at its garbled structure. That’s my instinct, too, and that of most mathematicians I’ve spoken with. If you want a clearer answer, ask a clearer question.”

Update Before Publication:  The NY Times’ Kenneth Change waded into the fray in today’s (Aug 7) Science section with “Essay:  Why Mathematicians Hate That Viral Equation“.

# # # # #

I hope that you have found this essay either instructive or amusing.  The real basic on this issue is that original problem written as “8 ÷ 2(2+2)” is intentionally badly formed so as to be ambiguous.

It does bring up a very serious question:  If simple mathematical equations can be interpreted and solved to different answers, depending on the order of operations and given that even serious mathematical software differs in conventions followed,  what of very sophisticated mathematical models, in which variables are all inter-dependent and must be solved iteratively?

In CliSci, do we get different projected future climates if one changes the order of calculation?  I mean this not in the simple sense of the viral twitty equation, but in a much more serious sense:  Should a climate model, a General Circulation Model, first solve for temperature?  Or air pressure? Or first consider incoming radiation?   Here’s the IPCC diagram:

GCMs_IPCC

I attempted to count up the number of variables acknowledged on this simplified diagram, getting to a couple of dozen before realizing that it was too simplified to give a real count.  Each variable affects at least some of the other variables in real time.  Where does the model start each iteration?  Does it matter which variable it starts with?  Does the order of solving the simplified versions of the non-linear equations make a difference in the outcomes?

It really must — I would think.

Do all of the western world’s GCMs use the same order?  What about the mostly independent Russian models (INM-CM4 and 5)?   Do the Russian models produce more realistic results because they use a different order of operations? Do they calculate in a different order?

I  certainly don’t know — but it is a terrific question!

# # # # #

Author’s Comment Policy:

 There is always yet another really great question to be asked.  Don’t ask me the one above, I don’t know the answer but I’d love to read your ideas.  If you are involved in a deep way with GCMs, please try to give us all a better understanding of the order of operations/order of calculation issue.

Start you comment with “Kip…” if you’re speaking to me.  I do read every comment that you post under any essay I write.  I try to reply when appropriate and try to answer questions when I can.

# # # # #

Get notified when a new post is published.
Subscribe today!
0 0 votes
Article Rating
483 Comments
Inline Feedbacks
View all comments
Pamela Gray
August 10, 2019 9:08 pm

Back before calculators (the first calculator instrument I saw was the size of my school desk) were born, the blackboard symbol conventions were strictly adhered to in fine detail. A fraction line meant one thing, a division sign meant another thing. A multiplier immediately followed by parenthesis meant one thing, a multiplier followed by a times symbol followed by parenthesis meant another thing. When calculators came along the conventions were changed and now we have two different scientific calculators coming up with two different answers because one of them follows a modern convention while the other follows a more ancient one. I am old school. The answer is 1 sonny.

August 11, 2019 4:58 am

Do we know where the concept of implicit multiplication being given higher priority over explicit multiplication or explicit division.

Are there any university level texts or engineering texts that document it with authority?

Reply to  Steve Richards
August 11, 2019 6:29 am

go here: http://www.quora.com/What-is-implied-multiplication

Think about how you would evaluate this: 8y ÷ 2x where y=1 and x=4

How is this any different than what is written in the original post?

Michael Grey
August 11, 2019 5:51 am

Simplify 8/2(2+2).

Let’s put this nonsense to bed, shall we?

This expression is not ambiguous and not incorrectly written. It is a very simple and elementary arithmetical exercise. According to mathematical convention, there is only one correct answer. Here is the rule, from Elementary Algebra for Schools by Hall and Knight, London, 1906. Quote;

“Article 58. A coefficient placed before any bracket indicates that every term of the expression within the bracket is to be multiplied by that coefficient.”

That means x(y+z) = xy + xz. So applied to this exercise;

8/2(2+2) = 8/2(4) = 8/8 = 1

That is the only correct answer to this exercise. If you get a different one, you are wrong. If you do not understand this, go away and study elementary mathematics until you do.

Google gives this; (8/2)(2+2) = 16. Google is wrong.

Where is the rule that says you can take the coefficient of bracketed terms in a expression and shove it somewhere else? What kind of genius are you that breaks up a bracketed expression and distributes terms before the operation is completed – oh, say, over there somewhere? BODMAS? Modern usage as per YouTube? That’ll be BIGMESS.

I’m not revisiting this, answering any responses, or generally wasting my time on mind-numbing ignorance. If you are writing code with incorrect mathematical operations, you are the one who needs to revisit Elementary Algebra and not display your lack of understanding on the www.

Oh; and something about GCMs? Are you serious?

Ronald Ginzler
August 11, 2019 4:36 pm

I learned math before hand calculators existed. In math textbooks division is shown by a line with the dividend above and the divisor below, not with the “divided by” sign, which is ambiguous. Of course anything in parentheses is calculated independently of the things outside it. This was understood, if not explicitly stated. The big hairy equations thus existed in two dimensions, not one, and were not linearly input into a calculator. This is the crux of this imagined “problem.”

Editor
August 16, 2019 11:09 am

Epilogue:

Boy oh boy — yet another zombie comment section that lives on and on and on — long past its normal lifespan.

I should have expected it, I was interested in the original conundrum, the Twit-o-verse was humming about it — so why not here?

I was disappointed that almost no one was interested in the CliSci application question — Does the order of processing make a difference in the outcome of models?

Reader “kribaez” was bright and kind enough to point us to a link of a presentation from 2017 that answered this particular question. “Impact of Physics Parameterization Order in the
EAM v0 Model
” by Aaron Donahue and Peter Caldwell.

Read the link for the answer — or wait until I get to writing an essay on the topic. (I first need permission from the authors to use some of their graphics.)

Thanks for Reading!

# # # # #

Stoupaq
August 20, 2019 4:36 am

I don’t understand how can this even be problem to argue.
It always was 16 and always will be 16.
Even all the presented calculators are able to do it correctly.
On the second calculator the expression presented is just different one. It is not equivalent notation.
If you put there the expression correctly it calculates 16.
And the third calculator is also able to calculate it correctly. It just don’t know implicit multiplication. If you use explicit it calculates 16.
And why is anybody talking about the brackets in this expression is beyond my understanding. Brackets have meaning for expression that is inside of them not the one outside. So they have absolutely no impact on that multiplication.

Reply to  Stoupaq
August 20, 2019 12:33 pm

“If you put there the expression correctly it calculates 16.”

In other words if you rewrite the expression you get the answer you expect. That doesn’t make it the correct answer.

1 4 5 6