Skip to content
BetterDL

Boolean expression

Also called: Boolean expressions, logic expression, logical expression, switching expression, Boolean formula

A formula built from Boolean variables, the constants 0 and 1, and the operators AND, OR and NOT, such as A'B + C.

A Boolean expression combines variables, the constants 0 and 1, and operators into a formula whose value is always 0 or 1. Examples: , , .

In this course:

  • AND is written by putting letters side by side, AB, or with a dot, A·B.
  • OR is written A + B.
  • NOT is a bar over what it covers, typed as a prime: A' or (AB)'.

Operators follow operator precedence: NOT, then AND, then OR, with brackets and long bars overriding.

An expression and a circuit are two views of the same thing. Each operator is a gate and each variable is an input wire, so is a NOT, an AND and an OR.

Many different expressions describe the same boolean function: and A behave identically. The whole point of boolean simplification is to find the cheapest expression for a given function, using the laws of boolean algebra.

0000
0011
0101
0111
1000
1011
1100
1111

Worked example

Example

From words to an expression

A fan runs when it is hot and the window is closed, or when the override switch is on. Let H = hot, W = window open, S = override.

  1. 1.

    "Hot and the window is closed" is H AND (NOT W): .

  2. 2.

    "Or the override is on" adds OR S.

  3. 3.

    Expression: .

  4. 4.

    Check H = 1, W = 1, S = 0: = 0, so the fan is off, as it should be with the window open.

Common mistakes

  • Treating + as arithmetic addition. is 1, not 2.

  • Thinking two different-looking expressions must be different functions. Compare their truth tables before deciding.

Practice Boolean expression

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

Learn it step by step

Boolean expression is taught in Boolean Algebra.