NAND and NOR gates: universal gates
NAND is AND followed by NOT; NOR is OR followed by NOT. Each is a universal gate: copies of it alone can make AND, OR and NOT.
Truth tables of NAND and NOR
| A | B | A·B | NAND | A + B | NOR |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 0 | 1 | 0 |
How to draw the symbols
- NAND: draw the AND D shape and add a small bubble at the output. Write Y = NOT(A·B), or A·B with a bar over it.
- NOR: draw the OR shield shape with a bubble at the output. Write Y = NOT(A + B).
- To show NAND as a combination, draw an AND gate whose output Y′ feeds a NOT gate giving Y. Do the same with OR and NOT for NOR.
- NOR with diodes and a transistor: feed the output of the diode OR gate into the base of the transistor NOT gate (the switch). The OR output is inverted, so Y = NOT(A + B). A diode AND gate followed by the transistor NOT gives a NAND gate in the same way.
- The bubble always means invert.
Building NOT, AND and OR from NAND gates
Below, A′ means NOT A (the same as Ā).
- 1NOT: join the two inputs of one NAND gate. Then A = B, and Y = NOT(A·A) = Ā.
- 2AND: feed A and B into a NAND gate, then pass its output through a second NAND used as a NOT. Inverting NOT(A·B) gives back A·B.
- 3OR: first invert A and B with two NAND gates used as NOTs, giving A′ and B′. Feed these into a third NAND.
- 4★The third NAND gives NOT(A′·B′), which equals A + B, as the table below shows. So three NAND gates make an OR gate.
★ key step
Checking the three-NAND OR gate
| A | B | A′ = NOT A | B′ = NOT B | Y = NOT(A′·B′) |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 |
Building gates from NOR gates
- NOT: join both inputs of one NOR gate: Y = NOT(A + A) = Ā.
- OR: a NOR gate followed by a second NOR used as a NOT gives A + B.
- AND: invert A and B with two NOR gates, then feed A′ and B′ into a third NOR. Y = NOT(A′ + B′) = A·B.
- So NOR, like NAND, is a universal gate.
Worked example: a two-gate puzzle
The output of a NAND gate (inputs A and B) is fed to both inputs of a second NAND gate. Find the final output Y for all four input combinations. Which gate does the pair make?
- The first NAND gives NOT(A·B): 1, 1, 1 and 0 for the inputs 00, 01, 10 and 11.
- The second NAND has its inputs joined, so it acts as a NOT and inverts these.
- Final Y: 0, 0, 0 and 1.
Y = A·B: the pair works as an AND gate
Chip makers often build whole circuits from NAND gates alone, because one well-made gate repeated millions of times is cheaper and more reliable. The memory card in a phone uses NAND flash, named after this gate.
2 marks: “Why is the NAND gate called a universal gate? Show how a NOT gate can be made from a NAND gate.” AND, OR and NOT, and so any gate, can be built using NAND gates alone. Join both inputs: Y = NOT(A·A) = Ā; input 0 gives 1 and input 1 gives 0.
3 marks: “Show, with a diagram and a truth table, how an OR gate can be made using only NAND gates.” Two NANDs with joined inputs give A′ and B′; a third NAND gives NOT(A′·B′). Table: 00 gives 0, 01 gives 1, 10 gives 1, 11 gives 1, which is OR.
1 marks: “What is the output of a NOR gate when both its inputs are 0?” 1.
NAND is 0 only for 1-1. NOR is 1 only for 0-0. The bubble means NOT.