NAND and NOR are universal gates: any logic function can be built from one of them alone. What is the minimum number N of 2-input NAND gates needed to build the AND function shown?
Find N
Show hints
- A NAND gate with both inputs joined is an inverter.
- AND = NAND followed by an inverter; OR = NAND of the inverted inputs (De Morgan).
- Count every gate, including the ones used as inverters.
Show the answer and the step-by-step solution
Logic gates: each input and output is 0 or 1. AND gives 1 only when all inputs are 1; OR gives 1 when at least one input is 1; NOT inverts. NAND and NOR are AND and OR followed by NOT, and XOR gives 1 when the inputs differ. Work through a circuit from the inputs to the output, one gate at a time. A truth table lists the output for all 2ⁿ input combinations; the row number is the binary value of the inputs, so row ABC = 101 is minterm m₅.
Build it from NAND gates
De Morgan: A + B = (A′·B′)′, so an OR is a NAND of inverted inputs.