Any part of an expression inside parentheses or brackets is always completed first. Within the parentheses, the order of operations is followed as normal from left to right. When multiple sets of parentheses are present, evaluate the innermost set first. For example:
4+5*(10/2+2)-3^2
4+5*(5+2)-3^2
4+5*(7)-3^2
Exponents are second in the order of operations, evaluated from left to right. For example:
4+5*(7)-3^2
4+5*(7)-9
The third order is for multiplication and division, evaluated from left to right. To continue the example:
4+5*(7)-9
4+35-9
The fourth and final step in the order of operations is addition and subtraction, evaluated from left to right. To complete the example:
4+35-9
39-9
30
An expression including a fraction is a special case. The numerator and denominator are both evaluated individually according to the order of operations before considering the fraction.
An expression containing variables is evaluated according to the normal order of operations. The order still progresses from left to right, but if you cannot fully evaluate an operation because of a variable, skip it and continue. For example:
3x-(5^2-3)+8/2
3x-(25-3)+8/2
3x-(22)+8/2
3x-(22)+4
3x-26