I understand what you're saying but it s really weird that it d work with multiplication and division and not with substraction and addition. What confused me the most is its in total contradiction with the PEMDAS rule. I replaced by 5 3 and 4 too and of course if you put logic into it you cant go wrong but its just weird
Actually, it's just as I'd expect.
We say that multiplication distributes over addition, a(b+c) = ab + ac; and exponentiation distributes over multiplication, (a*b)^c = a^c * b^c; but we wouldn't expect that exponentiation would also distribute over addition, (a+b)^c = a^c + b^c. Each has its own place.
And the PEMDAS "rule" is just a statement of how we interpret expressions; how numbers themselves work can't contradict that, any more than a statement about science could contradict the grammar of the language we are writing in. PEMDAS just says that [MATH]\sqrt{x^2 + y^2}[/MATH]
means to square, then add, then take a square root; we can't do the square root before the addition unless some property of numbers tells us that those two different expressions have the same value -- and they don't.
However, it happens (ultimately, I think, for good reasons) that they fit together nicely: PEMDAS tells us that Exponentiation is more powerful in some sense than Multiplication (and Division), and Multiplication (and Division) is more powerful than Addition (and Subtraction) -- and those are exactly the relationships in which operations distribute!