Detailed · Deep study
1Logic gates
A logic gate takes one or more binary inputs (0 or 1) and produces a single binary output. NOT has a single input; all the other gates have two inputs.
| Gate | Function | Expression |
|---|---|---|
| NOT | output is the opposite of the input | X = NOT A |
| AND | output is 1 only if A and B are both 1 | X = A AND B |
| OR | output is 1 if A or B (or both) is 1 | X = A OR B |
| NAND | output is 0 only if both inputs are 1 (opposite of AND) | X = A NAND B |
| NOR | output is 1 only if both inputs are 0 (opposite of OR) | X = A NOR B |
| XOR (EOR) | output is 1 if the inputs are different | X = A XOR B |
2Circuits, expressions and truth tables
A truth table shows the output for every possible combination of inputs. With three inputs there are 2³ = 8 combinations; list them as binary counting from 000 to 111. Circuits use at most three inputs and one output, and must be drawn for the statement given, without simplification.
| A | B | C | A AND B | NOT C | X |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
Worked example
Problem statement → expression → circuit → truth table
An alarm X sounds if a door is open (A = 1) and the alarm is set (B = 1), or if a window is open (C = 1) and the alarm is set (B = 1). Write the logic expression and complete the truth table.
- 1
Turn each part of the statement into a gate.
door open and set: A AND B; window open and set: C AND B
- 2
Join the parts with the word between them (or).
X = (A AND B) OR (C AND B)
- 3
Work out X for each of the 8 rows.
X = 1 when B = 1 and A or C is 1
AnswerX = (A AND B) OR (C AND B)
| A | B | C | X |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Worked example
Truth table → expression
A two-input truth table has X = 1 only for A = 0, B = 1 and for A = 1, B = 0. Write a logic expression.
- 1
Write an AND term for each row where X = 1.
(NOT A AND B) and (A AND NOT B)
- 2
Join the terms with OR.
X = (NOT A AND B) OR (A AND NOT B)
AnswerX = (NOT A AND B) OR (A AND NOT B), which is the same as A XOR B
3Exam focus
Key words: logic gate; NOT; AND; OR; NAND; NOR; XOR; truth table; logic expression; logic circuit; input; output.
Quick self-check
Answer in your head first, then reveal.
NOT (1).
1 (1).
0, 1, 1, 0 (2: 1 mark for two correct).
X = (A AND B) OR NOT C (2).
X = A AND NOT B (2).
