Skip to content
BetterDL

Operator precedence

Also called: precedence, order of operations, Boolean precedence, NOT AND OR order

The rule for which Boolean operation is done first when there are no brackets: NOT first, then AND, then OR.

When an expression mixes operators, you need to know which one binds tightest. Boolean algebra uses the same idea as arithmetic, where × comes before +:

  1. NOT (the bar or prime) first,
  2. then AND (letters side by side, or ·),
  3. then OR (+).

So means A OR (B AND (NOT C)). Brackets override the order: does the OR first.

A long bar acts like brackets. In you work out first and then flip the result. A short bar covers only the one letter under it, so flips only B.

Why it matters: the same letters grouped differently give different functions. Many errors, especially when typing answers or applying de morgans laws, come from regrouping by accident. If you are unsure, add brackets: they never hurt.

00000
00100
01000
01111
10010
10111
11010
11111

Worked examples

Example

Grouping and evaluating [[A + BC']]

Evaluate at A = 0, B = 1, C = 0.

  1. 1.

    NOT: C = 0, so = 1.

  2. 2.

    AND: = 1 · 1 = 1.

  3. 3.

    OR: 0 + 1 = 1.

  4. 4.

    Result: 1.

Example

Same letters, different grouping

Compare with at A = 1, B = 0, C = 0.

  1. 1.

    : AND first gives = 0, then 1 + 0 = 1.

  2. 2.

    : the bracket first gives 1 + 0 = 1, then 1 · 0 = 0.

  3. 3.

    The outputs differ, so the two expressions are different functions. The truth table above shows they disagree in rows 100 and 110.

Common mistakes

  • Reading left to right. is not (A + B)C; AND comes before OR.

  • Stretching a short bar. In the bar covers only B, so it is not .

  • Dropping brackets after De Morgan. becomes , but needs , with the brackets kept.

Practice Operator precedence

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Operator precedence is taught in Boolean Algebra.