CE2704 · Digital Logic Design
Theme 2 · Boolean algebra & logic gates

The derived gates: NAND, NOR, XOR, XNOR

Four more gates built from the first three. Two of them can build everything; the other two are the heart of arithmetic and comparison.

Built from first principles.

Before you start

What you need first

  • Basic gates (AND/OR/NOT + the bubble = invert).
  • Truth tables — to read each gate's behaviour.

What you'll be able to do

  • Recognise and use NAND, NOR, XOR, XNOR.
  • Explain why NAND and NOR are universal.
  • Know what XOR ("different") and XNOR ("same") are for.

NAND — "NOT AND"

ABF
AND with an output bubble. F = (A·B)′
ABF
001
011
101
110
Universal: AND, OR and NOT can all be built from NANDs alone — so any circuit can. Foundries love NAND: it's the smallest, fastest gate to make in CMOS.

NOR — "NOT OR"

ABF
OR with an output bubble. F = (A+B)′
ABF
001
010
100
110
Also universal. The Apollo Guidance Computer (1965) was built from ~5600 NOR gates — and nothing else.

XOR — exclusive OR ("different")

ABF
OR shape + extra back curve. F = A⊕B
ABF
000
011
101
110
Output is 1 when the inputs differ. XOR is the heart of binary addition, parity, error-detection codes, and cryptography.

XNOR — "same"

ABF
XOR with an output bubble. F = (A⊕B)′
ABF
001
010
100
111
Output is 1 when the inputs are equal. The equality detector — used in comparators (you'll build one in Theme 4).

All seven gates at a glance

GateExpressionOutput 1 when…Use
ANDA·Bboth inputs 1"all conditions"
ORA+Bat least one 1"any condition"
NOTA′input is 0inversion
NAND(A·B)′not both 1universal, cheap CMOS
NOR(A+B)′both 0universal
XORA⊕Binputs differadders, parity
XNOR(A⊕B)′inputs equalequality
Only three (AND/OR/NOT) are truly independent — the rest are convenient shorthand. But NAND or NOR alone is enough to build them all.

✏️ Try it yourself

(a) NAND(1,1)? (b) NOR(0,0)? (c) XOR(1,1)? (d) Which gate outputs 1 only when its inputs are equal?

(a) AND(1,1)=1, NOT 1 = 0. (b) OR(0,0)=0, NOT 0 = 1. (c) inputs are the same → 0 (XOR fires only when they differ). (d) XNOR.

Recap — the whole topic on one screen

GateMemory hook
NAND / NORAND/OR + bubble; each is universal
XOR"different" → 1; the adder/parity gate
XNOR"same" → 1; the equality gate

Next topic

Boolean theorems & simplification

Now that you know the gates, we learn the algebra rules that let you shrink an expression — fewer gates, less power, faster circuits.

→ Boolean theorems & simplification