Boolean logic
The six logic gates, truth tables, logic expressions and building logic circuits from problem statements.
📌 Key points
- NOT: one input; the output is the opposite of the input.
- AND: output is 1 only if both inputs are 1. OR: output is 1 if either input, or both, is 1.
- NAND (NOT AND): output is 0 only if both inputs are 1. NOR (NOT OR): output is 1 only if both inputs are 0.
- XOR (exclusive OR): output is 1 only if the inputs are different.
- A truth table shows the output for every possible combination of inputs: 2 inputs give 4 rows and 3 inputs give 8 rows (2n rows).
- A logic expression describes a circuit using the gate names, e.g. X = (A AND B) OR (NOT C); work out brackets first.
- To build a circuit from a problem statement, turn each condition into an input (1 = true), then link them with AND, OR and NOT exactly as the statement says.
- In a truth table, add working columns for the part-way results (e.g. A AND B) before working out the final output X.
📖 Key terms
- Logic gate
- An electronic component that carries out a Boolean operation on one or more inputs to give one output.
- Truth table
- A table showing the output of a logic circuit for every combination of inputs.
- Logic expression
- A way of writing a logic circuit using AND, OR, NOT, NAND, NOR and XOR.
- NAND
- A gate whose output is 0 only when both inputs are 1.
- NOR
- A gate whose output is 1 only when both inputs are 0.
- XOR
- A gate whose output is 1 only when the inputs are different.
✏️ Worked example
Find the output of X = (A AND B) OR (NOT C) for every row of the truth table where A = 1.
- Rows with A = 1 are: B, C = 0 0, 0 1, 1 0, 1 1.
- A AND B is 1 only when B = 1, so the working column is 0, 0, 1, 1.
- NOT C is 1 when C = 0, so the working column is 1, 0, 1, 0.
- OR the two columns: 0 OR 1 = 1, 0 OR 0 = 0, 1 OR 1 = 1, 1 OR 0 = 1.
- So X = 1, 0, 1, 1 for A B C = 100, 101, 110, 111.
Always write truth table inputs in binary counting order (000, 001, 010 … 111) and add working columns. Drawing gates: use the correct shape for each gate, because a wrong shape loses the mark even if the logic is right.
Test yourself8 questions from a bank of 15. A new mix every time.
Start the quiz →