Prerequisites — What You Need to Know First
Before diving into K-Maps, let's make sure we're all on the same page. Think of it as packing your bag before a journey. If you have all these items, you're ready!
- Binary Numbers (0 and 1) — You should know what 0 and 1 mean in digital systems.
- Logic Gates (AND, OR, NOT) — Basic understanding of how logic gates work.
- Truth Tables — Ability to read and fill a truth table.
- Boolean Algebra — Basic rules like A+A'=1 and A·A'=0.
- Minterms & Maxterms — Expressing functions in standard forms.
Binary Numbers — The Language of Computers
We use 10 digits (0–9) every day. But computers only understand TWO states: ON and OFF. These are written as 1 (ON/True/High) and 0 (OFF/False/Low). This is called the Binary Number System.
Switch ON → Electricity flows → Binary: 1
Switch OFF → No electricity → Binary: 0
A computer does billions of these ON/OFF decisions every second!
Decimal to Binary Conversion
To convert a decimal number to binary, keep dividing by 2 and collect the remainders from bottom to top:
| Decimal | Operation | Quotient | Remainder |
|---|---|---|---|
| 13 | 13 ÷ 2 | 6 | 1 ← (LSB — Write last) |
| 6 ÷ 2 | 3 | 0 | |
| 3 ÷ 2 | 1 | 1 | |
| 1 ÷ 2 | 0 | 1 ← (MSB — Write first) | |
| Result: 13₁₀ = 1101₂ | Read remainders BOTTOM to TOP | ||
Always read the remainders from Bottom to Top to get your binary number!
Logic Gates — The Building Blocks
A Logic Gate is an electronic device that takes one or more inputs (0 or 1) and gives exactly one output. Think of a gate like a decision machine — it makes a yes/no decision based on what comes in.
| A | B | Y = A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 ✓ |
| A | B | Y = A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 ✓ |
| 1 | 0 | 1 ✓ |
| 1 | 1 | 1 ✓ |
| A | Y = NOT A |
|---|---|
| 0 | 1 ✓ |
| 1 | 0 |
| A | B | Y = (A·B)' |
|---|---|---|
| 0 | 0 | 1 ✓ |
| 0 | 1 | 1 ✓ |
| 1 | 0 | 1 ✓ |
| 1 | 1 | 0 |
| A | B | Y = (A+B)' |
|---|---|---|
| 0 | 0 | 1 ✓ |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
| A | B | Y = A ⊕ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 ✓ |
| 1 | 0 | 1 ✓ |
| 1 | 1 | 0 |
NAND and NOR are called Universal Gates because you can build ANY other gate (AND, OR, NOT, XOR, XNOR) using only NAND gates, or only NOR gates. This is very useful in chip manufacturing — only one type of gate needs to be fabricated!
Boolean Algebra — Simplifying Logic with Math
Boolean Algebra is a set of mathematical rules for simplifying logic expressions. We only work with 0 and 1. Simplifying means building a cheaper, smaller circuit that does the same job!
Basic Laws of Boolean Algebra
Think of these as the 'grammar rules' of logic. Learn these and simplification becomes easy!
De Morgan's Theorems — The Most Important!
In words: The complement of a product = the sum of complements.
Real Life: You CANNOT get a coffee AND a tea if EITHER the coffee machine OR the tea machine is broken.
In words: The complement of a sum = the product of complements.
Real Life: The only way NEITHER of you gets into the party is if BOTH of you are denied.
- BREAK the bar over the whole expression
- COMPLEMENT each individual variable
- CHANGE the operator: · becomes +, and + becomes ·
Step-by-Step Simplification Example
Problem: Simplify Y = AB + AB'
| Step | Expression | Rule Applied | Explanation |
|---|---|---|---|
| Start | Y = AB + AB' | — | Given expression |
| Step 1 | Y = A(B + B') | Distributive Law | Factor out A from both terms |
| Step 2 | Y = A(1) | Complement: B+B' = 1 | Anything OR its complement = 1 |
| Step 3 | Y = A ✓ | Identity: A·1 = A | Final simplified result! |
AB + AB' simplifies to just A! We went from needing 2 AND gates + 1 NOT gate + 1 OR gate → to just a wire. That's huge savings in hardware!Minterms & Maxterms — Standard Forms
When we have a truth table, we need a standard way to write the Boolean expression from it. Minterms and maxterms give us exactly that.
Minterm: Where output = 1 → variable value 1 means write as-is (A), value 0 means write complement (A')
Maxterm: Opposite — variable value 0 means write as-is, value 1 means complement
Minterm Table for 3 Variables (A, B, C)
| Row (m#) | A | B | C | Minterm | Maxterm |
|---|---|---|---|---|---|
| m₀ | 0 | 0 | 0 | A'B'C' | A+B+C |
| m₁ | 0 | 0 | 1 | A'B'C | A+B+C' |
| m₂ | 0 | 1 | 0 | A'BC' | A+B'+C |
| m₃ | 0 | 1 | 1 | A'BC | A+B'+C' |
| m₄ | 1 | 0 | 0 | AB'C' | A'+B+C |
| m₅ | 1 | 0 | 1 | AB'C | A'+B+C' |
| m₆ | 1 | 1 | 0 | ABC' | A'+B'+C |
| m₇ | 1 | 1 | 1 | ABC | A'+B'+C' |
Writing SOP from a Truth Table
Example: Y at rows 1,3,4,6 → Y = A'B'C + A'BC + AB'C' + ABC' → also written as Y = Σm(1,3,4,6)
Karnaugh Maps — The Star of this Chapter
A Karnaugh Map (K-Map) is a visual method to simplify Boolean expressions. Instead of using complex algebra rules, you literally draw a grid, fill in 0s and 1s, and circle groups. It's like solving a puzzle!
- Faster — Much quicker than Boolean algebra for 2–6 variable problems.
- Visual — You can see the simplification by eye.
- Systematic — Less chance of making errors.
- Exam essential — Almost every digital logic exam includes a K-Map question!
🚨 KEY CONCEPT: Gray Code Ordering
Columns and rows in a K-Map are NOT in normal binary order. They use Gray Code: 00, 01, 11, 10. Adjacent cells differ by EXACTLY ONE bit. This is what allows grouping to work!
00 → 01 → 10 → 11
00 → 01 → 11 → 10
2-Variable K-Map
A 2-variable K-Map has 4 cells in a 2×2 grid:
| A \ B | B=0 | B=1 |
|---|---|---|
| A=0 | m₀ | m₁ |
| A=1 | m₂ | m₃ |
3-Variable K-Map
A 3-variable K-Map has 8 cells in a 2×4 grid. Notice the Gray Code column order:
| A \ BC | BC=00 | BC=01 | BC=11 | BC=10 |
|---|---|---|---|---|
| A=0 | m₀ | m₁ | m₃ | m₂ |
| A=1 | m₄ | m₅ | m₇ | m₆ |
⚠️ Notice: m₂ and m₃ are SWAPPED compared to binary order. This is INTENTIONAL!
4-Variable K-Map — The Most Common in Exams!
A 4-variable K-Map has 16 cells in a 4×4 grid:
| AB \ CD | CD=00 | CD=01 | CD=11 | CD=10 |
|---|---|---|---|---|
| AB=00 | 0 | 1 | 3 | 2 |
| AB=01 | 4 | 5 | 7 | 6 |
| AB=11 | 12 | 13 | 15 | 14 |
| AB=10 | 8 | 9 | 11 | 10 |
💡 The corners (0, 2, 8, 10) can form a group of 4 — they wrap around and are adjacent!
Grouping Rules — The Heart of K-Map Simplification
Grouping (circling) 1s in the K-Map is how we find the simplified expression. Follow these rules strictly:
| # | Rule | Why it Matters |
|---|---|---|
| 1 | Groups must contain ONLY 1s (never mix 0s and 1s) | Mixing would give a wrong expression |
| 2 | Group size must be a power of 2: 1, 2, 4, 8, 16 | Only powers of 2 lead to variable cancellation |
| 3 | Make groups as LARGE as possible | Larger groups = fewer variables = simpler expression |
| 4 | Every 1 MUST be covered by at least one group | Uncovered 1s would be missing from the output |
| 5 | Groups can WRAP AROUND edges (top↔bottom, left↔right) | K-Map is like a donut (torus) shape! |
| 6 | Groups can OVERLAP (a 1 can be in more than one group) | Overlapping allows maximum grouping |
| 7 | Use MINIMUM number of groups to cover all 1s | Fewer groups = simpler final expression |
| 8 | Every group must have at least one essential 1 (Essential Prime Implicants) | Ensures all groups are necessary |
How to Read a Group (Extract the Term)
Complete Worked Example — 4-Variable K-Map
Problem: Simplify F(A,B,C,D) = Σm(0,1,2,3,4,5,6,7,8,10)
| AB \ CD | CD=00 | CD=01 | CD=11 | CD=10 |
|---|---|---|---|---|
| AB=00 | 1 | 1 | 1 | 1 |
| AB=01 | 1 | 1 | 1 | 1 |
| AB=11 | 0 | 0 | 0 | 0 |
| AB=10 | 1 | 0 | 0 | 1 |
Reduced from 10 minterms to just 3 terms — that's a massive simplification in circuit complexity!
Don't-Care Conditions — Bonus Simplification!
Sometimes, certain input combinations can never occur in practice. For these inputs, the output can be anything — 0 or 1 — we don't care! These are called Don't-Care conditions, written as X or d in the K-Map.
Rules for Don't-Care Conditions
- Rule 1: Treat X as 1 if it HELPS make a larger group. Otherwise treat as 0.
- Rule 2: NEVER make a group that contains ONLY X cells (no actual 1s).
- Rule 3: Don't-Cares don't need to be covered — only actual 1s must be covered.
- Rule 4: Use X to your advantage to get a simpler result!
Worked Example with Don't-Cares
Problem: F(A,B,C,D) = Σm(1,3,7,11,15) + d(0,2,5)
| AB \ CD | CD=00 | CD=01 | CD=11 | CD=10 |
|---|---|---|---|---|
| AB=00 | X | 1 | 1 | X |
| AB=01 | 0 | X | 1 | 0 |
| AB=11 | 0 | 0 | 1 | 0 |
| AB=10 | 0 | 0 | 1 | 0 |
X cells (orange) = don't-care. We USE X at positions 0,2 to form a group of 4 with minterms 1,3.
Without don't-cares we might need 3+ terms. Using X to our advantage gives us just 2 terms!
Common Mistakes — & How to Avoid Them
Exam Practice Questions — with Solutions
- First: Try each question yourself before looking at the solution.
- Then: Compare your answer with the worked solution.
- Focus: Understand WHY each step is done, not just WHAT is done.
- Repeat: Do each problem at least twice without notes before your exam.
A + A'B = A + B
| Step | Expression | Rule Applied |
|---|---|---|
| Start | A + A'B | Given |
| Step 1 | (A + A')(A + B) | Distributive: X+YZ = (X+Y)(X+Z) |
| Step 2 | (1)(A + B) | Complement: A + A' = 1 |
| Step 3 | A + B ✓ | Identity: 1 × X = X (QED) |
💡 Tip: When proving identities, work on ONE side only and simplify it to match the other side.
(A'B + C'D)'| Step | Expression | Rule |
|---|---|---|
| Start | (A'B + C'D)' | Given |
| Step 1 | (A'B)' · (C'D)' | De Morgan's 2nd: (X+Y)' = X'·Y' |
| Step 2 | (A'' + B')(C'' + D') | De Morgan's 1st: (XY)' = X'+Y' |
| Step 3 | (A + B')(C + D') | Double Complement: A'' = A |
F(A,B,C) = Σm(1,2,3,5,7)Step 1: Fill the K-Map
| A \ BC | BC=00 | BC=01 | BC=11 | BC=10 |
|---|---|---|---|---|
| A=0 | 0 | 1 | 1 | 1 |
| A=1 | 0 | 1 | 1 | 0 |
Step 2: Identify groups:
| Group | Cells | Variable Analysis | Term |
|---|---|---|---|
| Group 1 (4 cells) | m₁, m₃, m₅, m₇ | A changes, B changes, C=1 always → only C constant | C |
| Group 2 (2 cells) | m₂, m₃ | A=0 always, B=1 always, C changes → A and B constant | A'B |
✅ Verify: m₁(C=1✓) m₂(A'B✓) m₃(both✓) m₅(C=1✓) m₇(C=1✓) — All 5 minterms covered!
F(A,B,C,D) = Σm(0,1,2,4,5,6,8,9,10) + d(3,7,11,15)| AB \ CD | CD=00 | CD=01 | CD=11 | CD=10 |
|---|---|---|---|---|
| AB=00 | 1 | 1 | X | 1 |
| AB=01 | 1 | 1 | X | 1 |
| AB=11 | 0 | 0 | X | 0 |
| AB=10 | 1 | 1 | X | 1 |
Groups:
- Group 1 (12 cells + X): All of AB=00, AB=01, AB=10 rows with CD=00, CD=01, CD=10 (and X at CD=11 helps) → D' covers CD=00 and CD=10 across 3 rows
- Group 2 (rows AB=00,01,10): Using the 3 rows with B'→ B is 0 for AB=00 and AB=10 (wrap)
💡 The don't-cares at CD=11 let us form larger groups. Without them we'd need more terms!
Additional Practice Questions (Self-Study)
| Q# | Difficulty | Problem | Hint |
|---|---|---|---|
| Q5 | ⭐ | Prove: AB + A'C + BC = AB + A'C | This is the Consensus Theorem. Expand BC = BC(A+A'). |
| Q6 | ⭐⭐ | K-Map: F = Σm(2,3,6,7,10,11,14,15) | All minterms have C=1. Group of 8 → Answer: just C! |
| Q7 | ⭐⭐ | Convert (A+B)(A+C)(B'+C') into SOP | Expand brackets. Use Distributive + Absorption Laws. Answer: AC + AB' |
| Q8 | ⭐⭐⭐ | Implement F = Σm(0,1,3,6,7) using only NAND gates | Simplify with K-Map first, then apply De Morgan's to convert AND-OR to NAND-NAND form. |
Quick Reference — Cheat Sheet
Dr. Sohel Rana's final summary — everything you need for your exam in one place!
K-Map Simplification — Complete Process
A·1=A, A+0=AA·0=0, A+1=1A·A=A, A+A=AA·A'=0, A+A'=1A+AB=A(AB)'=A'+B'If your group size is NOT in this list, it's WRONG. Always powers of 2 only.