Logic Gates & Switches
Introduction to Boolean logic AND, OR, NOT. Aligned with Logic Gates simulator.
Logic Gates & Switches
Logic Gates & Switches
What you'll learn
- Understand logic gates as fundamental building blocks of digital circuits.
- Learn truth tables for AND, OR, NOT, NAND, NOR, XOR gates.
- See how logic gates relate to switches in circuits.
- Understand Boolean algebra basics.
Key concepts
What is a Logic Gate?
A logic gate is an electronic circuit that performs a logical operation on one or more binary inputs (0 or 1) to produce a single binary output.
- Input/Output: 0 (LOW, false) or 1 (HIGH, true)
- Gates are built from transistors acting as switches.
The 7 Basic Gates
NOT Gate (Inverter)
| Input A | Output |
|---|---|
| 0 | 1 |
| 1 | 0 |
Symbol: A → [NOT] → Ā (A-bar)
AND Gate
| A | B | Output (A·B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Output is 1 only when all inputs are 1.
OR Gate
| A | B | Output (A+B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Output is 1 when at least one input is 1.
NAND Gate (NOT AND)
Output = complement of AND. Universal gate — can build all other gates.
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR Gate (NOT OR)
Output = complement of OR. Also a universal gate.
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR Gate (Exclusive OR)
Output is 1 when inputs are different.
| A | B | Output (A⊕B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XNOR Gate
Output is 1 when inputs are the same. Complement of XOR.
Switches and Logic Gates
A transistor acts like a switch:
- Base = input signal
- 0V at base → transistor OFF → output HIGH (1) — this is a NOT gate behaviour
- 5V at base → transistor ON → output LOW (0)
Two transistors in series (both must be ON) → AND logic Two transistors in parallel (either ON) → OR logic
Boolean Algebra Laws
| Law | Expression |
|---|---|
| Identity | A + 0 = A; A · 1 = A |
| Null | A + 1 = 1; A · 0 = 0 |
| Complement | A + Ā = 1; A · Ā = 0 |
| De Morgan's 1 | (A·B)' = A' + B' |
| De Morgan's 2 | (A+B)' = A' · B' |
Applications
| System | Logic Gates Used |
|---|---|
| Calculator | Adder circuits (XOR + AND) |
| Memory (RAM) | NAND flip-flops |
| CPU operations | AND/OR/NOT for ALU |
| Security (locks) | AND gates (all conditions must be met) |
Quick check
- Write the truth table for a 2-input AND gate.
- What makes NAND a universal gate?
- Using De Morgan's theorem, simplify (A + B)'.
- What is the output of XOR when both inputs are 1?
- How does a transistor act as a switch in a logic gate?
Open the Practice tab for graded questions on Logic Gates & Switches.
Key Takeaways (TL;DR)
- What you'll learn
- Key concepts
- Quick check
Master this topic with Drishti OS
Get unlimited mock tests, AI-powered mentorship, and complete video courses when you join.
Start Free Practice