News Brief by Kip Hansen
There 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
— em ♥︎ (@pjmdolI) July 28, 2019
That’s easy! The correct answer is:

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!

(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:


And maybe a bit more accurate:

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”.


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:

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.
# # # # #
Discover more from Watts Up With That?
Subscribe to get the latest posts sent to your email.

Kip,
Google Scholar has nearly two millions hits for “numerical solution of nonlinear partial
differential equations” including a large number textbooks. If you want to know how to
numerically integrate differential equations involving non-commuting variables (which is
still a subject of a lot of research) then a trip to the library is going to be more helpful
than a snarky comment on a blog.
The short answer is you calculate the Jacobian of the equations and solve the resulting
system of linear equations in which the operators all commute. You then get an error
term that size of which depends on the commutator and can be minimised by taking small
steps.
Izaak ==> You have misunderstood the point, I think. GCMs are made up of many many simplified non-linear equations, each containing dependent variables from the other simplified non-linear equations — all having to be calculated and fed into one another at each time step iteration……
It is not a question of how to solve the equations (though some are known to not prone to solution) but in what order they should be solved.
Kip,
Mathematicians have long ago worked out how to numerically solve equations that
involve non-commuting operators. Which is a hard problem but one which does have
various solutions mainly involving taking many small steps on very fine grids. Which
is one reason why climate models require so much memory to run correctly.
Also since the equations only permit one solution given a set of inital conditions there is
no difference between knowing how to solve the equations and knowing what order they
should be solved in. If two different numerical methods give two different answers to the
same question then at least one of them is wrong.
Izaak ==> well, at least we know your opinions on the matter. can’t say I agree though.
Hi Kip,
Do not get me wrong. You have hit on a very important point — how do
mathematicians and physicists demonstrate that their numerical solutions to
equations are correct. And how do you demonstrate that the algorithm used will produce the correct answer. Neither question is trivial nor easy to solve but
there are solutions and there is an extensive literature about how to do it for
particular cases. It should be noted for example that the uniqueness and existence of solutions for the Naiver Stokes equation has not been proved in general (it is an open Millennium problem).
However if you want to advance the claim that the numerical solutions found
by global climate models depend on the order in which the equations are solved you need some actual evidence before people will take you seriously. Again all of the code for various global climate models is freely available online so if you want to have a look then you are free to do so. And then you can point out exactly which lines of code can be changed to produce a different answer.
The difference is how the compilers handle the expressions used in the program and the sequence of chained calculations. You can have a real problem if you suddenly divide a largish number by a very small one. You can easily run out of integers, or have overflows that wouldn’t be an issue if calculations were done by hand.
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.”
People hate to be wrong the correct answer is 16 if there is no reason to group the 2(2+2) term.
However, and I think Kip missed this important point, if 2(2+2) is a logical grouping …say it represents a value like “cups of flour” or “tiles per square meter”, then you would group them together and ultimately get the value 1. But ONLY if the context of the equation warrants it.
TimTheToolMan ==> First, it is not my issue — the three NY Times articles discuss the whole bag of monkeys exhaustively. so, any fault is not mine….
And your point is well taken, if the writer of the equation knew what was being described by the formula, then he would know how to make it explicit and not leave it ambiguous.
Well,
Do you agree that 4+4 = 2(2+2) ?
This is basic math.
So, starting from an initial expression 8 : (4+4) can be written as 8 : 2(2+2)
How can than 8 : 2(2+2) be equal to 16 ! or may I have to write 8: (4+4) = 16 !!
The right answer is not correct expression but at least, the right result could be 1 isn’t it ?
The problem is in your head. That is, you are internally grouping the numbers as “(2(2+2)”, which is not what is written. Understand that (a) x (b), (a)(b), and ab are all equivalent. So, the fully expanded version looks like 8 ÷ 2 x (2+2) = ?
but 2(a+b) = (2a+2b), hence 8/2(2+2) = 8/(4+4) = 1
QED
Really? You just proved my point. This is not algebra, it’s arithmetic with chained calculations. Sure, you do the parenthesis first, but then you go back to the beginning of the expression.
8/2(2+2) = ?
8/2(4) = ?
NOW BACK TO THE BEGINNING. FOLLOW THE LEFT TO RIGHT CONVENTION.
8 ÷ 2 x 4 = 16
Quod Erat Demonstrandum
D.J.: “8/2(2+2) =”
That is not how the expression is written. In essence this is a red herring argument. You are solving something other than what is at issue.
8 ÷ 2(2+2) is how it is written.
If this was written 8y ÷ 2x then how would you evaluate it? Would you do the implicit multiplication of 8y but ignore the implicit multiplication of 2x?
“That is not how the expression is written.”
Spaces aren’t part of the rules of order of precedence. Your convention is based on assumption. When your example expression is more correctly written…
8y
—
2x
…then there is a grouping formed by the divisor symbol. That’s what you’ll find in exams and text books. If you follow the rules then there is no ambiguity and no assumptions needed.
“Spaces aren’t part of the rules of order of precedence.”
Spaces are indicators of grouping. It’s always been that way. Spaces indicate groupings of letters to form words. The elements in a math expression are the equivalent of words. It’s *always* been that way. Its only changed since computer programmers began ignoring that simple fact.
“Spaces are indicators of grouping.”
That’s what parentheses are for. To assume spaces “group” is asking for trouble when most fonts are proportional these days.
“That’s what parentheses are for. To assume spaces “group” is asking for trouble when most fonts are proportional these days.”
Equations have been written with spaces to indicate grouping since algebra was invented. Proportional fonts on computers are a recent development.
The picture at the start of the thread was obviously handwritten on a blackboard. Hard to use proportional fonts on a blackboard!
You are reaching for something, anything, to back up rewriting this expression to get an answer other than what the handwritten expression actually gives based on traditional writing of math expressions.
Hardly. You’re saying assumption trumps the rules. Good luck with that.
TTTM
-1
There IS a reason to group them. It is the presence of the multiplier (or factor 2) outside the parentheses, with no multiplication symbol. That implies 2 was a common factor for everything inside the parentheses and was extracted, as is commonly done when trying to find the root of an equation.
“That implies 2 was a common factor for everything inside the parentheses and was extracted, as is commonly done when trying to find the root of an equation.”
+1
” It is the presence of the multiplier (or factor 2) outside the parentheses, with no multiplication symbol.”
The “sophisticated convention”
The actual mathematical rules say otherwise because multiplication and division have the same precedence. It is more correct and more defendable to add the implied multiplication and proceed with left to right as the defined rules state.
But it certainly rubs a lot of people up the wrong way 🙂
The correct order is ;;;;;;;
Russian models produce more realistic results NOT because they use a different order of operations, but because they do NOT use cooked CO2 sensitivity factors (like the 110 erroneous IPCC GCM models do).
As simple as that.
Telehiv ==> Is your statement made on the basis of knowledge of the details of the Russian model? or just a guess?
Note that the mathematician uses 8 over 2 to get 16 and not 8 over 2(2+2) to get 1.
That has very serious connotations about how formula are written, which version does the originator mean.
As commented above there is also a gulf between programmers and mathematicians. Most programming languages will return 16 because they have a very specific and single specification for precedence order. It doesn’t match any of the standards taught at school.
actually in oracle sql 2(2+2) returns an error … it only does the math with 2*(2+2) … and written as 8/2*(2+2) it returns 16 … but if I was writing it I would have used 8/(2*(2+2)) which returns 1 … not sure about sql server …
Kaiser ==> yes, one of the online calculators CORRECTLY returns ERROR — because the equation is ambiguous. Others return 16 (mostly) and some 1.
Thanks for the detail on Oracle’s SQL.
What do you get when you combine fifty female pigs with fifty male deer? A hundred sows and bucks.
A damn good dinner…
I have never liked relying on precedence rules. I have always made liberal use of brackets. Some of the formulae given in text books are far from being clear.
1 or 16 ???
The difference is only 1600% ….. well within the margin of error for “climate science”!
Thanks for the interesting post and discussion thread. But I still don’t know the right answer.
The difference, 15, is 1400% greater than 1, and 6.25% less than 16.
This is not a good post to avoid unambiguity in the comments. 🙂
Sharp eye Ric …… I stand corrected! Still within the margins of error in ‘climate science’! lol
I believe that IBM clarified this when Ken Iverson devised a notation which became the programming language APL. It has always surprised me that APL was not taken up by more people.
It has been ages since I used APL, but I remember that it evaluated expressions right to left. So in APL the order of operations would be:
eval the parentheses (2+2) returns 4
then 2*4 returns 8
then 8 divide 8 returns 1
I used to love coding in APL, but after a week the code was unrecognizable. It is unlike any other programming language that I’m aware of. It needed a special character set implemented on terminals that were very difficult to find/buy. I used it for a while in the mid 1980’s.
There is just 1 answer.
. . . unless multiverses exist.
There is only one correct answer and that is 8/(2(2+2) because the calculator’s manual states that you must put parenthesis around any equations in the denominator to indicate that it should be completed first. Math also has the same kind of rule on paper.
https://www.wolframalpha.com/input/?i=8%2F(2(2%2B2))
Calculators must be correctly programmed.
Syntax Error!
8/(2(2+2)
You have an unmatched paren.
You could have also have said:
(8/2)(2+2) !!!!
This resolves the issue just as well.
That is stupid and like saying there is only one number system … newsflash there are multiple number systems.
The correct answer is 16; if 1 is the desired answer, an extra pair of brackets is needed (square brackets are more legible when written, but parentheses are used in FORTRAN). However, in Chemistry/Physics BODMAS is not strictly followed by convention in the decreasing exponential Boltzmann function exp(-E/kT). Any program that does not actually calculate exp[-E/(kT)] would quickly produce numbers that are way, way off (so MODTRAN or HITRAN calculations of infrared spectra are undoubtedly OK).
Unless your in Israel where right to left is the way
If presented as 8 over all of 2(2*2) instead of the divide sign or / then there’s no ambiguity, and this is how I read the question with implied parentheses. However if I were programming it in FORTRAN it would be result = 8.0/(2.0 * ( 2.0 * 2.0)) to obtain the same answer, 1.0, as result = 8.0/2.0 * (2.0*2.0) would give 16.0. A factor of 0x10 (16 )difference, how would people react if they were paid 6% of their salary?
It would be interesting to see the demographic breakdown of the different answers based on age and geographic location.
However, as pointed out if such ambiguity exists in the interpretation of a simple expression then how can the development of computer models be assured, they will always produce an output, but whether that is the “right” answer is debatable. All of the statistical manipulation of the data is unlikely to overcome these types of errors. You are dependent on the quality control used, and as some chunks of software are common to all models then this has to be very stringent in its application.
John ==> some of the ClimateGate emails discussed a programmer trying to make sense out of the code bing used at the time in CliSci (the details escape me — someone here help me out and post a link to the essays discussing this — thanks — kh)
I believe you’re thinking about the HARRY_READ_ME file. It wasn’t Email, it is a long, sad diary written by someone doing his best with an impossible task.
http://wermenh.com/climate/HARRY_READ_ME.txt
It kept me up until 3 AM.
Thanks Ric. –kh
I had a really good answer all prepared but an errant swipe on the screen of my really smart dumb phone decimated it, over and over again until it was all gone. I am going to gather my not smart phone computing hardware, laptop and RGB mechanical keyboard and try again in my other “office” downstairs where it is cooler. And no, it isn’t hot in my “office” because of global warming as highs this summer have been 10 F cooler than last summer (Vancouver B.C. region ) We also had the coldest month of February ever recorded her this year.
If it were truly decimated, the 90% remaining should be good enough. 🙂
That is why I said over and over again.
16
8/(2(2+2) is gibberish.
It is not an equation as it is missing an operator.
I wouldn’t waste my time trying to solve it because it’s obviously ambiguous and/or inaccurate.
Correction:
8/2(2+2) is still gibberish.
It is still missing an operator and it’s still ambiguous because of the missing operator.
Without the operator, neither my scientific calculator app, nor Excel will do the calculation. When I add the (*) operator, they both yield 16… As does the calculator app on my Windows PC.
Implied multiplication or juxtaposition is a standard part of algebra. What you wrote is gibberish because the parentheses are not balanced, algebraic notation would use brackets, but what I think you intended is not ambiguous.
In algebra, I would have written 8/[2(2+2)]. (Mathematicians use { [ ( ) ] } to add clarity to expressions.)
In most programming languages I would write 8 / (2 * (2 + 2)). ASCII-68 does not have the symbols × or ÷, so we don’t use them. Early keypunches didn’t have braces or brackets, so we don’t use them either.
No, it’s not an equation because there’s no equal sign and an expression to its left.
Algebraically, it’s not missing an operator. Juxtaposition means multiplication. The ambiguity is because there is no authority (I’ll volunteer!) who defines the operator precedence and order of operations involving juxtaposition and division.
Ric ==> Well stated.
Kip,
You posed the question: “In CliSci, do we get different projected future climates if one changes the order of calculation? ”
The answer to this question is a definite yes.
Go to this site http://www.miroc-gcm.jp/cfmip2017/presentation.html and click on the presentation entitled “Impact of physics parameterization order in a global model (Peter Caldwell)”
However, I think it is a bit hyperbolic to confuse the trivial question of operator ordering – which is no more than a meta-linguistic convention – with the quite different and far more complex question of the order in which multiple coupled equations are solved. An error in programming language convention would be a gross error which should not occur with even a moderately competent modeler, and, if it did occur, it should normally be easily picked up in routine verification tests. However, the second question deals with an unknown level of time truncation error. The AOGCMs apply a mix of explicit and semi-implicit updates to state variables involving relationships which are nonlinear. The results can therefore be highly sensitive to the order in which the variables are updated, as demonstrated in the Donahue and Caldwell presentation I referenced above. The AOGCMs do not lend themselves to L2 convergence tests, and hence this problem remains as one of several unquantifiable sources of uncertainty in GCM results, especially at the level of regional prediction.
The big difference is that the first error is a language MISTAKE and can be fixed. The second problem is a source of uncertainty, which is not resolvable, as far as I know.
That is a devastating presentation! “Placement of macrophysics, microphysics, and radiation are the main determinants of model behavior”.
It’s worse than I thought. Numerical solutions to differential equations are well known to exhibit pathologies, e.g., unwanted oscillation or escape to infinity. Trying to numerically solve coupled nonlinear partial differential equations has to magnify that by a lot. Add this into the ordering problem and it’s a wonder that they get anything sensible out.
kribaez ==> “However, I think it is a bit hyperbolic to confuse the trivial question of operator ordering – which is no more than a meta-linguistic convention – with the quite different and far more complex question of the order in which multiple coupled equations are solved.”
Yes, that’s what I said…the one idea just led me to ask the bigger question about GCMs.
That is how science really works — one idea leads one to ask a bigger question in another field — even if they are not really directly related. A lot of my work here is like that….
kribaez ==> And thanks for the link!
I don’t have a college degree at all and I know the answer is 1, why, just because you’ve solved the (2+2) and got (4) still means there’s a number inside the brackets and that needs solving first. Finish off the brackets first.
8 ÷ 2(2+2)=
8 ÷ 2(4)=
8 ÷ 8=1
How the equation is written is very important. INCLUDING THE USE OF SPACES.
In the original equation there is a space after the plus sign. That space should mean that the 2(2+2) is grouped together and should be solved first.
In every equation giving 16, e.g. on the left calculator, there are no spaces provided at all in the expression. It then becomes a matter of what precedence is used to solve the equation thus causing ambiguity.
Spaces *do* matter when reading anything, including mathematical expressions.
Gee, this was second grade arithmetic where I come from. 8 is a whole number, 2 is a whole number, 2+2 = 4, which is a whole number. 2 times 4 = 8, which is another whole number. (Oh, wait – I already said that.) You do the righthand calculation before you do the rest of it. If you can’t do that in your head, well – what can one say?
Therefore, 8 divided by 8 = 0.
Doing this problem with a calculator instead of using your brain cells to do the work says “lazy, lazy, lazy”. Asking a program which is limited binaries to solve this problem is only going to tell you that so-called machine “intelligence” doesn’t exist. But now I completely understand why there is so much squawking about climate this and extinction that.
Maybe we should bring back slide rules and take away the calculators.
Ummmm, 8 divided by 8 = 1
No 8 divided by 8 = 1
“Therefore, 8 divided by 8 = 0.”
Who knew? (reflecting on “If you can’t do that in your head . . .”)
🙂
In applied mathematics, which are what the climate models would use, equations would have units attached to each term. This ambiguous equation does not have units attached and goes to show one of the differences between theoretical or pure mathematics and applied mathematics. Try attaching some units to the terms of that equation then carry out the calculations. What terms do you end up with. Each term of the equation has to match each other in units. If you are using this equation in some applied application, you are probably going to know if the units you end up with are correct or not.
I am a software engineer and I have studied a lot of mathematics (spent 5 years studying calculus every day), physics (electrical engineering and mechanical engineering) and am currently studying thermodynamics, some mathematics involving the method of weighted residuals and variational principles (with applications to heat and mass transfer) and I have been studying the Finite Element Method for a number of years. The order of applying the operations of mathematics has never come up in any of the books that I have studied as being a problem, in the sense of the applied mathematics.
The order of operations dealing with matrices on the other hand do not follow the same rules such as commutative operations are not the same. But these differences are well known and accounted for.
I calculated an answer of 1.
Kip, I recall many long threads with heated comments regarding Trenberth’s cartoon on global energy flows. You know, the one with 356 W m2 upward radiation from surface and 333 W m2 back radiation from atmosphere to surface. Much debate concerned whether only the net amount was a real energy flow, or whether the two component luxes are separately real.
It is the Standard used in Algebra!
That is what is so great about this standard.
There are so many to choose from!
This formula in Excel =8/2(2+2) generates an error message:
Microsoft Office Excel found an error in the formula you entered.
Do you want to accept the correction proposed below:
=8*(2+2)
And the answer comes up 16
steve case
But, Excel does offer you the opportunity to decline the proposed correction and make other changes. If you think that Excel isn’t smart enough to get it right, you have a responsibility to add some brackets or parentheses.
It’s simple actually; if you put brackets round the numbers after the division mark you will have one, 1, as answer. If you don’t do that you will have 16 as result.
8/2=4×4= 16…
8/2×4= 1…
The brackets makes the difference…