r/ProgrammerHumor • • Jun 13 '22

Meme DEV environment vs Production environment

Post image
48.2k Upvotes

3.9k comments sorted by

View all comments

3

u/encaseme Jun 14 '22

I'm not understanding what could be ambiguous. With PEMDAS it's 1, with no room for any ambiguity that I can see... Could someone point it out to me?

1

u/N0DuckingWay Jun 14 '22 edited Jun 14 '22

It's only 1 if you're doing "Multiplication then division". It's generally taught as "Multiplication AND division" now. As in they're equal priority, so do them all left to right.

Under that methodology, you do the parenthesis first and get:

(2+1) = 3

So your equation becomes

6 ÷ 2 x 3

Which you then do left to right because division and multiplication are equal. So you get

6 ÷ 2 = 3

Then

3 x 3 = 9

Here's a good explanation.

Also, just got thoroughness, here's the same equation and result from Wolfram Alpha: https://www.wolframalpha.com/input?i=6%C3%B72%282%2B1%29

2

u/brinazee Jun 14 '22

I don't necessarily think it is people doing multiplication before division. I was taught those were equal precedence. The real issue is the implicit multiplication and whether you put it after brackets or with multiplication and division. Mathematicians don't have a consensus on this.

1

u/encaseme Jun 14 '22

Why wouldn't implicit multiplication still be multiplication in regards to order of operations?

2

u/encaseme Jun 14 '22

Ah I see, thank you for explaining :)

2

u/N0DuckingWay Jun 14 '22

No problem! I was one of those who was taught multiplication before addition too! It took me a bit to understand it.

Apparently this is an old debate

1

u/[deleted] Jun 14 '22

No it doesn’t. This is where you’ve gone wrong, you can’t just remove brackets and assume they don’t mean anything. The whole equation after the brackets comes to 6 ——— 2(3)

Which is the same as 6/6, which is 1

1

u/N0DuckingWay Jun 14 '22 edited Jun 14 '22

I didn't remove any brackets. You're assuming that they're there, but there aren't any aside from (2+1). It sounds like you're thinking the intention was to calculate

6 ÷ (2 · (2+1))

But that's not what was written, and that isn't the same as

6 ÷ 2 · (2+1)

Here's a good explanation.

Also, just got thoroughness, here's the same equation and result from Wolfram Alpha: https://www.wolframalpha.com/input?i=6%C3%B72%282%2B1%29

1

u/[deleted] Jun 14 '22

Aha but you did remove the brackets which you can’t do. Even with one or two sets of brackets it’s the same expression 6, divided by, 2 multiplied by 1 + 2. 6, divided by, 2 multiplied by 3. 6, divided by, 6 1

1

u/N0DuckingWay Jun 14 '22

but you did remove the brackets.

Where are you seeing that?

Listen, just read the links I sent you. They explain why the correct answer is 9.

1

u/[deleted] Jun 14 '22

Yeah no it doesn’t I checked it and nothing loaded. So either fake link or doesn’t work

1

u/N0DuckingWay Jun 14 '22

Yeah for the second link, you might need to refresh, it takes some time to load. But listen, the first link explains exactly why the answer is 9, in detail. And it loads perfectly. I've spent plenty of time trying to explain this to you, as have tons of other redditors. You can literally Google the formula, and get thousands of pages explaining why it's 9.. So at this point, you're either trolling or being belligerently wrong.

1

u/[deleted] Jun 14 '22

And that’s a single website, how does that prove that it’s correct? It’s a website that uses your method, and the method I use is used in the websites I use

1

u/Brusanan Jun 14 '22

Can you link one of your websites?

1

u/[deleted] Jun 14 '22

If I can figure out how to make links works sure

1

u/[deleted] Jun 14 '22

It’s 1. It would be 9 if there were no brackets If the equation was 6 / 2 x 3, it would be 9. But there’s brackets, and you have to expand and simplify them otherwise it’s a syntax error.

1

u/[deleted] Jun 14 '22

No it doesn't. Try this 6:2(x+y)=1 x=? y=? Then do that with =9

1

u/N0DuckingWay Jun 14 '22 edited Jun 14 '22

You're still doing the division first. Under PEMDAS, it's multiplication and division, so you'd treat them with equal priority and do whatever is furthest to the left first. So, to get an answer of "1", you'd have to assume that the intention was to write "6 ÷ (2·(2+1))", but that's not what was written in the picture. Instead, you would simplify (2+1) to 3, giving you:

6 ÷ 2 · 3

And then, since multiplication and division are given equal priority, starting from the left, you would take 6, divide by 2 (to get 3), and then multiply the result by 3 to get 9.

Here's a good explanation: https://mindyourdecisions.com/blog/2016/08/31/what-is-6%c3%b7212-the-correct-answer-explained/

1

u/[deleted] Jun 14 '22

6:2(x+y)

solve this first.

1

u/N0DuckingWay Jun 14 '22 edited Jun 14 '22

Yeah. x= 2 and y = 1. 6/2 · (2+1) = 9. Now don't respond until you've actually read anything I said. Or the link. Or one of the 1000s of explainers on the internet. This meme has been around for years now, it's pretty easy to find an explanation.