Kalirren
Kalirren t1_iycayo7 wrote
Reply to comment by SirX86 in ELI5 why we first multiply, then add by TheManNamedPeterPan
And the answer to the "why" is because exponentiation distributes over multiplication, and not the other way around, just like multiplication distributes over addition.
xy^(2) = x*(y^2) = x*y^2 != (x*y)^2 = (xy)^(2) = x^(2)y^(2)
x*(y^2) != (x*y) ^ (x*2)
Kalirren t1_iyc9jnx wrote
Reply to comment by RJC024 in ELI5 why we first multiply, then add by TheManNamedPeterPan
Nope. Subtraction is adding the additive inverse and doesn't distribute over multiplication. The reason why we have PEMA is because Exponentiation distributes over Multiplication and Multiplication distributes over Addition and Parentheses break those rules so you have to do the Parentheses first.
Kalirren t1_iyc8k40 wrote
The real reason why we do this is so that we can write DISTRIBUTION neatly.
(4+5)*6 = 4*6 + 5*6
See how I didn't have to write the right side of that with any parentheses at all?
If we had pure left-to-right order of operations, I'd have had to write
(4+5)*6 = (4*6) + (5*6)
which is much uglier.
Note also that * distributes over +, but + doesn't distribute over *:
4+(5*6) != (4+5) * (4+6)
So there's no advantage of less parentheses in assuming that + should be the first operation you perform.
Similarly, exponentiation distributes over multiplication. That's why the usual order of operations is PEMA:
P (exceptions before general rules)
E (^ distributes over *)
M (* distributes over +)
A
Kalirren t1_iycbj65 wrote
Reply to comment by Way2Foxy in ELI5 why we first multiply, then add by TheManNamedPeterPan
No, there -is- something forcing us to do it this way: * distributes over + but + doesn't distribute over *. So if you want to write the distributive property a*(b+c) = a*b+a*c you don't have to use ANY parentheses if you do * before +. And there's no reason why you would try to do it the other way because a+(b*c) != (a+b) * (a+c).