# How’d They Calculate That?

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.

# # # # #

Article Rating
Inline Feedbacks
Dan Cody
August 7, 2019 10:39 pm

Economists have forecast nine out of the last five recessions.

charles nelson
Reply to  Dan Cody
August 8, 2019 1:33 am

Any number to the power of 0 = 1.
‘Fraid they lost me right there!

Crispin in Waterloo
Reply to  charles nelson
August 8, 2019 9:56 am

That is a convention, not a literal calculation.

Greg
Reply to  Crispin in Waterloo
August 8, 2019 11:39 am

This whole supposed polemic is BS. and is NOT a question of BEDMAS vs hemorrhoids.

Both conventions state exactly the same thing in different words , neither states the multiplication has a higher priority than division.

The key factor mostly ignored in this whole silliness is the rule that states you work from left to right when you have equal precedence operators. Once you remember that rule, there is no ambiguity.

Kip… : your second calculator image is a con-job since the reason they give different answers is because they are being given DIFFERENT calculations. Look again, closely. Using a full underline instead of a slash for the division implies a bracket around the denominator.

OweninGA
August 8, 2019 4:32 pm

The problem I have with your version is: What if I distribute the 2 into the parenthesis? It is simply a badly written problem. When I see 2(2+2), it is the same whether I write it as 2(4) or (4+4). If the 2 is supposed to be separated from the parenths, it should either be written as 2*(2+2) or the problem should have been explicitly written $latex \frac{8}{2(2+2)}$ or $latex \frac{8}{2}(2+2)$ to give whichever answer is wanted. In physics problems the form is explicit.

OweninGA
August 8, 2019 5:59 pm

$\frac{8}{2(2+2)}$ or $\frac{8}{2}(2+2)$

messed up the latex, maybe this time I got it right.

nw sage
August 8, 2019 6:17 pm

Owen – I agree with you and, to me, the first version with the full underline for the division is the “more” correct one. My algebra training always told me to simplify as much as possible the divisor (the part at the bottom) FIRST. After that everything falls into place. We need the opinion of one of my old algebra teachers!

1sky1
August 9, 2019 2:54 pm

This whole supposed polemic is BS.

Correct! There’s a categorical difference between fundamental mathematics and supposed computational convention. What this viral “conundrum” shows unambiguously is that no competence in either is required for web-postings.

Philo
August 9, 2019 6:03 pm

“In other words, 2(2+2) should be evaluated first. Doing so yields 8÷2(2 + 2) =”
The implicit rule is to simplify compound numbers- (2+2)=4.
Then the operations can proceed left to right. the mistake is that 2(4) is the same as 2*4.
Proceeding left to right: 8÷2*4-> 4*4-> 16.

The garbling of the problem is assuming 2(2+2) is different than 2*(2+2). The implicit rule requires simplifying within the parentheses but does not apply to operations outside the parentheses.

Tim Gorman
August 11, 2019 10:54 am

“The garbling of the problem is assuming 2(2+2) is different than 2*(2+2).”

And what if it was 2x instead of (2+2)? Would you do that implicit multiply first? Most people that learned algebra prior to digital computers would calculate 2x first.

How would you evaluate: 8y ÷ 2x in an algebra class?

Greg
Reply to  Crispin in Waterloo
August 8, 2019 11:47 am

x ^ ( a-b ) = x^a / x^b

let a=b and you find that “Any number to the power of 0 = 1″ is an identity , not a convention.

KIP… , I guess you used pathetic home made maths lessons to explain PODMAS et al on purpose.

Any reliable reference includes ” multiplication OR division” and “addition OR subtraction” in the hierarchy. There is no maths convention to split those groupings. Those that do probably failed school but know how to get click pennies by publishing any garbage they do not know.

Editor
August 8, 2019 12:03 pm

Greg ==> I used quotes from published online sources for the definitions, and explanations from Strogatz — fussing about the definitions is not useful….

Strogatz makes the points of this essay, in a lot longer form, and if in doubt, read the links. For fun, you can read Ken Chang’s article in the Times too.

siamiam
August 8, 2019 10:19 pm

My old algebra teacher taught My Dear Aunt Sally. Multiply, Divide, Add and Subtract last. The answer is 1.

Jake
Reply to  Crispin in Waterloo
August 8, 2019 2:14 pm

This is most certainly NOT by convention …….

If 1-1 = 0, the x^1-1 = x^0

or, written differently …

(x^1)(x^-1) …. or …. x^1/x^-1 …. Either of each = 1.

Therefore, x^0 = 1.

No convention, proof.

John
Reply to  Crispin in Waterloo
August 9, 2019 12:00 pm

It’s more than a convention.

a^(x+y) = (a^x)(a^y) , for any real a, x, y

if x = 0, a^(0+y) = a^(y) = (a^0)(a^y)

for a^(y) = (a^0)(a^y) to be true, a^0 must equal 1.

Also, f(x) = a^x is a continuous, differentiable function, but it would not be if the value of a^0 was arbitrary.

Reply to  charles nelson
August 8, 2019 10:04 am

The square root of -1?

If that doesn’t prove there’s something very wrong with the universe, I don’t know what would.

Josh
Reply to  James Schrumpf
August 8, 2019 1:49 pm

Showing glitches in man-made counting systems isn’t proof of universal issues, only that we make flawed systems and should expect such errors.

As for order of operations, yeah that’s a fun issue that can make long complicated calculations problematic, especially if you don’t notice them. (I.E. if it’s deep in the middle of a long equation)

Mike S.
Reply to  James Schrumpf
August 8, 2019 2:29 pm

The square root of -1 is a wonderful and very handy critter. A lot of the algorithms I work with would be a bear if we didn’t use complex numbers.

Editor
Reply to  James Schrumpf
August 8, 2019 9:43 pm

There are a number of conventions in mathematics and science that may have originally been employed as a shortcut to ease computation. However, as they found applications in more and more fields, they gained so much acceptance that they might as well be considered the true representation. The square root of -1 is likely the most important one of all, especially in its application to sinusoidal signals and how it so easily permits things like positive and negative frequencies. Those pretty much convincingly exist in the dual sidebands of AM radio.

I’ll go so far as to claim that a universe without the existence of the square root of -1 would be a very weird place.

Alan D. McIntire
Reply to  Ric Werme
August 12, 2019 4:30 am

Yes, consider the problem f(x) + f”(x) =0.

The solution is f(x) = C1 e^(ix) + C2 e^(-1x) + C3 + C4, which is equivalent to

f(x)= c5 six(x) + C6 cos(x) + C3 + C4
When you get an imaginary solution, you can be certain a trigonometric function is involved.

Editor
Reply to  charles nelson
August 8, 2019 10:40 am

What does 0^0 evaluate to?

noaaprogrammer
Reply to  Ric Werme
August 8, 2019 1:50 pm

Using the L’Hopital Rule, the limit of x^x as x approaches 0 from above is 1.

UBrexitUPay4it
Reply to  Dan Cody
August 8, 2019 7:26 am

“Economists have forecast nine out of the last five recessions”

I think it depends which “economists” you are referring to. Central Bank economists NEVER see a recession coming – they are famous for it. On the other hand, Zerohedge has forecast at least 200 of the last 2 recessions, and then everyone else fits in somewhere in between.

Rocketscientist
Reply to  Dan Cody
August 8, 2019 7:41 am

As I have commented regarding this issue in other threads, the problem is that it is a poorly written equation if it has ambiguous interpretations. Add a couple of parentheses or brackets and the issue is solved.
It’s not poor mathematics, its poor programming.

Frederick Michael
August 8, 2019 9:24 am

Rocketscientist – Your point is well supported in practice.

If you type this into either the iPhone calculator or the calculator that’s built into Windows 10, you get 2.

It’s some kind of autocorrect effect, I think.

Reply to  Frederick Michael
August 8, 2019 10:14 am

What happens in the Windows 10 calculator is that it doesn’ t reproduce what you enter if you try to do it as the equation is written.

When you enter 8/2 the calculator displays:

8/

The two is not displayed yet. When you type the first parenthesis it displays:

8/(2

Now it’s messed up, and it doubles down to the finish.

8/(2+2)

To make it work correctly, you have to type in the explicit multiplication:

8/2X(2+2)

and you get the correct answer of 16.

Clyde Spencer
Reply to  James Schrumpf
August 8, 2019 1:45 pm

James Schrumpf
Wrong! To get the correct expression and answer you have to use nested parentheses. i.e.
8 / (2*(2+2)) =1

TomT
Reply to  James Schrumpf
August 8, 2019 1:48 pm

No the correct answer is 1

fred250
Reply to  James Schrumpf
August 8, 2019 1:57 pm

writing 2(2+2) has to work the same way as writing x(x+2).

There is IMPLIED bracketing.

Tim Gorman
August 8, 2019 3:16 pm

“writing 2(2+2) has to work the same way as writing x(x+2).

There is IMPLIED bracketing.”

+10

Reply to  James Schrumpf
August 8, 2019 3:27 pm

My first impression of all this, having read about it elsewhere, was “any idiot knows that the correct answer is 1”. … Implied bracketing seemed obvious to me. My eye, thus, saw two terms, one on each side of the division sign.

2(2+2) is read like it is one side of the division sign. It could also be written as 4+4. It only becomes separated terms, when the indicated operation on the right side of the division sign is carried out. It’s like “2x”, where “x” is “2+2”. At least, that’s how I thought I was taught.

Tim Gorman
Reply to  Robert Kernodle
August 8, 2019 3:47 pm

+1

Editor
Reply to  James Schrumpf
August 8, 2019 9:51 pm

What the heck is “implied bracketing”? 2(2+2) has plenty of bracketing, the implied multiplication is immaterial, as the issue is how division and multiplication relate in 8/2(2+2).

Tim Gorman
Reply to  Ric Werme
August 8, 2019 10:09 pm

Ric: “the issue is how division and multiplication relate in 8/2(2+2).”

Except the expression is written as 8 / 2(2+2)

You left out the spaces. That’s what a computer programmer does. It changes the entire expression when you leave out the spaces.

CRISP
Reply to  James Schrumpf
August 9, 2019 12:08 am

Clyde Spencer is right. The equation has been poorly structured. To make it unambiguous, one should use nested brackets.

8/(2*(2+2)) unambiguously gives you 1.
(8/2)*(2+2) unambiguously gives you 16.

When creating formulae in spreadsheets, it is a very good idea to use brackets routinely, even when you don’t strictly need to, because you can’t be sure what convention the program may follow. It also helps you to structure your formulae correctly.

TimTheToolMan
Reply to  James Schrumpf
August 10, 2019 7:37 am

“There is IMPLIED bracketing.”

No, there is implied multiplication, not bracketing.
Bracketing changes the meaning.

August 8, 2019 11:04 am

Agreed!
I still write overly complex calculations to ensure most computers follow the calculations as I intend; though people frequently complain. Just another aged programmer stuck with certain conventions…

A statement that does not mean I get perfect results. All too often, it takes stepped calculations to identify where CPUs zigged where I coded zags.

Inside out,
Highest operand,

Which makes “original problem written as “8 ÷ 2(2+2)”;
2+2,
2 X (4),
8 ÷ 8 = 1.

Properly, the formula should be written as “8 ÷ 2(2+n), n=2”.
Otherwise, people who are mathematically proficient, immediately recognize 2(2+2) as 2³.

Which rather proves computers are not mathematically proficient, instead they require stepped language to reach their sums.
Again, proving what my COBOL and BAL Assembly teachers said many many times; “Never trust implicit commands! Program explicit commands.”

Reply to  Dan Cody
August 8, 2019 10:28 am

Apparently, this “Dan Cody” comments just to throw nonsense words into the thread.

Could it be that a bot is commenting?

Dan Cody
August 8, 2019 10:42 am

How did you guess that I was an Android? My real name is Hal,made in 2001.Yes,It’s been a real odyssey since then.

Reply to  Dan Cody
August 8, 2019 10:54 am

The question unanswered is where unary minus comes. How does one evaluate -3^2 ?

Glenn Hamblin
Reply to  Dan Cody
August 9, 2019 10:47 am

Oh, that’s good.

Dan Cody
August 7, 2019 10:45 pm

How many IRS agents does it take to screw in a light bulb? Only one.But it really gets screwed.

Dan Cody
August 7, 2019 10:47 pm

An economist is an expert who will know tomorrow why the things he predicted yesterday did not happen today.

old construction worker
Reply to  Dan Cody
August 8, 2019 2:39 am

I learned that in college from a econ professor.

Walt D.
Reply to  Dan Cody
August 8, 2019 5:27 am

What is the difference between an Economics Professor and a Finance Professor?
An Economics Professor knows nothing about everything.
A Finance Professor knows everything about nothing.

ResourceGuy
Reply to  Dan Cody
August 8, 2019 6:21 am

He won’t know tomorrow because of flaws in the data that everyone “forgets” to mention when writing about it, researching, and getting tenure. It’s more a case of validation within a flawed data system.

Dan Cody
August 7, 2019 10:54 pm

“Are you a lawyer?”
“yes.”
“How much do you charge?”
“A hundred dollars for four questions.”
“Isn’t that awfully expensive?”
“Yes.What’s your fourth question?”

peyelut
Reply to  Dan Cody
August 8, 2019 10:33 am

#Are you Human?” “Barely -I’m a lawyer.”

Dan Cody
August 8, 2019 10:44 am

What did the lawyer name his daughter? Sue.

Murph
Reply to  Dan Cody
August 8, 2019 7:16 pm

How do you tell the difference between a lawyer and a carp?

One is a bottom feeding scum sucker and the other is a fish..

August 7, 2019 11:02 pm

Wat is the priority of division and muktiplication in 8/2*4?
(8/2)*4 or 8/(2*4)?

Dan Cody
Reply to  Hans Erren
August 7, 2019 11:07 pm

The Adam and Eve computer virus takes a couple of bytes out of your Apple.

Archer
Reply to  Hans Erren
August 8, 2019 12:13 am

Brackets first, division, then multiplication.

In order:

16, 16, 1

Clyde Spencer
August 8, 2019 1:33 pm

Archer
Division is the inverse operation of multiplication. Therefore, the order in which it is performed shouldn’t make any difference. That is, 8 / 2 = 8 * (1/2).

Archer
Reply to  Clyde Spencer
August 8, 2019 3:21 pm

True, but since I learned BODMAS, division comes first.

🙂

TonyL
Reply to  Hans Erren
August 8, 2019 1:50 am

In programming languages FORTRAN, C, R:
brackets first, then Left to Right, multiplication and division are equal, no priority.
16, 16, 1
(addition and subtraction are also equal, no priority, so also Left to Right)
Full order is:
1)Parens – innermost to outermost
2) Powers
3) Mult, Div – Left to Right
4) Add, Sub – Left to Right

LdB
August 8, 2019 3:41 am

This is hardly new, there are plenty of other problems with C especially because it adds priority to things like pointer operations and logic operators.

For those of interest this is C’s precedence operations
https://en.cppreference.com/w/c/language/operator_precedence

The answer from C will always be 16 .. The brackets are done first, the mult and divid have equal precedence and it’s simply left to right.

That is why many calculator programs and websites will give 16 because they don’t care about school rules they are using programming rules.

You want and even funnier which actually effects statistics ask what is the round of 1.5
Most programming languages will return 1, they don’t do round half to even rounding like you learn at school they simply take the floor value.

As an interesting aside climate change use a lot of rounding and I guarantee you that if you look at there code most don’t realize they have bias just based on there code as they are blissfully unaware how the language they use rounds.

Editor
August 8, 2019 5:56 am

LdB ==> The last bit can be a real problem in older temperature records where °F and °C are covet4ededback and forth, rounded to 0.5s….which are then processed modernly by software.

Editor
Reply to  Kip Hansen
August 8, 2019 12:05 pm

gads! “covet4ededback and forth” == “converted back and forth”….

Surfer Dave
August 8, 2019 7:38 pm

Yes, good call LdB. I reckon most of the coders of the models have limited idea of how computers actually handle numbers. This discussion has dwelt on simple integer arithmetic, once we get into floating point representations of real numbers then the wheels well and truly fall off…

Bregma
August 10, 2019 6:22 am

> Most programming languages will return 1

ISO 9989 (the C programming language) requires adherence to IEEE 754 (floating-point arithmetic), which has a number of configurable rounding modes (eg. towards zero, towards infinity, banker’s) that determine what the result of rounding 1.5 is. Fortran has similar requirements. I have a degree in math and safety-qualify computer language tool-chains for a living, I am quite familiar with this domain.

The language also specifies exactly what the operator precedence is, and what directional binding an operator has (eg. multiplication and division have the same precedence, and bind left). You can not write this ambiguous arithmetic statement in C, it’s just sloppy typography, like choosing your own spelling and grammar rules for English then asking the internet what you mean when you tweet nonsense.

The problem with the internet is that it allows anyone with a keyboard to get a lie to run around the world before the truth can even get its shoes tied.

TRM
August 8, 2019 8:00 am

“brackets first, then Left to Right” – Bingo!
The problem is when they draw it 8 over 2(2+2) so it should be 8 over 2 with (2+2) beside it
16 🙂

Peter Charles
Reply to  Hans Erren
August 8, 2019 3:58 am

That isn’t actually the choice. This is a really simple problem. Implicit multiplication should always take precedence after parentheses (brackets) because that type of grouping, in this case 2(2+2), is implicitly a single number, it is not actually a multiplication as per 2 * (2 + 2), it is, to put it pedantically (and implicitly), (2(2+2)) which is 8. Thus it is always correctly 8/8.

Sara
Reply to  Peter Charles
August 8, 2019 4:06 am

Wait a minute! You expect a computer to think in abstracts like a human? You silly guy!!!

Tom in Florida
August 8, 2019 8:54 am

In the immortal words of HAL, “I’m sorry Dave, I’m afraid I can’t do that”.

Peter Charles
August 8, 2019 2:49 pm

No, but I expect all software students to be taught to envision every possible combination when coding for complex mathematical expressions, just as I was. Complete with metaphorical rapped knuckles when I did miss a possibility I might add. 😳😳

John Mann
Reply to  Peter Charles
August 8, 2019 4:18 am

You are completely correct: the expression was deliberately composed in a way to be ambiguous.

Tom in Florida
Reply to  Peter Charles
August 8, 2019 4:54 am

Agree. “2(2+2)” is just another way to express the number 8.
If, on the other hand, it had been written as “8/2 x (2+2)” that would be 16.

Editor
Reply to  Peter Charles
August 8, 2019 6:00 am

Peter ==> This is the opposite of how Strogatz viewed the issue originally — after a lot of review and research, he discovered there is another convention used by many that differentiates between implicit and explicit multiplication — and agrees with you now — with the caveat that the original equation was intentionally ambiguous.

It doesn't add up...
Reply to  Kip Hansen
August 8, 2019 12:33 pm

Just use RPN. Completely unambiguous. It was a reason HP used it on their pocket and programmable calculators – as well as being highly efficient in terms of operations required to calculate a sum.

Clyde Spencer
Reply to  Kip Hansen
August 8, 2019 1:25 pm

My TI-85 graphing calculator knows how to handle parentheses as an implicit multiplication and returns “1” as the answer.

This is as it should be, because when factoring expressions, the common factor is shown typically as “x(x+x)” NOT as “x*(x+x)”. When shown in the second form, which is the only one Excel accepts, the association with the parenthetical expression is lost unless one adds another set of parentheses. This is adding complexity where is shouldn’t be necessary.

Another way of looking at this is as follows:

The original expression can be re-written as: x^3 / ( x^2 + x^2) or x^3 / x(x+x) or x^3 / x(2x)
or x^3 / 2x^2 or, simplifying, x/2

Let x = 2 . Substituting 2 for x; 2 / 2 = 1

If one realizes why the factor immediately precedes the parenthetical expression, then an extra set of parentheses shouldn’t be necessary. The interpretation or order of operations that leads to the most consistent result should be the preferred order.

But, your point about the veracity of what is probably millions of lines of code in GCMs, when something like this could be a bug, points to the need for vetting the code by other than the team that wrote it.

Bregma
Reply to  Clyde Spencer
August 10, 2019 6:27 am

This so-called “implicit multiplication” is a typesetting convention used to beautify textbooks composed using movable type. It’s not a mathematical concept. The programming languages used in GCMs do not read typeset textbooks and more than they do cursive notebooks, so it’s not likely this particular kerfuffle is a source of inaccuracy in the GCMs.

Peter Charles
Reply to  Kip Hansen
August 8, 2019 2:38 pm

It also probably makes a difference that I learned algebraic maths (I’m English) around 55 years ago.

jtom
Reply to  Peter Charles
August 8, 2019 8:21 am

Yes, I agree. I would differentiate between the equation
8 ÷ 2(2+2), and 8 ÷ 2 x (2+2).

The way 2(2+2) is written indicates that it is a single expression, not stand-alone terms.
Math is the symbolic representation if something, and how it is written can give clues to what an equation is representing.

August 8, 2019 10:48 am

I agree, jtom. If x is a variable, and I write 1/2x, I mean 1 divided by 2x, not one-half multiplied by x. In effect, “2x” means “2 of x.” So in BODMAS the implied multiplication has the precedence of the O, and binds tightest of all the operations after bracketing is taken into account.

8 / 2 of (2+2) = 1. No ambiguity at all in my mind.

Frederick Michael
Reply to  Neil Lock
August 8, 2019 9:47 pm

1/2X looks a lot like “one-half X” on my screen.

Clyde Spencer
August 8, 2019 1:56 pm

jtom
+1

Streetcred
August 8, 2019 4:11 pm

With you ! How can it possibly be any different ?!

Reply to  Peter Charles
August 8, 2019 8:22 am

Peter ==>

I’m with you Peter! I got “1” and was surprised that “16” was even possible! Implicit notation has a distinct meaning. There is no operator between the number and the bracketed expression. If you choose to ignore the notation and imagine that there is an invisible multiplication symbol you are going out of your way to create ambiguity!

I do appreciate that the formulation is largely ambiguous but it is also a test of mathematical rigour. That is to say, that to end up with “16” as the answer, you first have to break the rule of implicit notation buy plugging in an operator (Multiplication symbol in this case) that didn’t exist and then go about dutifully ignoring it, so that the terms can be rearranged – left to right – to priorities division! ;-(

coaldust
Reply to  Scott W Bennett
August 8, 2019 11:46 am

No. The rule is if there is no operator, it is an implied multiply operator. That’s the rule. Follow it.

Reply to  Peter Charles
August 8, 2019 8:24 am

As far as implicit multiplication goes, it depends on the compiler writer. I just tried 8/2(2+2) in both Python and R, and they returned errors. There’s a missing operator/invalid function. However, the expression 8/2*(2+2) yields 16.0 in Python and 16 in R.

Jim

D. J. Hawkins
Reply to  Peter Charles
August 8, 2019 10:51 am

Peter;

“I reject your reality and substitute my own!”

Why should implicit multiplication take precedence? I say, NO!

TRM
Reply to  Peter Charles
August 8, 2019 2:27 pm

but it is actually 8 / 2 * 4 so the answer really is 16 🙂

marque2
Reply to  Hans Erren
August 8, 2019 6:36 am

Not clearly expressed in the article is that you evaluate from left to right as well. It can be done in one pass or multiple passes. So the correct answer to your query is 8/2*4 = (8/2) * 4. Because / and * have the same precedence, and going left to right you encounter / first. It gets pretty complicated though, and if you lump in assignment operators, they go right to left. Here is a handy (reasonable) chart with all the operators you would typically see (Not including Trig functions). I didn’t vette this page thoroughly there could be a mistake.
https://www.swansontec.com/sopc.html

Mike Vince
August 8, 2019 3:12 pm

Nuts. That’s like saying 8/48= 8/4*8 =16. 2(2+2) is a single concept, you can’t split 2 away from (2+2) anymore than you can split the 4 from the 8 in 48.

Streetcred
Reply to  Mike Vince
August 8, 2019 4:15 pm

Simply expanded 8/2(2+2) = 8/(2×2+2×2) = 8/((2×2)+(2×2)) = 1

Streetcred
August 8, 2019 4:17 pm

WHY is my comment “awaiting moderation” ???

I have noticed that a lot of my comment do not make it publishing in the blog, WHY ?

Crispin in Waterloo
Reply to  Hans Erren
August 8, 2019 10:05 am

TRM

I define the issue differently.

In the first TI calculation they entered the problem correctly and got 16.

In the second they (effectively) added a second set of parentheses:

8/(2(2 +2)) as is clear from the screenshot

There is no second set of imputed parentheses in

8/2(2+2)

The answer is 16. The only way to get 1 is to mis-program the calculator with parentheses that are not there. The “times” (x) is imputed by arithmetic convention. The second calculator requires that operands be provided. This is not even interesting.

8/2x(2+2) = 16

andrew kerber
Reply to  Hans Erren
August 8, 2019 10:07 am

always multiply before divide. The division bar acts as a separator.

Lowell
Reply to  Hans Erren
August 8, 2019 10:07 am

This fooled me for a moment until I realized that 2(2+2) is really 2*(2+2) at which point I could use the rules of precedence
1) Operations inside a brackets
2) Exponents
3) Division and Multiplication (same order of precedence)
4) Addition and Subtraction (same order of precedence)
If two operations are at the same order of precedence then it is calculated left to right
So its calculated per the orders of precedence
8/2(2+2_) =8/2(4)= 4(4) =16

Dan Cody
August 7, 2019 11:03 pm

What is 666?
That’s the number of the beast.
And 668?
The next-door neighbor of the beast.
What’s 666-point-00000?
That’s the high-precision beast.And zero-point-666 is the Millibeast.
And 1-900-666-6666 is when you can call and talk to a beast,live,one-on-one.
And $665.95 is the retail price of the beast.$669.25 with 5 percent sales tax.
$769.95 with all accessories. charles nelson Reply to Dan Cody August 8, 2019 1:32 am 666b…lives upstairs from The Beast. Jeff Alberts Reply to Dan Cody August 8, 2019 6:47 am This is getting old. tom0mason Reply to Dan Cody August 8, 2019 10:09 am Dan Cody And Romans knew the beast as DCLXVI Whereas for programmers the beast is 1010011010 (binary) or 29A (hexadecimal). auto Reply to Dan Cody August 8, 2019 12:15 pm We all know that 666 is the Number of the Beast -, but did you know that: –$665.99 = Recommended Retail Price of the Beast
$699.25 = Price of the Beast plus 5% sales tax$1879.95 = Price of the Beast, with all accessories
$655.56 = Wal-Mart price of the Beast$654.96 = Tesco price of the Beast – and you get Clubcard points!
$6666.66 = Harrods Price of a very Superior Beast$666 = hourly rate of the Beast’s lawyer
£666 = hourly rate of the Beast’s London lawyer [plus VAT].
$333 = ‘Half off’ sale on the Sign of the Beast 6, uh. . . sorry, what was that number again? = Number of the Blonde Beast 1-900-666-0666 = Live Beasts! Call Now! Only$6.66/minute. Over 18 only please.
£666 666 = Income of the Beast
Route 666 = Highway of the Beast
B666 = by-way of the Beast
E-666 = European Autoroute du Beast/Beaststrasse
666 F = Oven temperature for succulent, well-roast Beast
666 C = Oven temperature for well-charred Beast
$66 = Small joint of Beast 666k = Retirement plan of the Beast 6.66 % = 5 year CD interest rate at First Beast National Bank,$666 minimum deposit.
666MHz = CPU of the Beast
666CSi = BMW of the Beast
668 = Next-door neighbour of the Beast
664 = Next-door neighbour of the Beast, also
667, 665, 663 = close neighbours of the Beast
UB-666 = unemployable Beast claim form
666A, 666B and 666C = Tenants of the beast
999 = Sign of the Australian Beast
333 = Number of the adolescent Beast
6-6-6 = Whyte notation wheel arrangement of the Beast’s Locomotive
6-66 = bowling analysis of the [cricketing] Beast
6-6-6-6 = wheel arrangement of the Big Beast’s Articulated Locomotive
00666 = Zip code of the Beast
HE66 6LL = Post Code of the Beast
BA666 = Flight of the Beast
666.000000 = Beast to 6 decimal places
670 = Beast to 2 significant figures

Some repeats, true.

Auto – with thanks to Dirty Jokes [RIP].

Dan Cody
August 8, 2019 12:26 pm

LOL! You sound like the Beastie Boys!

noaaprogrammer
August 8, 2019 1:59 pm

You forgot the following fact:

The sum of the first 144 digits of Pi is 666.

Dan Cody
August 7, 2019 11:10 pm

What’s a buccaneer? a helluva price for corn!

Don Perry
Reply to  Dan Cody
August 8, 2019 6:24 am

A hearing appendage on the side of your buccanhead.

Dan Cody
August 7, 2019 11:13 pm

What’s the difference between beer nuts and deer nuts?
Beer nuts are \$1.69 and deer nuts are under a buck.

Reply to  Dan Cody
August 8, 2019 9:22 am

What’s the square root of 69?

8 something

Dan Cody
Reply to  Michael Moon
August 8, 2019 9:48 am

LOL! 8 some hair pie.

Dan Cody
August 7, 2019 11:18 pm

If H2O is on the inside of a fire hydrant,What is on the outside? K9P.

secryn
Reply to  Dan Cody
August 8, 2019 8:14 pm

Holy crap, I’m back in 5th grade!

Dan Cody
August 7, 2019 11:20 pm

Alcohol and calculus don’t mix.Never drink and derive.

TonyL
Reply to  Dan Cody
August 8, 2019 1:41 am

Dan Cody:
You are over your head. You also seem to have nothing to contribute.
All of your comments are off topic. Off topic is against the rules, but are often well tolerated anyway. You are pushing it.
Do not treat this site as your own personal jokesters playground.

Dan Cody
August 8, 2019 3:46 am

Tony,you don’t sound good.You sound too serious,lighten up.Life is too short to be too serious.There’s no excuse for your condescending attitude.If you ever even had an ounce of a sense of humor in your being,you wouldn’t have replied so negatively in your remarks toward me.It’s a shame that there are people like you around that turn others off with your complaining and negativity. If you disagree with someone about anything,please do it respectfully without bellyaching about it.Grow up.Lighten up and enjoy life.Feel better Tony. – DC

icisil
Reply to  Dan Cody
August 8, 2019 4:15 am

We like humor with wit and intelligence. Not the mindless regurgitation of cutesy, banal, adolescent-type jokes. Try to exercise that thing between your ears and weave your jokes in with the subject at hand, have the sense to limit your need for attention, and you’ll be better received here.

Dan Cody
August 8, 2019 4:21 am

My comments have been well received by others who have a sense of humor.It seems like you don’t have one judging from your overly serious attitude.Your too caught up in the subject.Take a deep breath and relax.Loosen up and try to be flexible about things and try not to be so uptight about others actions.Life is good.Enjoy it without others getting to you just because your feelings are different from others.Feel better.

TonyL
Reply to  Dan Cody
August 8, 2019 4:16 am

HAHAHAHAHA, Big Joke.
Drop Dead, punk. Grow up
Those stupid “jokes” of yours are three times older than you are.

Dan Cody
August 8, 2019 4:26 am

You just proved my point with your childish attitude.Now you’re getting nasty when your backed into a corner.Tony,if you can’t take the heat,get out of the kitchen.Grow up and stop the name calling an act like an adult instead of having a mindset of a 10 year old.Feel better.

Pat Frank
August 8, 2019 10:13 am

If it’s any compensation, Dan, I thought your series was funny.

Dan Cody
Reply to  Pat Frank
August 8, 2019 10:36 am

Thanks Pat.It’s nice to hear someone with a pleasant reply towards my jokes,not like some people who are just so obnoxiously critical and just plain nasty with the wrong,negative attitude in life.I think some people underestimate the power of a sense of humor in life.It really helps you to enjoy life without taking things TOO seriously.It’s a healthy attribute that relieves stress.

Jeff Alberts
Reply to  Dan Cody
August 8, 2019 6:50 am

People are trying to have a discussion about a specific topic. An on-topic joke is always appreciated, but yours are just stuff you’ve grabbed from a bad joke site, and are just over and over and over again. Why don’t you go to a forum where people appreciate your kind of “humor”?

Dan Cody
Reply to  Jeff Alberts
August 8, 2019 7:19 am

Why don’t you go to a forum where people are taught not to take life too seriously and are taught that trying to have a sense of humor in life leads to a healthier life because humor is good for reducing stress and leads to having a better attitude towards others instead of the negative reply to my comments.Jeff,It sounds like you need to have a more flexible attitude and have a little fun instead of getting too wrapped up in the subjects of discussion here and criticizing others because they ‘go off the beaten path’ a little.Feel better Jeff.

BCBill
August 8, 2019 10:39 am

When I first read Dan’s string of jokes I thought it was a commentary on how repetitive the discussion was becoming. The author of the article established that there were two ways to do the calculation and no amount of “I am right and you are wrong” adds anything further to that point. The article leaves us with the tantalizing question of how different rules might alter the output of models which are created by people who have repeatedly demonstrated themselves to be numerically challenged. That is interesting. Talking loudly and banging the table about which convention is more right, is not interesting. A string of pointless jokes was warranted.

Dan Cody
August 8, 2019 10:48 am

Thanks BCBILL.Well said.It ‘s good to hear from someone with a good head on his shoulders.

Alan
Reply to  Dan Cody
August 8, 2019 7:28 am

Ah go for it Dan, you’re as sick as me

Ouluman
August 7, 2019 11:22 pm

My two-penneth as an old mathematician is that 8/2(2+2) is ambiguous. For clarification I think you would present the question as (2.(2+2))/8 = 1. So the parenthesis dictates what is calculated first to force the multiplication before division takes place.

So I agree with the statement “If you want a clearer answer, ask a clearer question.” But it does open up interesting questions as to which operator (multiplication or division) takes precedence in applications used today.

Phoenix44
August 8, 2019 4:23 am

Seems to be this is wholly contrived. Does such a question exist in the real universe? No.

Editor
August 8, 2019 6:09 am

Ouluman and Pheonix44 ==> The question is contrived — and intentionally ambiguous.

The larger point is that so much of our day lives depends on computers and software calculating all sorts of things that affect out lives — and the rules for doing so seem to be a little undecided.

I was a web programmer for years — and ultimately HTML Czar for some very major web sites. I knew the rules to within in inch of their lives — and heaven help those on the team who violated them. But programmers do violate rules, they do take shortcuts, and for all we know, there are errors abounding in ignorance — the order of operations rules, order of processing, rounding rules, etc etc.

So this essay hopes to point to what is acknowledged to be a real world problem, mostly ignored.

Jack Okie
Reply to  Kip Hansen
August 8, 2019 8:44 am

Hence the importance of unit tests and stringent QA procedures.

Joe Crawford
Reply to  Jack Okie
August 8, 2019 10:50 am

Unit tests, function tests, system test and we still expected 3 to 4 errors per thousand line of code once it reached the field.

Clyde Spencer
Reply to  Kip Hansen
August 8, 2019 1:55 pm

Kip,
Indeed, Excel is known to have bugs and MS has ignored them for years.

Murph
Reply to  Clyde Spencer
August 8, 2019 8:07 pm

MS don’t do Mathematics, they sell software. When using Excel and Access you can’t have too many parentheses.

Michael S. Kelly LS, BSA Ret.
August 8, 2019 7:06 am

Yes.

Go get the HARRY_READ_ME.txt file from the Climategate e-mail trove, available here: http://file.wikileaks.org/file/climactic-research-unit-foi-leaked-data.zip.

Independent Validation and Verification (IV&V) is required for software impacting public safety in most engineering disciplines. But politicians are willing to destroy the entire economy of the world based on nothing other than the kludgey, most assuredly non-IV&Vd crap run by climate “scientists.”

Editor
Reply to  Michael S. Kelly LS, BSA Ret.
August 8, 2019 8:00 am

No need to drag down the .ZIP file, I have it at http://wermenh.com/climate/HARRY_READ_ME.txt

Michael S. Kelly LS, BSA Ret.
Reply to  Ric Werme
August 9, 2019 6:57 am

Thanks, Ric! I didn’t have an alternate source, but this is great.

Editor
Reply to  Michael S. Kelly LS, BSA Ret.
August 8, 2019 12:11 pm

Michael and Ric ==> Thanks, that’s the ClimateGate bit I was referring to.

Imagine now with copy-cat GCMs all churning out the more-or-less same dross — except the Russians! (Who are not so copy-cattish!)

Mike Vince
August 9, 2019 7:35 am

It’s not contrived. As an engineer I often write something like R3/R1(R1+R2) because way back when we were taught that with x(..) the x( takes precedence over multiplication and division.
After all (4+4) = 2(2+2) so 8/(4+4)=1 and having factorized it to 8/2(2+2) the answer must remain 1.
The ambiguity seems to have arisen more recently with acronyms that I’ve never heard of until this came up. Indeed if the intent is 8/2 *(2+2) then write it thus. Or to put it another way the implied multiplication is a higher priority than explicit multiplication.
It bothers me that people could pick up my algebra and mis-interpret something that used to be clear to everyone.
Or is there a US UK difference like with billions? 10^9 as opposed to the correct 10^12.

marque2
August 8, 2019 6:42 am

The whole trick is that if you have a number next to a parantheses it is a multiply but you don’t have to put in the *. If I wrote it 8/2*(2+2) most people would get it right, if they followed standard left to right operation.

In computer programming, we will put extra parentheses around things to make the intent clear rather than rely exclusively on the order of operations . It makes code easier to understand and more readable.

x = (8/2) * (2+2);

Is perfectly acceptable and makes the answer much more clear without having to go to the order of operations table in the beginning of some Stroustrup book.

Editor
August 8, 2019 12:16 pm

marqu ==> Yes, but what if I meant was x = 8 / (2*(2+2))? That’s the rub here — which did the originator mean? Which did the software evaluate when the programmer wrote “8÷2(2 + 2)”?

This is NOT a question of which rules are the proper ones —

Chuck
Reply to  Kip Hansen
August 10, 2019 8:15 am

Kip…A number next to parentheses means multiplication, not another set of parentheses. What I learned nearly half a decade ago was to put a multiplication sign between the number and the parentheses. So x=8/2(2+2) is first clarified as x=8/2*(2+2). It boggles me how someone can come up with a different answer. But then again in today’s world there are lots of things that boggle me including the growing number of people who actually believe the earth is flat.

As for the harder and much more interesting question you pose, I am not nearly qualified enough to answer. What I do know is the science is not settled.

Rolf
August 7, 2019 11:25 pm

Why not ask Greta, I am sure she has an oppinion

ColA
August 7, 2019 11:43 pm

Kip,
Very interesting, type it into Excel as written, =8/2(2+2) and Excel tells you there’s and error and suggest a correction, =8/2*(2+2) which it then answers as 16 !!!

Editor
August 8, 2019 6:11 am

ColA ==> Fascinating, isn’t it. Just when we are on the verge of massive parts of society being controlled by “AI” computers, we find they have such a basic unresolved issue.

Nicholas McGinley
Reply to  Kip Hansen
August 8, 2019 9:16 am

I think there are numerous issues and areas in which machines are greatly inferior to even a simple minded organic intelligence.
Things that a person, and even animals like birds, dogs and cats can do instantly and easily, but machines are baffled by, or simply freeze up or ignore.
Random example:
Remember when that self driving car saw that lady crossing the street but did nothing because…um…it is a machine and only does what you tell it to do?
She was killed even though there was plenty of time to stop.
Machine was not programmed with an emergency override protocol or anything like it.
Which it seems to me ought to be at the most basic level of it’s instructions.
Like the things that we do automatically before we even think about it.

Reply to  Nicholas McGinley
August 12, 2019 7:11 am

100+

ColA
Reply to  Kip Hansen
August 8, 2019 2:26 pm

Kip,

300 odd replies says everyone got something out of this, great work!

I always tell my Junior Engineers to work out the problem by hand before they program or work out the answer by hand because it is so easy with Excel to get your parenthesis wrong and your example proves that very well.

It is easy to see here the difference in results here between 8/(2(2+2))=1 and 8/2*(2+2), but if you get your bracket wrong in something like this it is a lot more difficult to sort it out if you don’t have some idea what the right answer is!!

littlepeaks
August 8, 2019 8:13 am

When I do stuff in Excel, I’m very explicit. I would have typed in =(8/2)*(2+2), if that’s the calculation I wanted to perform.

Mike Haseler (Scottish Sceptic)
August 8, 2019 12:08 am

For years I’ve been adding brackets to all equations where there was any ambiguity … and I didn’t understand why there was ambiguity – and I did keep thinking “perhaps there’s a general rule I should learn to avoid this”.

Finally I understand … one enormous cock up by mathematicians!!!

Editor
Reply to  Mike Haseler (Scottish Sceptic)
August 8, 2019 6:13 am

Scottish ==> You got that right — it is really a programmers error though — an error in the writing out of an equation. My rule has always been “be explicit — don’t imply”.

Mike Vince
Reply to  Kip Hansen
August 9, 2019 3:08 pm

Blame it on the teachers/lecturers.
There is no ambiguity as far as I am concerned, the answer is 1. No one during my education in the 60s saw an ambiguity. Sure we were told to use extra parentheses in the case of ambiguity or programming FORTRAN but the rule was clear implicit multiplication takes precedence or factoring doesn’t work.

Tim Gorman
Reply to  Mike Vince
August 9, 2019 3:37 pm

+10 !!!!

Chuck
Reply to  Mike Vince
August 10, 2019 8:58 am

This is really fascinating how we can have different rules for such a simple thing. During my education in the 60s I was taught that a number besides a parentheses mean multiplication. So to me the is no ambiguity either. x=8/2(2+2) is very simply clarified as x=8/2*(2+2). I’ve never heard of “implicit” when it comes to the order of operations. But I’m definitely not a mathematician.

I like the second question that was posed.

tom0mason
Reply to  Mike Haseler (Scottish Sceptic)
August 8, 2019 10:19 am

Scottish Sceptic,

I too have always added additional parentheses to clarify what was to be done in equations. Often I’ve been criticized for doing so but I as long as I got correct answers I never bothered changing.

bwegher
August 8, 2019 12:13 am

Write the problem with the “8” being the numerator.
Draw a long line under the 8 to separate the numerator from the denominator.
The 2(2+2) term is written as the demominator.

Like any symbolic language, terms can be manipulated to appear paradoxical.

Alastair Brickell
August 8, 2019 1:40 am

bwegher
August 8, 2019 at 12:13 am

Yes you’re right…my take is that it should be 8/(2(2+2))=1.

Kip, many thanks for another interesting post. Those climate “experts” that just let their computer do the thinking for them should take note (but they won’t).

Tom Abbott
Reply to  Alastair Brickell
August 8, 2019 5:23 am

“Those climate “experts” that just let their computer do the thinking for them should take note”

Definitely! Skeptics should also take note.

Kip asked some good questions about the Global Climate Computer Models that need to be answered.

John in Oz
Reply to  Tom Abbott
August 8, 2019 5:54 pm
Editor
Reply to  Alastair Brickell
August 8, 2019 6:15 am

Alastair ==> Yes, it is the greater question — the order of processing in the massively complex and complicated GCMs — that is important.

Duster
August 8, 2019 2:52 am

That is how I would have done it. The 2 outside the brackets in algebraic operations implies a distributive operation on the interior of the brackets before anything else was calculated. That would render 2(x+y) = 2x+2y, so 2(2+2) would be 8. Then the division yields 1. I never had a teacher that would have treated that as ambiguous. I don’t recall for certain, but I belive Reverse Polish notation would render it 22+2*8/ -> 4*2/8 -> 8/8 -> 1.

Sheri
August 8, 2019 5:13 am

Computers changed all that. Pencil and paper were clear. Programming is not.

Editor
August 8, 2019 6:17 am

Sheri ==> Yah — you’d think that all that structure and “rules based” programming languages would have fixed something like this….

Andrew Kerber
August 8, 2019 12:15 am

PEMDAS should always result in 1. The addition is inside parents so that is first. No exponents. Multiply next. That gives us 2*4 or 8 for the right side of the equation. Then the division, so 8/8 or 1. No other result is possible by that method. PEMDAS will always give an answer of 1. Anyone who says otherwise is not applying the rules correctly.

Nicholas McGinley
Reply to  Andrew Kerber
August 8, 2019 9:19 am

The issue is that the rule you are quoting is not the rule that everyone uses and/or was taught to use.

Tim Gorman
Reply to  Nicholas McGinley
August 8, 2019 9:32 am

Any rule that ignores the spaces in the expression is an invalid rule. You can’t ignore the spaces in a handwritten expression. Replace the spaces with parenthesis or brackets and then evaluate it.

D. J. Hawkins
Reply to  Andrew Kerber
August 8, 2019 11:00 am

Disagree. The use of implied multiplication is just a lazy way to avoid writing down the multiplication sign. That’s all. It isn’t somehow a “higher” form of multiplication.

Andrew Kerber
Reply to  D. J. Hawkins
August 8, 2019 12:30 pm

The ‘implied multiplication’ is a red herring. Multiplication is done before division in the rules I learned.

Tim Gorman
Reply to  D. J. Hawkins
August 8, 2019 3:05 pm

“The use of implied multiplication is just a lazy way to avoid writing down the multiplication sign. That’s all. It isn’t somehow a “higher” form of multiplication.”

Really? When my calculus books writes an equation as mx+b then it should actually be written as m*x+b?

I can show you all kinds of math books that will disagree with your view.

The original expression was not written in a computer language. It was written in the form that math expressions have used for generations.

It would seem that far too many people on here think all math expressions must be written in a form conducive to interpretation by a language compiler.

D. J. Hawkins
Reply to  Tim Gorman
August 8, 2019 4:48 pm

I doubt you can show me one math book that disagrees with my view.

When evaluated according to the rule under discussion, “mX + b” will turn out the same as “m x X + b” every time, as in either case “mx” and “m x X” are evaluated before adding “b”.

Tim Gorman
Reply to  D. J. Hawkins
August 8, 2019 9:29 pm

mx + b was not an example of precedence of operators. It was an example of how elements of an equation are grouped in the written form, Which includes the implicit multiplication operator.

The example of x(x+x) has been offered up in this thread multiple times. In the written form of mathematical expression 8 / x(x+x) makes no sense unless x(x+x) is evaluated first because of the implicit operator of multiplication.

If I gave you the expression ʃ x2 / x(x + 1) exactly how would you evaluate it manually?

TimTheToolMan
Reply to  D. J. Hawkins
August 10, 2019 7:41 am

“The example of x(x+x) has been offered up in this thread multiple times.”

And that’s fine, but it doesn’t begin to answer what happens when a term and operator precedes it.

JeffC
August 8, 2019 12:27 am

There is another serious issue when doing calculations on a computer and that is that usually you are allowed a limited number of significant digits. If you for example divide a number by 1000 it is quite possible that you are throwing away 3 significant digits. Any subsequent multiplication will be incorrect. Therefore multiplication should always come first so that BODMAS becomes BOMDAS.

toorightmate
August 8, 2019 4:55 am

You are starting to sound like a mozzie.

Johann Wundersamer
August 8, 2019 12:37 am

And then there’s RPN, reverse polish notation:

Simple answere is: know your tool. And know why you prefer THIS tool.

Steven Crook
Reply to  Johann Wundersamer
August 8, 2019 1:12 am

RPN is what was fed directly into Forth, when having something to parse infix expressions (in an interpreter) was considered too expensive computationally.

The shuntyard method can be used to write a simple infix expression parser. It uses operator priority to determine if something should be pushed onto a stack or if an operator and two operands should be popped off, evaluated and the result pushed back to the stack.

It’s been close to 40 years since I first wrote one (in COBOL – don’t ask)…

Editor
Reply to  Johann Wundersamer
August 8, 2019 6:20 am

Johann Wundersamer ==> In the early days of Chaos Theory, it was discovered that different brands of computers returned wildly different tresults when processing non-linear equation iteratively.

Think of GCMs written for early computers being run, without re-writing thousands of lines of code, on modern computers….

It doesn't add up...
Reply to  Kip Hansen
August 8, 2019 12:45 pm

I found there were some interesting “divergences” in solutions to Limits to Growth models that used 4th order Runge-Kutta methods in the DYNAMO programming language. Being a naive young student, I simply decided to play with the program a bit and soon managed to produce instabilities.

Johann Wundersamer
August 8, 2019 12:44 am

And then there’s RPN, reverse polish notation:

Simple answere is: know your tool. And know why you prefer THIS tool.

https://www.umrechnung.org/hp-rpn-rechner-online/rpn-reverse-polish-notation-rechner.htm

Steven Crook
August 8, 2019 1:03 am

The bane of programmers everywhere.

Should always explicitly include the braces/brackets then there’s no ambiguity and following maintainers are less inclined to make mistakes or misinterpret meaning.

So it should be expressed 8 / (2 * (2 + 2)).

Then the meaning is explicit….

Vuk
August 8, 2019 1:09 am

This short arithmetic quandary reflects the centuries old conflict of two cultures European vs Arabic.
Ancient Greeks and Romans had impracticable numerals and wrote from left to right. Arabs invented present day use numerals but wrote from right to left.
If calculation is performed with the western method of reading from left to right result is 16
If calculation is performed in Arabic way result is 1.

Johann Wundersamer
August 8, 2019 2:36 am

“Ancient Greeks and Romans had impracticable numerals and wrote from left to right.”

____________________________________________

Ancient Greek Mathematics was based on Euclid and Pythagoras.

Euclid brought the Egyptian methods of calculation to Greece: the Egyptian calculation methods were actually based on the evaluation of the length determination and area determination from land surveying for the construction of temples.

When the “0” was introduced in India for administrative calculation problems and calculation tasks for commercial, business tasks, the basis for modern mathematics was laid.

Prjindigo
August 8, 2019 2:57 am

No, the 2 on the front of the (2+2) is a component of the numbers inside the parenthesis, the correct western method is to resolve it to 8/(2×2+2×2), 8/(4+4), 8/8 = 1

Vuk
August 8, 2019 3:25 am

You miss the point. There are number of ways to resolve the problem, some already discussed, but they all involve introducing additional elements, as you did by moving parenthesis about and introducing additional numeral 2, which fundamentally change the original equation.
What I have shown is that if original (not modified !) equation is performed step by step in its original form, the two results conform with western or alternatively arabic way of reading written text.

Prjindigo
August 8, 2019 9:02 am

there are NO other ways to resolve the equation because it is not an equation it is a fraction… I changed nothing in the fraction… ((8))/(((((((2(2+2)))))))) is the same as 8/2(2+2).

The top is literally 2(2+2) to begin with. So what does 2(2+2)/2(2+2) come out to?

Parenthesis ARE the first step, they MUST be resolved first: standard algebraic rule.

Mike Vince
August 9, 2019 4:54 pm

So does (4+4) factorise to 2(2+2)?
If yes the answer is 1. Hint the answer is 1.

LdB
August 8, 2019 3:49 am

Again from above any programmer will tell you the answer is 16 and there programs will all agree because they don’t care about your method or what you were taught at school. It is why the websites and calculators are throwing that up because they just feed the mathematics to the language.

That is the issue there are a number of different standards to how to approach it and just because you were taught it one way does not make the correct answer. It is the old case don’t mix standards and the answer depends on the standard used, it isn’t the maths itself that is changing just the standard used.

Prjindigo
August 8, 2019 9:04 am

No, programmers with a degree also have a mathematics degree and understand from *Grade School* algebra that the parenthesis must be resolved first prior to actions outside the parenthesis.

TomT
August 8, 2019 2:10 pm

Yeap

Noaaprogrammer
August 8, 2019 7:58 pm

Prjindigo, you keep harping about doing the parentheses first, (which is true), but that’s not the issue here. The issue is: In the absence of parentheses, what is the order of evaluation when you have a string of infix operators and operands that are all of the same priority. (Note: multiplication and division have the same priority which is higher than addition and subtraction which also have the same priority.)

So how do you evaluate the string 10/5*3/6*2?
Answer: Evaluate left to right to get 2 (because most western languages are read left to right.)

Notice that I am talking about mathematical expressions constrained to be written linearly as a string, which most computer language compilers/interpreters/etc. require.

When we relax this constraint by allowing mathematical expressions to be written as 2-dimensional expressions (as most mathematicians do) then the division operator may extend itself as a long line (called the vinculum) separating any expression in the numerator over any expression in the denominator. Essentially the vinculum imposes implicit parentheses around the numerator and around the denominator which mathematicians usually omit, but which must be used when linearizing that 2-dimensional expression to be evaluated in some computer language.

Tim Gorman
August 8, 2019 9:49 pm

noaa: “The issue is: In the absence of parentheses”

The issue is that this expression was written as a manual expression like you would see in a math book, not as a line in a computer program.

“Notice that I am talking about mathematical expressions constrained to be written linearly as a string, which most computer language compilers/interpreters/etc. require.”

The expression given is not written linearly as a string.

“When we relax this constraint by allowing mathematical expressions to be written as 2-dimensional expressions (as most mathematicians do)”

Bingo! Everyone getting an answer of 16 is doing so by trying to REWRITE the expression into computer language.

noaaprogrammer
August 11, 2019 10:15 pm

Gormon: “The expression given is not written linearly as a string. ”

It most certainly is written as a string:

8÷2(2+2) = 16 is a mathematical expression written linearly as seen at the top of this particular blog. It matters not where it appears – a math book or a computer science book – the answer is always 16.

8
———- = 1 is a mathematical expression written 2-dimensionaly.
2(2+2)

There’s no mystery here. I’ve been teaching these conventions in university math and computer science courses since 1970.

Tim Gorman
August 12, 2019 4:44 am

noaaprogrammer,

8÷2(2+2)

Why do all programmers leave out the spaces provided in the original post?

8 ÷ 2(2+2) is not the same. The 2(2+2) is separated from the divide operator by a space. Spaces indicate grouping in any language I know, including math! Certainly “thesunisrising” is different than “the sun is rising”.

noaaprogrammer
August 12, 2019 9:59 am

Early computer languages like FORTRAN, Algol, etc., required math expressions to be string-oriented for compilation into machine code, and spaces were used as syntactic delimiters – never as mathematical operators. However later computer languages capable of handling symbolic math expressions would allow implicit multiplication – e.g. 2(2+2) – but I am not aware of any of them using spaces to override the usual left-to-right evaluation of operators of the same priority. (Parentheses are used to do that.)

Neither am I aware of any authoritative, widely accepted rule among mathematicians to use spaces to override the left-to-right evaluation of operators of the same priority – mainly because it can be hard to detect the difference in a complex expression between one space and no space among the many different fonts that allow proportional spacing. Thus mathematicians use parentheses and/or vinculums (as in division and radicals) to denote the order of operator evaluation.

Cite me an authoritative source that states otherwise – e.g. 8(space)÷(space)2(2+2) = 1.

Note: Postfix and Prefix notations are used by some programming languages to simplify such ambiguities in infix notation.

Tim Gorman
August 12, 2019 1:36 pm

Cite me an authoritative source that states otherwise – e.g. 8(space)÷(space)2(2+2) = 1.

How would you evaluate the expression 8y ÷ 2x on a manual basis, no computer, no programming language. Just a straight expression written on a blackboard using chalk with a value for y and a value for x given to you?

I can tell you how every algebra teacher I know would evaluate it.

You keep addressing this as if the expression given was part of a computer program. There was nothing in the original post to indicate such. It looks like an expression out of a basic algebra text.

noaaprogrammer
August 12, 2019 8:28 pm

Gorman: “How would you evaluate the expression 8y ÷ 2x on a manual basis…”

1) Multiply 8 times y,
2) Divide the above result by 2,
3) Multiply the result of step 2 by x.

When any individual is doing a rough back-of-a-napkin calculation they are obviously free to use whatever notation they’re used to. However if I were a proof reader or editor of a book or article that wrote 8y ÷ 2x intending the semantic to be
8y

2x
I would make them write it as 8y ÷ (2x).

Gorman: “You keep addressing this as if the expression given was part of a computer program.”

Yes and No. Because the use of computers is so endemic nowadays, computer science has correctly forced mathematicians to avoid such ambiguities. Computer languages are necessarily designed with unambiguous grammars so that for any given mathematical expression, everyone everywhere will get the same answer every time.

Tim Gorman
August 13, 2019 6:38 am

noaa:

1) Multiply 8 times y,
2) Divide the above result by 2,
3) Multiply the result of step 2 by x.

So in the first element of the equation you follow the convention of implicit multiplication but for the second element you ignore it. That is being inconsistent and illogical. Either implicit multiplication works or it doesn’t.

“I would make them write it as 8y ÷ (2x).”

Why not make them write it as (8*y) ÷ (2*x)? If you are going to require explicit operators then require *all* elements to follow that rule.

“Because the use of computers is so endemic nowadays, computer science has correctly forced mathematicians to avoid such ambiguities.”

Sorry, even modern textbooks still use the implicit multiplication format.

“Computer languages are necessarily designed with unambiguous grammars so that for any given mathematical expression, everyone everywhere will get the same answer every time.”

This is true. That’s because computers are very literal and require very literal statements to evaluate. It is almost impossible to have them differentiate between various writing formats. You simply cannot write enough logical interpretation rules to cover all possible formats. Humans don’t suffer from that foible, at least not as much.

Algebraic expressions have been written in the form of 8y ÷ 2x since algebra was invented. Examples abound in academic, scientific, and engineering treatises, even today. Computer programmers may not like that but the world doesn’t revolve around the wants of computer programmers. Sorry.

noaaprogrammer
August 13, 2019 6:58 pm

Gorman “Why not make them write it as (8*y) ÷ (2*x)? If you are going to require explicit operators then require *all* elements to follow that rule.”

No, using the mathematical convention of juxtaposition of numeric coefficients with letters to implicitly denote multiplications as seen in the numerator is perfectly unambiguous and OK. That’s not the point – (unless you’re writing code in a language that requires a multiplication operator). It is only when you have a string of multiplicative operators (implicit or explicit) of the same priority without parentheses or vinculums, that one is forced to invoke some rule for their order of evaluation, which is left-to-right. So since (ab)/c = a(b/c), it is not necessary to use parentheses until encountering the third operator operating over the 4th operand. (Although not a requirement when programming mathematical expressions, I generally use the fewest symbols possible without compromising clarity.)

How would you evaluate the string: 2+3 – 6–7 ? (Notice the extra spaces around the central minus sign.)

Tim Gorman
August 13, 2019 7:14 pm

“No, using the mathematical convention of juxtaposition of numeric coefficients with letters to implicitly denote multiplications as seen in the numerator is perfectly unambiguous and OK. That’s not the point”

In the numerator? But not in the denominator? Once again you are not being consistent. And that *is* the point.

8y ÷ 2x is the exact same form as the original example. Just set y=1 and x=4. Both expressions should deliver the same answer. If the answer isn’t the same then something is wrong with the way the expression is being read.

“How would you evaluate the string: 2+3 – 6–7 ? (Notice the extra spaces around the central minus sign.)”

Since addition (subtraction) is perfectly associative it doesn’t matter how you evaluate this expression.1: 2-7=-5, 3-6=-3, -5-3=-8. 2: 2-6=-4, 3-7=-4, -4-4=-8. Or 3: 5-13=8. You can do these in any order. You can even write this as 2x+3y-6c-7d and evaluate it as -8 if x=y=c=d=1.

So what? This still doesn’t explain you doing implicit multiplication with one element of the expression but refusing to do implicit multiplication with the second element.

noaaprogrammer
August 13, 2019 10:09 pm

Gorman: “In the numerator? But not in the denominator? Once again you are not being consistent. And that *is* the point.”

It is not a matter of consistency, it is a matter of order of applying the operators to operands. Because we read from left to right it is indeed unnecessary to put parentheses around the 8y which is the numerator. And to reiterate, if your semantic is
8y

2x
then you do need to put parentheses around the 2x: 8y ÷ (2x). Otherwise your semantic is:
8y
— x
2
regardless of how many math books show otherwise.

Gorman: “Since addition (subtraction) is perfectly associative it doesn’t matter how you evaluate this expression.1: 2-7=-5, 3-6=-3, -5-3=-8. 2: 2-6=-4, 3-7=-4, -4-4=-8. Or 3: 5-13= [sic -8] 8.”

Yes addition is associative, but subtraction is not associative (neither is division). Thus the order does matter in which you evaluate the string:

2+3 – 6–7

Again, since there are no parentheses and the operators + and – have the same priority, the rule is to evaluate from left-to-right to get:

2+3 – 6–7 = 5 – 6–7 = -1–7 = -8

Now if I do a right-to-left evaluation, I get:

2+3 – 6–7 = 2+3 – -1 = 2+4 = 6 ≠ -8

If I do the order of operations as you want to do for 8y ÷ 2x, I get:

2+3 – 6–7 = 5 – -1 = 6

So if you want a rule that says that extra spaces surrounding an operator requires that operation be carried out after the other operators, then you’re going to have to accept the result of 6, not -8 as you demonstrated in 3 different ways. And that IS a matter of being consistent.

Tim Gorman
August 14, 2019 6:21 am

“It is not a matter of consistency,”

Of course it is.

“f I do the order of operations as you want to do for 8y ÷ 2x, I get:”

There is no “implicit addition” or “implicit subtraction” rule. You are still showing your programmers bias.

“So if you want a rule that says that extra spaces surrounding an operator requires that operation be carried out after the other operators”

Stop putting words in my mouth. That is *NOT* what I said. I said the spaces in the original expression provide a grouping for the implicit multiplication. A totally different thing. Again, your are still showing your programmers bias.

noaaprogrammer
August 14, 2019 9:41 am

Gorman: “There is no “implicit addition” or “implicit subtraction” rule. You are still showing your programmers bias.”

The implicit or explicit use of any operator has no bearing on the matter other than perhaps suckering a person into an incorrect evaluation of the expression – which is the raison d’être for this particular topic on WUWT. Whether writing the expression as 8y ÷ 2x or as 8*y ÷ 2*x, it should be evaluated the same way in mathematics as well as computer science – unless of course, a widely adopted rule is made which states otherwise, which I’m sure will never be made because it would continue to perpetuate the ambiguity and be inconsistent with current operator precedence rules.

Gorman: “There is no “implicit addition” or “implicit subtraction” rule. You are still showing your programmers bias. … Stop putting words in my mouth. That is *NOT* what I said. I said the spaces in the original expression provide a grouping for the implicit multiplication. “

I was not trying to put words in your mouth. I was merely pointing out your inconsistency of evaluating a string of multiplication and division operators (which have the same priority) from an analogous string of addition and subtraction operators (which have the same priority).

Again, in the absences of any parentheses, what numeric answers do you calculate for the following two expressions and still be consistent in your order of evaluating the two expressions:

1) 2*3 ÷ 2*3 Or, because implicit multiplication between two integers is indistinguishable from positional notation, evaluate:
2x ÷ 2x, where x = 3.

2) 2+3 – 2+3

Note: The linear use of the spacebar for indicating grouping and thus changing the order of operator evaluation without using parentheses is a very dangerous and ambiguous proposition because it is a “white space” operator – i.e. invisible, and unless sufficiently obvious, open to personal interpretation of various readers – as well as the translation of one file to another, particularly between files of different fonts. (For example, I put two spaces around every division operator as well as subtraction operator when typing this response; but I think that once this is posted on the WUWT site, it will be collapsed to just one spacebar.)

John Dilks
August 8, 2019 6:55 pm

LdB,
Wrong, I have been programming in many languages since 1971 and I came up with “1”.
When you go to program an equation into a computer you must translate it from math (algebra, calculus, etc.) to the proper form for the computer language that you are using. If you don’t you get the wrong answer.

TimTheToolMan
August 8, 2019 3:58 am

“the 2 on the front of the (2+2) is a component of the numbers inside the parenthesis”

The 2 on the front has an implied multiplication…of the numbers inside the parenthesis. Its not implied to grouped to them other than the so called “sophisticated convention”. If you can point to an actual mathematical rule that does so, I’d appreciate it.

The actual mathematical rule that gives the answer 16 is well defined.

Prjindigo
August 8, 2019 9:13 am

The actual mathematical rule is that the / sign means it’s a fraction, on the left the enumerator and on the right the denominator and the two are separate numbers… that means the stuff to the right is ALL one denominator and must be resolved prior to any math involving the enumerator.

The fact that some badly programmed calculator comes up with a wrong answer is a symptom of stupidity, don’t let yourself get infected by groupthink and massmoron.

The rules for that “problem” are and have been set out in Algebra books for several hundred years.

*My* Ti85 graphing gets the answer of 1 correctly. It wasn’t manufactured by the lowest bidder in a foreign country. It *is* 28 years old.

D. J. Hawkins
August 8, 2019 11:10 am

The “/” sign is not necessarily a fraction. And it certainly isn’t as you claim in the current case because the whole following string isn’t in parenthesis. The “/” is a lazy shorthand for the divisor symbol.

TomT
August 8, 2019 2:08 pm

Yeap

huls
August 8, 2019 4:58 am

“Arabs invented present day use numerals”
This is a stubborn myth. They are in fact from India. link: [url]https://en.m.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system[/url]

Old Griz
August 8, 2019 1:18 pm

It has always bothered me that we call them Arabic numerals. Then, when you are actually in an Arabic country, they use a different set of numerals. Their numerals look similar the Arabic language symbols.

“Arabic” numerals aren’t Arabic!

commieBob
August 8, 2019 1:16 am

Mathematics, like English, is a language. Math is a lot more precise, but it’s still possible to be ambiguous. In English, if you actually want to convey a precise meaning, you will be careful to create a sentence that avoids ambiguity. That’s also the case with math.

Presumably the equation in question was written with some purpose. That should guide the way you write the equation. If you end up with something ambiguous, you should write the equation a different way.

If I’m programming, I tend to add brackets if there is a problem with readability.

John M. Ware
August 8, 2019 3:03 am

In the English language, word order is important. A good example is the use of the word “only.” Here’s a short sentence with “only” in four different places:

Only I love you. (No one else could possibly love you.)
I only love you. (I don’t like you much, I don’t do anything else to you, but I love you. That’s it.)
I love only you. (I love you, but I don’t love anyone else.)
I love you only. (Same as I love only you, as far as I can tell.)

Four simple sentences, three quite different meanings.

Dodgy Geezer
Reply to  John M. Ware
August 8, 2019 4:46 am

You missed out punctuation.

Only, I love you
Only I love. You?
Only I! Love you?
etc…

Right-Handed Shark
Reply to  Dodgy Geezer
August 8, 2019 12:41 pm

And stress. As in:
WHAT is this thing called love?
What IS this thing called love?
What is THIS thing called, love?

D. J. Hawkins
Reply to  Dodgy Geezer
August 8, 2019 2:08 pm

Dodgy;

I highly recommend Eats, Shoots & Leaves if you have not already come across it.

Clyde Spencer
Reply to  John M. Ware
August 8, 2019 2:10 pm

Benny Hill used to do a routine on how the same words, with different intonation, completely changes the meaning. So, it isn’t just word order!
Benny Hill: “What is this thing called love.”

And then, even though Yoda mangles usual English, understand him we do.

Editor
August 8, 2019 6:24 am

commie ==> There is no doubt that the original equation was intentionally written to be ambiguous and to create a stir — which I think is a grand idea as it points out an interesting and disturbing problem within the programming and computing arena.

bernie1815
Reply to  Kip Hansen
August 8, 2019 12:39 pm

I agree that somebody is simply trading on the inherent ambiguity of the order of operations. As others have noted the statement is inherently ambiguous and because the order of operations is fundamentally arbitrary these debates will come up again and again. The answer would probably be unambiguous if the expression was written to reflect a real situation as opposed to an abstract statement.

Tim Gorman
Reply to  Kip Hansen
August 8, 2019 3:11 pm

Kip,

The expression is no more ambiguous than the expression mx+b which can be found in every advanced math book I own.

There is no difference between 2(2+2) and mx.

The image given shows an expression written on a black board and nothing indicates it is part of a computer program meant to be interpreted by a language compiler.

TonyL
August 8, 2019 1:28 am

I agree with Kip, the answer can be 1 or 16. Depending, of course.
However
The Correct answer, of course is 16.
All other answers are Wrong. Not faulty, not flawed, Just Plain Wrong.
It should be noted that the question itself is In Error.
The construct:
8/2(2+2)
is correctly interpreted as a function call, but 8/2 is not a legitimate function pointer, so an error is generated.
The correct form is:
8/2*(2+2)
Now it is unambiguous. The multiplication and division are equal priority, and so proceeds left to right.
This order is very, very important. Without this standard, modern computer programming and computation would be impossible.
Both factors, the pointer error, and the calculation order are reflected in such vastly different languages as C and R, and probably many others as well.
As ColA notes, exactly the same 2 issues apply in Excel, which means something extraordinary has occurred. That is, that Microsoft actually got something right!
The fact that somebody, somewhere got some old fringe “standard” from out of the past and scraped the mold off of it hardly makes a worthwhile controversy.

Editor
August 8, 2019 6:28 am

TonyL ==> Strogatz, professor of mathematics at Cornell and author of deep mathematics books, thought as you did, then changed his mind.

Things that seem very certain to us can be seen in a different light with enough effort.

The most correct thing is to re-write the question to eliminate the ambiguity.

TonyL
Reply to  Kip Hansen
August 8, 2019 8:28 am

Just having fun with getting a bit dogmatic. I note below that the standard in Algebra is great because there are so many to choose from.
Interesting, that in *math*, multiple answers were obtained and defended.
In computer languages, the question was universally rejected with an error.
I found that to be interesting.

Editor
August 8, 2019 8:40 am

Every platform I’ve tried so far yields an error for 8/2(2+2) or won’t even let me enter anything past the first 2.

Every platform I’ve tried so far yields 16 for 8/2*(2+2)… Granted, I don’t have any of my 1970’s vintage calculators handy.

Murph
Reply to  David Middleton
August 8, 2019 8:39 pm

I used my 1970’s vintage pencil and paper and the answer is unequivocally 1.

The equation uses algebraic notation, so must be resolved using algebraic rules. The 2 outside the parentheses applies to the values inside the parentheses, and expansion must be done before resolution, 2(2+2) = (2*2)+(2*2)

Alastair Brickell
August 8, 2019 1:30 am

Thanks for another very interesting post and a good discussion of a topic that is probably under addressed.

It does suggest that too many people may be just letting the computer do the thinking for them…especially those in climate science.

My take is that it should be written as 8/(2(2+2))=1; but others may differ.

Tom Abbott
Reply to  Alastair Brickell
August 8, 2019 5:35 am

“Thanks for another very interesting post and a good discussion of a topic that is probably under addressed.”

Editor
Reply to  Alastair Brickell
August 8, 2019 8:43 am

It’s not a matter of should.

8/(2*(2+2))=1 Correct
8/2*(2+2)=16 Correct
(8/2)*(2+2)=16 Correct
8/2(2+2) = Malformed expression

Clyde Spencer
Reply to  David Middleton
August 8, 2019 2:26 pm

David,
Note that you have introduced a multiplication symbol for your first three equations. That symbol was not present in the original formulation. You have made an assumption that the multiplication symbol should be used. Your introduced parentheses for the first and third equations are forcing the hierarchy of calculation because operations with parentheses take precedence over all other operations.

When the original formula (without the multiplication symbol!) is entered into a TI-85, it recognizes the implied multiplication associated with the parenthetical expression, and returns “1” as the answer.

I would say that the platform that returned “malformed expression” was not sophisticated enough to recognize and properly handle the implied multiplication.

See my remark above with the algebraic justification.

John Dilks
Reply to  David Middleton
August 8, 2019 7:03 pm

The ambiguity only lies in computer programming of it. It is not ambiguous in math. Not all math equations can be directly typed into a calculator or into a computer program.

Tim Gorman
Reply to  John Dilks
August 8, 2019 9:33 pm

John Dilks: “The ambiguity only lies in computer programming of it. It is not ambiguous in math. Not all math equations can be directly typed into a calculator or into a computer program.”

+1

tom0mason
Reply to  Alastair Brickell
August 8, 2019 10:47 am

8 ÷ 2(2+2) = ?
Maybe it should be (8÷2)*(2+2)=16 , though to me it is as valid to write it as 8÷(2(2+2))=1
How to interpret ? Without the context of what these number are supposed to represent I can’t tell.

Clyde Spencer
August 8, 2019 2:43 pm

tom0mason
It may well be that the formula is written improperly if the intent was to represent something real. However, the absence of an explicit multiplication symbol tells me that the multiplication is an implicit association of the multiplier with the contents of the parentheses. Adding explicit multiplication that was not originally present is a leap too far and more of a change than simply adding another set of parentheses to make the implied association explicit for those calculators that aren’t sophisticated enough to handle parentheses in the absence of an additional set of parentheses.

A C Osborn
August 8, 2019 1:37 am

Just think of how serious this could be in Science and Engineering when you could have a error factor of 16 to 1.
The problem is how it is written if it was written as 8 over 2(2+2) which is what the / symbol actually specifies it always comes out as 1.

Reply to  A C Osborn
August 8, 2019 3:42 am

Which is the way I was taught in the dim and distant days before primary school pupils had access to keyboards, computers, and smart phones.

We didn’t use the / sign; anything that involved division had a part above the — and a part below. The only reason for using the / is that it is virtually impossible for any keyboard to handle division using a —!

All elements of both numerator and denominator are calculated according to the principle of brackets first but thereafter operands should be equal l to r as they should be in the absence of brackets. I would expect 8+3*4 to resolve as 44; 8+(3*4) should resolve as 20. Unfortunately simple calculators even on smart phones can’t handle this because they lack the bracket and you’re reduced to 8+3=11*4=44. But whichever way you do it where division is involved the two parts need to be resolved first.

Editor
Reply to  A C Osborn
August 8, 2019 8:48 am

I don’t have access to any 1970’s vintage calculators at the moment… But every digital platform in my office (Wndows PC calculator , Linux, Droid smart phone calculator app, Mircosoft Excel) yields one answer.

8/2*(2+2)=16
8/2(2+2) = Malformed expression or some other error indication

Mike
Reply to  David Middleton
August 8, 2019 10:37 am

The * is implicit by 2(2+2) = 2*(2+2)

Mike
August 9, 2019 1:25 am

I will explain.

To those that are getting 16 they are using;
8/2(2+2)=16
So the first part is 8/2 = 4
Then this is replaced in the equation
4(2+2) = 16

But look! 4(2+2) the * is implicit again as 4*(2+2) so the same must be true for 2(2+2)

Izaak Walton
August 8, 2019 1:40 am

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.

Editor
Reply to  Izaak Walton
August 8, 2019 7:35 am

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.

Izaak Walton
Reply to  Kip Hansen
August 8, 2019 11:37 am

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.

Editor
Reply to  Izaak Walton
August 8, 2019 12:22 pm

Izaak ==> well, at least we know your opinions on the matter. can’t say I agree though.

Izaak Walton
Reply to  Kip Hansen
August 8, 2019 8:07 pm

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.

D. J. Hawkins
Reply to  Izaak Walton
August 8, 2019 3:54 pm

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.

TimTheToolMan
August 8, 2019 1:44 am

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.

Editor
August 8, 2019 8:08 am

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.

Chm
August 8, 2019 10:11 am

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 ?

D. J. Hawkins
August 8, 2019 4:03 pm

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) = ?

Murph
Reply to  D. J. Hawkins
August 8, 2019 8:46 pm

but 2(a+b) = (2a+2b), hence 8/2(2+2) = 8/(4+4) = 1
QED

D. J. Hawkins
August 13, 2019 5:42 pm

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

Tim Gorman
Reply to  D. J. Hawkins
August 13, 2019 6:49 pm

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?

TimTheToolMan
August 14, 2019 3:59 am

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

Tim Gorman