Precedence of operators
In simple algebra, there is a set of precedence (priority) of operations that should be respected in order that everyone evaluates mathematical expressions in the same way. Although these rules have been taught in elementary school or junior high school, they are often overlooked.
Here's a review of operators from highest precedence (to be evaluated firt) to lowest.
1. Brackets (parentheses)
2. Exponentiation & roots
3. Multiplication/division
4. Addition/Subtraction.
This set of rules may be abbreviated as BEDMAS for ease of memorization.
When operators of equal precedence are encountered side-by-side, they are evaluated from left to right.
For example, this is how a calculator evaluates the following expression:
2.5+5²*(4+3)/2
=2.5+5²*7/2 ...brackets first
=2.5+25*7/2 ... exponentiation
=2.5+175/2 ... multiplication is to the left of division
=2.5+82.5 .... division before addition
=85
Also, note that in square-roots, the expression under the horizontal bar is equivalent to a set of implicit parentheses. For example, if the whole expression 5³+4*7-1/2 were under the square-root sign, it would be interpreted as:
√(5³+4*7-1/2)
Another frequent oversight has to do with fractions.
Fractions in typeset expressions have the numerator and denominator separated by a horizontal line, such as:
5x²+3x-2
-------------
2x²-x+1
When transcribing fractions to a single line, such as evaluating on a calculator, or posting the expression online, we have to recognize that there are implicit parentheses in both the numerator and denominator. The transcribed one-line expression must have parentheses (brackets) around each of the numerator and denominator, such as:
(5x²+3x-2)/(2x²-x+1)
or else it will be incorrectly interpreted using the BEDMAS rule indicated earlier.
Thus the expression
x+5
---
x+3
would be correctly interpreted as (x+5)/(x+3).
A side note for logical expressions:
====================================
The precedence rule for logical expressions are:
Precedence Operator
1 ¬
2 ∧
3 ∨
4 →
5 ↔
For example:
¬p∧q∨p∧¬q↔T
means
((¬p)∧q)∨(p∧(¬q))↔T