this post was submitted on 03 Dec 2023
421 points (100.0% liked)

196

16549 readers
2018 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] a_fine_hound@lemmy.world 33 points 11 months ago* (last edited 11 months ago) (4 children)

Well that's just wrong... Multiplication and division have equal priorities so they are done from left to right. So: 8 / 2 * (2 + 2)=8 / 2 * 4=4 * 4=16

[–] lugal@sopuli.xyz 8 points 11 months ago

This but unironically

[–] Cornelius_Wangenheim@lemmy.world 6 points 11 months ago (1 children)

Implicit multiplication takes priority over explicit multiplication or division. 2(2+2) is not the same thing as 2*(2+2).

[–] SmartmanApps@programming.dev 2 points 8 months ago* (last edited 8 months ago)

Correct! 2(2+2) is a single term - subject to The Distributive Law - and 2x(2+2) is 2 terms. Those who added a multiply sign there have effectively flipped the (2+2) from being in the denominator to being in the numerator, hence the wrong answer.

But it's not called "implicit multiplication" - it's Terms and/or The Distributive Law which applies (and they're 2 separate rules, so you cannot lump them together as a single rule).

[–] nutcase2690@lemmy.dbzer0.com 4 points 11 months ago (2 children)

Not quite, pemdas can go either from the left or right (as long as you are consistent) and division is the same priority as multiplication because dividing by something is equal to multiplying by the inverse of that thing... same as subtraction being just addition but you flip the sign.

8×1/2=8/2 1-1=1+(-1)

The result is 16 if you rewrite the problem with this in mind: 8÷2(2+2)=8×(1/2)×(2+2)

[–] Omega_Jimes@lemmy.ca 9 points 11 months ago (2 children)

I've never had anyone tell me operations with the same priority can be done either way, it's always been left to right.

[–] nutcase2690@lemmy.dbzer0.com 4 points 11 months ago (1 children)

I've always heard it that way too but I think it is for consistency with students, imo Logically, if you are looking at division = multiplying by inverse and subtraction = adding the negative, you should be able to do it both ways. Addition and multiplication are both associative, so we can do 1+2+3 = (1+2)+3 = 1+(2+3) and get the same answer.

[–] ReveredOxygen@sh.itjust.works 1 points 11 months ago (2 children)

But subtraction and division are not associative. Any time you work on paper, 2 - 2 - 2 would equal -2. That is, (2-2)-2=0-2=-2. If you evaluate right to left, you get 2-2-2=2-(2-2)=2-0=2

[–] nutcase2690@lemmy.dbzer0.com 3 points 11 months ago

Correct, subtraction and division are not associative. However, what is subtraction if not adding the opposite of a number? Or division if not multiplying the inverse? And addition and multiplication are associative.

2-2-2 can be written as 2 + (-2) + (-2) which would equal -2 no matter if you solve left to right, or right to left.

In your example with the formula from right to left, distributing the negative sign reveals that the base equation was changed, so it makes sense that you saw a different answer.

2 - (2 - 2) = 2 + ((-2) + 2) = 2

[–] SmartmanApps@programming.dev 2 points 8 months ago

2-(2-2)

But you broke the rule of left-associativity there. You can go right to left provided you keep each number with the sign to it's left (and you didn't do that when you separated the first 2 in brackets from it's minus sign).

[–] SmartmanApps@programming.dev 2 points 8 months ago

I’ve never had anyone tell me operations with the same priority can be done either way, it’s always been left to right

It's left to right within each operator. You can do multiplication first and division next, or the other way around, as long as you do each operator left to right. Having said that, you also can do the whole group of equal precedence operators left to right - because you're still preserving left to right for each of the two operators - so you can do multiplication and division left to right at the same time, because they have equal precedence.

Having said that, it's an actual rule for division, but optional for the rest. The actual rule is you have to preserve left-associativity - i.e. a number is associated with the sign to the left of it - and going left to right is an easy way to do that.

[–] SmartmanApps@programming.dev 2 points 8 months ago

8÷2(2+2)=8×(1/2)×(2+2)

No, that's wrong. 2(2+2) is a single term, and thus entirely in the denominator. When you separated the coefficient you flipped the (2+2) into the numerator, hence the wrong answer. You must never add multiplication signs where there are none.

[–] SmartmanApps@programming.dev 1 points 8 months ago

8 / 2 * (2 + 2)

That's not the same as 8 / 2 (2 + 2). In the original question, 2(2+2) is a single term in the denominator, when you added the multiply you separated it and thus flipped the (2+2) to be in the numerator, hence the wrong answer.