AND, OR, NOT and XOR: their symbols, their truth tables and the different ways boards write them.
What you will learn
- Draw and recognise the four gates
- Complete a truth table for each
- Read AND, OR and NOT in words, symbols and dot-plus notation
Four gates
Inside a computer, every decision is built from logic gates.
Each input and output is 1 (true, on) or 0 (false, off).
| A | B | A AND B | A OR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
- AND: 1 only when both inputs are 1.
- OR: 1 when at least one input is 1.
- XOR (exclusive OR): 1 when the inputs are different. (AQA and Edexcel use XOR; OCR GCSE uses AND, OR and NOT.)
- NOT: one input, flipped.
- NAND (NOT AND) is an AND gate followed by a NOT: its output is 0 only when both inputs are 1. NOR (NOT OR) is an OR gate followed by a NOT: its output is 1 only when both inputs are 0. They are drawn as AND and OR with a small circle on the output.
A truth table lists every combination of inputs: n inputs need 2^n rows, counting up in binary: 1 input needs 2 rows, 2 inputs 4 rows, 3 inputs 8 rows, 4 inputs 16 rows. A single gate always gives 0 or 1; its output depends only on its inputs.
The rest of this lesson and its 7 practice questions are locked.
In this lesson
- Four gates
- Symbols and notation
- Try it: Fill in a truth table
7 practice questions, marked as you go; about 20 minutes in all.
Key terms
Logic gates, XOR, NAND, NOR
In this unit: Boolean logic
AND, OR, NOT and XOR gates, truth tables, expressions and circuits, built by hand in an interactive gate builder and used to describe real systems.
- Logic gates and truth tables
- Combining gates
- Logic for real systems