Table of Contents
At the hardware level, digital computers operate entirely on binary signals represented by discretized voltage levels (typically for logic 0 and or for logic 1). Logic gates are the fundamental building blocks of digital electronic circuits. They execute primitive Boolean functions by converting one or more binary inputs into a single deterministic binary output.
In this note, we examine the operation, Boolean expressions, truth tables, algebraic properties, and functional completeness of all standard logic gates tested in GATE CS & DA.
1. Basic Logic Gates
Basic logic gates perform the foundational operations of Boolean algebra: inversion (NOT), logical multiplication (AND), and logical addition (OR).
1.1 NOT Gate (Inverter)
The NOT gate (or inverter) is a single-input, single-output gate that outputs the logical complement of its input.
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
not-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE logic gate symbol for NOT gate inverter with input label A, triangular body, inversion bubble, and output label Y”.
Truth Table
| Input () | Output () |
|---|---|
| 0 | 1 |
| 1 | 0 |
Key Intuition & Properties
- Involution Law: Complements cancel out. .
- Switching Concept: Think of a single switch connected in parallel across a load. When switch is closed (), current bypasses the load ().
1.2 AND Gate
The AND gate outputs logic if and only if all of its inputs are logic .
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
and-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE 2-input AND gate logic symbol with inputs A and B and output Y”.
Truth Table
| Input | Input | Output () |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Key Intuition & Properties
- Series Switch Analogy: Two switches and connected in series. Current reaches the lamp only when both switches are closed.
- Dominance (Null) Element: Any input held at forces the output to . .
- Identity Element: Holding an input at passes the other input unchanged. (acts as a buffer/enable pin).
1.3 OR Gate
The OR gate outputs logic if at least one of its inputs is logic .
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
or-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE 2-input OR gate logic symbol with curved input boundary, inputs A and B, and output Y”.
Truth Table
| Input | Input | Output () |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Key Intuition & Properties
- Parallel Switch Analogy: Two switches connected in parallel. Current flows if either switch or switch is closed.
- Dominance (Null) Element: Any input held at forces the output to . .
- Identity Element: Holding an input at passes the other input unchanged. .
2. Universal Logic Gates
A logic gate family is called universal if any arbitrary Boolean function can be implemented using only instances of that single gate type, without needing any other gate (not even NOT gates). Both NAND and NOR are universal gates.
2.1 NAND Gate
The NAND gate (NOT-AND) produces an output that is the inverse of an AND gate. Its output is logic if and only if all inputs are .
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
nand-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE 2-input NAND gate logic symbol with AND gate body, output inversion bubble, inputs A and B, and output Y”.
Truth Table
| Input | Input | Output () |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Key Intuition & Properties
- Inverted AND: whenever any input is .
- Commutative: .
- NOT Associative: in general.
- Proof: Let .
- LHS: .
- RHS: .
- Now let .
- LHS: .
- RHS: .
- Since LHS RHS, NAND is not associative.
- Proof: Let .
2.2 NOR Gate
The NOR gate (NOT-OR) produces an output that is the inverse of an OR gate. Its output is logic if and only if all inputs are .
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
nor-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE 2-input NOR gate logic symbol with curved OR gate body, output inversion bubble, inputs A and B, and output Y”.
Truth Table
| Input | Input | Output () |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Key Intuition & Properties
- Inverted OR: whenever any input is .
- Commutative: .
- NOT Associative: in general.
3. Exclusive Logic Gates
Exclusive gates are used extensively in arithmetic circuits (adders, subtractors), parity generators/checkers, and digital comparators.
3.1 XOR Gate (Exclusive-OR)
The XOR gate outputs logic if the inputs are different (for 2 inputs), or if an odd number of inputs are 1 (for inputs).
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
xor-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE 2-input XOR gate logic symbol with double curved input line, inputs A and B, and output Y”.
Truth Table
| Input | Input | Output () |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Crucial XOR Identities (High-Frequency GATE Formulas)
- Self-Complement / Nilpotence:
- Complementarity:
- Identity Element: (Acts as a Buffer)
- Inversion Element: (Acts as a Controlled Inverter)
- Commutative:
- Associative:
- Inversion Rules:
3.2 XNOR Gate (Exclusive-NOR / Equivalence)
The XNOR gate (also called Coincidence Gate or Equivalence Gate) outputs logic if the inputs are identical (for 2 inputs).
Boolean Expression
Logic Symbol

Student Image Note: Place an image named
xnor-gate-symbol.pngin theimgs/directory. Search description: “Standard IEEE 2-input XNOR gate logic symbol with double curved input line, output bubble, inputs A and B, and output Y”.
Truth Table
| Input | Input | Output () |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Crucial XNOR Identities
4. Functional Completeness & Universality
4.1 Gate Minimization Matrix
A frequent GATE question asks for the minimum number of 2-input NAND or NOR gates needed to realize basic or exclusive logic gates.
| Target Gate | Minimum NAND Gates Required | Minimum NOR Gates Required |
|---|---|---|
| NOT | 1 | 1 |
| AND | 2 | 3 |
| OR | 3 | 2 |
| XOR | 4 | 5 |
| XNOR | 5 | 4 |
TIP
Notice the elegant duality pattern! The count for (AND, OR) and (XOR, XNOR) flips cleanly when switching between NAND and NOR realizations. Memory mnemonic: 1-2-3-4-5 for NAND (NOT, AND, OR, XOR, XNOR) and 1-3-2-5-4 for NOR!
4.2 Implementing Basic Operations using NAND & NOR
1. Realizing NOT using NAND / NOR
- NAND: (Tie both inputs together)
- NOR:
2. Realizing AND using NAND
- Stage 1:
- Stage 2: Invert using a 1-input NAND . (Requires 2 NAND gates)
3. Realizing OR using NAND
- By De Morgan: .
- Generate (1 NAND) and (1 NAND).
- Feed into 3rd NAND: . (Requires 3 NAND gates)
4. Realizing XOR using NAND (Minimal 4 NAND Gates)
5. Key Algebraic Properties & Parity Rules
5.1 Summary of Algebraic Laws
| Property | AND | OR | XOR | XNOR |
|---|---|---|---|---|
| Commutative | ||||
| Associative | ||||
| Idempotent | ||||
| Complement |
WARNING
Neither NAND nor NOR is associative! .
5.2 Multi-Input XOR vs XNOR Parity Laws (GATE Trap!)
For inputs :
-
XOR (-inputs): Act as an Odd Parity Detector.
-
Relationship between Multi-Input XOR and XNOR:
- For an ODD number of inputs ( is odd):
- For an EVEN number of inputs ( is even):
6. GATE PYQ-Style Solved Questions
Q1) Find the minimum number of 2-input NAND gates required to implement the Boolean function F = A\bar{B} + C.
Sol - Let’s express using double negation and De Morgan’s laws to put it into pure NAND form (AND-OR to NAND-NAND):
Now let’s trace the gate count step by step:
- Generate from using a 1-input NAND gate 1 NAND gate.
- Compute using a 2-input NAND gate with inputs and 1 NAND gate.
- Generate from using a 1-input NAND gate 1 NAND gate.
- Compute final output using a 2-input NAND gate 1 NAND gate.
Total NAND gates required = .
Q2) Evaluate the output of a cascading XOR network with 100 inputs where all inputs are set to 1: Y = 1 \oplus 1 \oplus 1 \dots \oplus 1 (100 times).
Sol - Recall the identity property of XOR: Pairing inputs in groups of two:
Alternatively, using the Parity Rule:
- The input string has 100 ones.
- 100 is an even number.
- Since XOR is an odd parity detector, the output for an even number of 1s is .
Q3) Which of the following statements is/are TRUE regarding Logic Gates? (A) NAND gate is associative. (B) XOR gate can be used as a controlled inverter. (C) For 3 variables A, B, C: (A \oplus B \oplus C) = (A \odot B \odot C). (D) Minimum 4 NOR gates are required to implement an XOR gate.
Sol - Let’s analyze each option:
- (A) FALSE: As proved in Section 2.1, NAND is NOT associative.
- (B) TRUE: and . Setting one input to control signal inverts or passes .
- (C) TRUE: For (odd number of inputs), .
- (D) FALSE: Minimum 5 NOR gates are required to implement an XOR gate (whereas 4 NAND gates are required).
Correct Statements: (B) and (C).