I know that this is potentially very basic but we've actually had a bit of a discussion regarding whether this is 28 or 22! My view is that the order of operations is to add negative five and negative three together and then compute 20-(-8). However, looking online there is a variety of accepted answers based on computer science and logic etc where addition and subtraction are given equal weighting and, if the calculation is a mixture of addition and subtraction (only) is read from left to right. Does anybody have a definitive response to this please?
What is the result of 20--5+-3
116 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
Addition and subtraction are prioritised equally, and evaluated from left to right (note that things aren't nearly as clear-cut with multiplication and division, so there one should always use parentheses or fractions to make things clear). Thus the correct order of operations is to start with $20$, subtract $-5$ to get $25$, then add $-3$ to get $22$.
Alternatively, the binary operation $-$ can be seen as just a shorthand for "${}+(-1)\times{}$". Using your example again, this would make $20 - -5 + -3$ (which must be read as $20 - (-5) + (-3)$, as discussed in other answers and comments) into $$ 20 + (-1)\times(-5) + (-3) $$ Doing the multiplication first, we get $20 + 5 + (-3)$, and now the answer is unambiguously $22$. In this interpretation, there isn't really any such thing as "subtraction", which may seem weird, but it actually works pretty well if you get used to it. This is the mental model I use for subtraction some times, but I very rarely actually write it out this way. I just keep the translation in mind every time I write something which "looks like" a subtraction.
Having two minuses after each other like this $1--1$ is bad form, and should be avoided as it is confusing. Regardless, this is always interpreted as $1-(-1)$. In the same way we always have $1+-1 = 1+(-1)$.
This however still does not resolve the other problem you've discovered, since if addition is more important than subtraction, you get $$ 20-(-5)+(-3) = 20-((-5)+(-3)), $$ which is plain wrong. Traditionally addition is considered to have the same precedence as subtraction, but if you must have them different, then subtraction must be first. This way we have $$20-(-5)+(-3) = (20-(-5))+(-3),$$ which is indeed correct.
Be aware that PEMDAS appears to get this wrong, this is because in PEMDAS, you are meant to consider addition and subtraction to have equal precedence, and not addition before subtraction. Note that equal precedence always gives the same answer as having subtraction first. The exact same problem happens with multiplication and division. Read more
I guess PEDMSA just isn't as catchy.