Logic gates — AND, OR, NOT, NAND, NOR, XOR with universal gate construction

medium CBSE JEE-MAIN 4 min read

Question

List all basic logic gates with their truth tables and Boolean expressions. Why are NAND and NOR called universal gates? How can you construct AND, OR, and NOT gates using only NAND gates?

(CBSE 12 boards ask truth tables for 3-5 marks; JEE Main tests universal gate construction)


Solution — Step by Step

AND gate: Output is 1 only when ALL inputs are 1. Y=ABY = A \cdot B

OR gate: Output is 1 when ANY input is 1. Y=A+BY = A + B

NOT gate (Inverter): Output is the complement of input. Y=AˉY = \bar{A}

NAND gate: AND followed by NOT. Output is 0 only when ALL inputs are 1. Y=ABY = \overline{A \cdot B}

NOR gate: OR followed by NOT. Output is 1 only when ALL inputs are 0. Y=A+BY = \overline{A + B}

XOR gate: Output is 1 when inputs are DIFFERENT. Y=AB=ABˉ+AˉBY = A \oplus B = A\bar{B} + \bar{A}B

A gate is called universal if you can build ALL other gates using only that gate. Both NAND and NOR have this property.

Using only NAND gates:

  • NOT: Connect both inputs of a NAND to the same signal. AA=Aˉ\overline{A \cdot A} = \bar{A}
  • AND: NAND followed by NOT (another NAND as inverter). AB=AB\overline{\overline{A \cdot B}} = A \cdot B
  • OR: Invert each input (using NAND as NOT), then NAND them. AˉBˉ=A+B\overline{\bar{A} \cdot \bar{B}} = A + B (De Morgan’s law)
ABANDORNANDNORXOR
0000110
0101101
1001101
1111000
flowchart TD
    A["NAND Gate<br/>(Universal)"] --> B["NOT: tie inputs together<br/>NAND(A,A) = NOT A"]
    A --> C["AND: NAND + NOT<br/>NOT(NAND(A,B)) = AND"]
    A --> D["OR: NOT inputs, then NAND<br/>NAND(NOT A, NOT B) = OR"]
    B --> E["All basic gates built<br/>from NAND alone"]
    C --> E
    D --> E
    style A fill:#ffeb3b,stroke:#333

Why This Works

Logic gates are the building blocks of all digital electronics — from calculators to computers. The universality of NAND and NOR means that an entire computer processor can theoretically be built using just one type of gate, which simplifies manufacturing enormously.

De Morgan’s theorems (AB=Aˉ+Bˉ\overline{A \cdot B} = \bar{A} + \bar{B} and A+B=AˉBˉ\overline{A + B} = \bar{A} \cdot \bar{B}) are the mathematical foundation for the universal gate constructions. They show that NAND can produce OR-like behaviour and NOR can produce AND-like behaviour when combined with inversion.


Alternative Method

For CBSE boards, the easiest way to verify a truth table is to plug in values. If you forget the Boolean expression for XOR, just check: “output is 1 when inputs are different.” Apply this rule row by row and you will get the correct truth table without memorising the formula.


Common Mistake

Students confuse NAND with NOR truth tables. The easy way to keep them straight: NAND gives 0 only when both inputs are 1 (it is the “NOT-AND”). NOR gives 1 only when both inputs are 0 (it is the “NOT-OR”). NAND is “generous” (mostly outputs 1), NOR is “strict” (mostly outputs 0).

Want to master this topic?

Read the complete guide with more examples and exam tips.

Go to full topic guide →

Try These Next