Or formally titled Order of operations on wikipedia, it covers the topic that, in mathematics and most computer languages, multiplication is done before addition.
2 + 3 × 4
The answer is 14. Brackets, ( and ), { and }, or [ and ], which have their own rules, may be used to avoid confusion, thus the preceding expression may also be rendered
2 + (3 × 4)
but the brackets are unnecessary as multiplication still has precedence without them.
Since the introduction of modern algebraic notation, multiplication has taken precedence over addition. Thus
3 + 4 × 5 = 4 × 5 + 3 = 23
When exponents were first introduced in the 16th and 17th centuries, exponents took precedence over both addition and multiplication and could be placed only as a superscript to the right of their base. Thus
3 + 52 = 28 and 3 × 52 = 75
To change the order of operations, originally a vinculum (an overline or underline) was used. Today, parentheses or brackets are used to explicitly denote precedence by grouping parts of an expression that should be evaluated first.
Thus, to force addition to precede multiplication, we write (2 + 3) × 4 = 20, and to force addition to precede exponentiation, we write (3 + 5)2 = 64.
Mnemonics are often used to help students remember the rules, but the rules taught by the use of acronyms can be misleading.
These mnemonics may be misleading when written this way, especially if the user is not aware that multiplication and division are of equal precedence, as are addition and subtraction. Using any of the above rules in the order "addition first, subtraction afterward" would also give the wrong answer to the problem:
10 - 3 + 2 \,.
The correct answer is 9 (and not 5, which we get when we do the addition first and then the subtraction). The best way to understand a combination of addition and subtraction is to think of the subtraction as addition of a negative number. In this case, we see the problem as the sum of positive ten, negative three, and positive two:
10 + (-3) + 2
To emphasize that addition and subtraction have the same precedence (and multiplication and division have the same precedence) the mnemonic is sometimes written P E MD AS; or, simply as PEMA.
All of these acronyms conflate two different ideas, operations on the one hand and symbols of grouping on the other, which can lead to confusion.
Of course, we lispers, know the source of this confusion. The solution is simple: group related on operation and prefix notation will solve the ambiguity:
(= (+ 10 -3 2) 9) ;=> true