Make an OR gate from NAND gates
Building an OR gate from NAND gates needs one of the most useful rules in digital logic: De Morgan’s law.
Truth table
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Try it Click the inputs to change them.
Y0
De Morgan’s law
De Morgan says that A OR B is the same as NOT( NOT A AND NOT B ). In words: “A or B is true” means the same as “it is not the case that both A and B are false”. Check it with the truth table: the only row where OR gives 0 is the one where A and B are both 0.
Now look at the formula again: NOT( … AND … ) is a NAND. So OR is a NAND whose inputs are first inverted, and each inversion is one more NAND. Three gates in total.
Hints and solution
Try on your own first. Each hint gives away a little more.
- De Morgan: A OR B = NOT( NOT A AND NOT B ).
- NAND of two inverted inputs is exactly that.
- Invert A and B with one NAND each, then NAND the results.