Menu

Boolean Logic

Boolean expressions

A Boolean expression is a way of writing how the AND, OR and NOT operators combine inputs to produce a single output. You work out anything in brackets first, just like in maths. For example, in (X OR Y) AND NOT Z, find X OR Y and NOT Z before doing the final AND.

If X = 1, Y = 0 and Z = 0, then X OR Y is 1. NOT Z turns 0 into 1. The last step is 1 AND 1, which gives 1. Without the brackets you could not tell whether the NOT applied to Z alone or to the whole expression, so the brackets show exactly which parts are worked out together.

When NOT is applied to a whole bracketed group, finish the group first and then invert the result. In NOT (P AND Q) with P = 0 and Q = 1, the bracket gives 0, so the final answer is 1.

From a logic diagram to an expression

Start at the inputs and move towards the output. Write what each gate produces, and put brackets around each group so the order is clear. Imagine input M goes through a NOT gate, while N and R go into an OR gate. Those two results then enter an AND gate. The expression is (NOT M) AND (N OR R): NOT M is one group and N OR R is the other. The AND is applied last because it is closest to the output.

You do not need to simplify an expression like this one. The aim is to write or use the expression accurately, with brackets showing the order of operations.

Practise this