Digital LogicUnit 210 min read
Boolean Algebra & Logic Gates: Laws, Simplification & Gate Design
Unit 2 of Digital Logic covers Boolean algebra fundamentals (laws, theorems, simplification), standard logic gates (AND, OR, NOT, NAND, NOR, XOR, XNOR), their universal equivalence, and practical circuit design using De Morgan’s laws and Karnaugh Maps (K-maps).
TAKEAWAYS:
- Boolean algebra is the math of binary logic, with laws like idempotent, complement, and distributive that simplify digital circuits.
- Logic gates (AND, OR, NOT, etc.) are physical implementations of Boolean operations, and NAND/NOR are universal—any function can be built using just one type.
- De Morgan’s laws convert AND/OR expressions to NAND/NOR forms, critical for gate-level design.
- Karnaugh Maps (K-maps) visually simplify Boolean functions by grouping adjacent 1s/0s, reducing hardware complexity.
- Real-world applications include eSewa’s payment validation (AND logic for multi-factor checks), Khalti’s fraud detection (XOR for anomaly flags), and Ncell’s call routing (MUX/DEMUX for dynamic path selection).
1. Boolean Algebra: The Math Behind Digital Logic
Boolean algebra is a branch of algebra that deals with binary variables (0 and 1) and logical operations (AND, OR, NOT). It forms the foundation for designing digital circuits.
Key Definitions
- Binary Variables: Variables that take only two values:
0(false/low) or1(true/high). - Boolean Operations:
- AND (
·or∧): Output is1only if all inputs are1. - OR (
+or∨): Output is1if any input is1. - NOT (
'or¬): Inverts the input (0→1,1→0).
- AND (
Boolean Algebra Laws
These laws are used to simplify and manipulate Boolean expressions.
| Law | Expression | Explanation |
|---|---|---|
| Identity | A + 0 = A, A · 1 = A |
Adding 0 or multiplying by 1 leaves the variable unchanged. |
| Complement | A + A' = 1, A · A' = 0 |
A variable OR its complement is always 1; AND is always 0. |
| Idempotent | A + A = A, A · A = A |
Repeating a variable in AND/OR doesn’t change the result. |
| Commutative | A + B = B + A, A · B = B · A |
Order of variables doesn’t matter. |
| Associative | (A + B) + C = A + (B + C) |
Grouping doesn’t affect the result. |
| Distributive | A · (B + C) = (A · B) + (A · C) |
Like multiplication over addition in regular algebra. |
| Absorption | A + (A · B) = A, A · (A + B) = A |
Reduces redundant terms. |
| De Morgan’s | (A + B)' = A' · B', (A · B)' = A' + B' |
Converts AND/OR to OR/AND with complements. |
Worked Example: Simplifying a Boolean Expression
Problem: Simplify F = A + A'B + AB'C using Boolean laws.
Solution:
- Factor
Afrom the first and third terms:F = A(1 + B'C) + A'B - Since
1 + B'C = 1, simplify to:F = A + A'B - This is the simplified SOP (Sum of Products) form.
2. Logic Gates: The Building Blocks of Digital Circuits
Logic gates are physical implementations of Boolean operations. They are the basic elements of digital circuits.
Standard Logic Gates
graph LR
AND["AND Gate\nA·B"] -->|"Output"| ANDout
OR["OR Gate\nA+B"] -->|"Output"| ORout
NOT["NOT Gate\nA'"] -->|"Output"| NOTout
NAND["NAND Gate\n(A·B)'"] -->|"Output"| NANDout
NOR["NOR Gate\n(A+B)'"] -->|"Output"| NORout
XOR["XOR Gate\nA⊕B"] -->|"Output"| XORout
XNOR["XNOR Gate\nA⊙B"] -->|"Output"| XNORout| Gate | Symbol | Truth Table | Boolean Expression | Key Use Case |
|---|---|---|---|---|
| AND | `--- | > | ---` | `A B |
| OR | `--- | > | ---` | `A B |
| NOT | `--- | > | ---` | `A |
| NAND | `--- | > | ---` | `A B |
| NOR | `--- | > | ---` | `A B |
| XOR | `--- | > | ---` | `A B |
| XNOR | `--- | > | ---` | `A B |
Universal Gates: NAND and NOR
- NAND and NOR gates are universal—any Boolean function can be implemented using only NAND or only NOR gates.
- Example: Implement
A + Busing NAND gates.A + B = (A' · B')'(De Morgan’s law).- Use NAND gates to compute
A',B', then(A' · B')'.
A real 7400 NAND gate IC (quad 2-input NAND). (Image: Tosaka, CC BY 3.0, via Wikimedia Commons)
3. De Morgan’s Laws: The Bridge Between AND/OR and NAND/NOR
De Morgan’s laws allow conversion between AND/OR and NAND/NOR expressions, critical for gate-level design.
De Morgan’s Laws
(A + B)' = A' · B'(A · B)' = A' + B'
Worked Example: Converting to NAND/NOR
Problem: Convert F = (A + B)' · C to NAND-only form.
Solution:
- Apply De Morgan’s to
(A + B)':F = (A' · B') · C - Replace
·with NAND (sinceX · Y = (X' + Y')'):F = ((A' NAND B') NAND C')' - Use NAND gates to implement.
4. Karnaugh Maps (K-Maps): Simplifying Boolean Functions Visually
K-maps are graphical tools to simplify Boolean expressions by grouping adjacent 1s (for SOP) or 0s (for POS).
Steps to Simplify Using K-Map
- List all minterms (for SOP) or maxterms (for POS).
- Draw the K-map (2^n cells for
nvariables). - Group adjacent
1s in powers of 2 (1, 2, 4, 8, ...). - Write the simplified expression from each group.
Example: Simplifying F(A,B,C,D) = Σ(0,1,3,5,7,8,9,11,13,15)
- K-map for 4 variables (A,B,C,D):
CD\AB | 00 | 01 | 11 | 10
-------------------------
00 | 1 | 1 | 0 | 1
01 | 1 | 1 | 1 | 0
11 | 1 | 1 | 1 | 1
10 | 1 | 0 | 1 | 1
- Grouping:
- Group of 8:
A'C'D(top-left 8 cells). - Group of 4:
A'BD(middle-left 4 cells). - Group of 2:
AB'C(bottom-right 2 cells).
- Group of 8:
- Simplified SOP:
F = A'C'D + A'BD + AB'C
5. Real-World Applications of Boolean Logic
1. eSewa’s Payment Validation (AND Logic)
- Scenario: eSewa requires both a PIN and a fingerprint for high-value transactions.
- Boolean Logic Used:
Payment_Approved = PIN_Valid AND Fingerprint_Match- If either fails, the transaction is blocked (
0).
2. Khalti’s Fraud Detection (XOR Logic)
- Scenario: Khalti flags transactions where the amount or time is inconsistent with user behavior.
- Boolean Logic Used:
Fraud_Alert = (Amount_Expected ⊕ Actual_Amount) OR (Time_Expected ⊕ Actual_Time)- XOR detects exclusive mismatches.
3. Ncell’s Call Routing (MUX/DEMUX)
- Scenario: Ncell routes calls dynamically based on network congestion.
- Boolean Logic Used:
- Multiplexer (MUX): Selects the best tower for a call using
Selectlines. - Demultiplexer (DEMUX): Distributes calls to multiple towers based on
DataandSelect.
- Multiplexer (MUX): Selects the best tower for a call using
4. Daraz’s Order Queue (Priority Encoder)
- Scenario: Daraz prioritizes orders based on payment status, urgency, and stock availability.
- Boolean Logic Used:
- Priority Encoder: Assigns a binary priority code to each order type (e.g.,
Paid_High = 11,Paid_Low = 01).
- Priority Encoder: Assigns a binary priority code to each order type (e.g.,
6. Exam Tip: How to Score Full Marks
For Boolean Simplification:
- Always show intermediate steps (e.g., applying laws one by one).
- For K-maps, circle groups clearly and label them with the simplified term.
- Example: If asked to simplify
F = A'BC + AB'C + ABC', show:- Group
A'BC + AB'C = C(B + AB')→C(B + A)→C(B + A)(no further simplification).
- Group
For Gate Circuits:
- Draw standard gate symbols (no stick figures).
- Label inputs/outputs clearly (e.g.,
A, B → F = A + B). - For NAND/NOR-only implementations, explicitly state De Morgan’s steps.
For Truth Tables:
List all possible inputs (2^n rows for
nvariables).Highlight outputs in bold or color.
Example: For
F = A XOR B, show:A B F = A⊕B 0 0 0 0 1 1 1 0 1 1 1 0
For Real-World Questions:
- Relate to known systems (e.g., "Like eSewa’s AND gate for multi-factor auth").
- Draw a simple block diagram (e.g., a MUX for call routing).
Summary Table: Key Concepts at a Glance
| Topic | Key Idea | Exam Focus |
|---|---|---|
| Boolean Laws | Simplify expressions using identities. | Apply laws step-by-step. |
| Logic Gates | Physical implementation of Boolean ops. | Draw circuits, identify universal gates. |
| De Morgan’s Laws | Convert AND/OR ↔ NAND/NOR. | Convert expressions to NAND/NOR only. |
| K-Maps | Simplify functions visually. | Group correctly, write simplified SOP/POS. |
| Real-World Applications | Boolean logic in apps (eSewa, Khalti). | Explain how logic gates are used. |
Final Note: Practice simplifying expressions and drawing gate circuits daily. Use K-maps for 3-4 variable functions to master grouping. For exams, always justify your steps—examiners reward clarity!
Based on the TU BSc CSIT syllabus for Digital Logic (CSC116), unit 2.
Discussion
Loading…