Chapter 2: Boolean Algebra and Logic Gates
Source files used: ELEC205 Week 2 slides (slides 23-56), Week 3 slides (slides 4-39); textbook Chapter 2 as support. No worked examples are included.
1. Big Picture
Chapter 2 is the algebra behind every combinational circuit.
Chapter 1 asked: how do we write numbers in bits? Chapter 2 asks: how do we build a circuit whose output is any function of those bits, using only basic gates?
New ideas in this chapter:
- logic gates as the “atoms” of digital systems,
- Boolean algebra theorems, DeMorgan, duality,
- minterms and maxterms,
- canonical SOP and POS forms and converting between them,
- two-level AND-OR / OR-AND circuits and the bubble trick (NAND-NAND, NOR-NOR).
Erzin’s analogy: learn how each gate “moves” first (like chess pieces), then the standard plays (adders, decoders, MUXes), then practice many designs.
2. Core Ideas
2.1 Combinational System
A combinational system has no memory: the current output depends only on the current input. It is completely described by a truth table.
With 2 inputs there are 4 input rows, so a 2-input function is just a choice of 4 output bits. The slides list the useful ones: constant 0, AND, OR, NAND, NOR, XOR, XNOR, constant 1. With one input: buffer (), inverter (), and the two constants.
2.2 Basic Gates
Every gate is one row of the table in Section 6.1. Two notes from the slides:
- NAND and NOR are AND/OR followed by an inverter (the output bubble).
- By DeMorgan, NAND equals OR with inverted inputs, and NOR equals AND with inverted inputs. This is the basis of the bubble trick.
Any digital function can be built with AND, OR and NOT. Basic gates are the atoms of digital systems.
2.3 Boolean Algebra
Algebra on the set with three operations:
- : OR,
- : AND,
- : complement (NOT).
Boole (1854) defined it; Shannon (1938) adapted it as switching algebra for circuits. It is used to (1) express any function in terms of basic gates and (2) simplify those implementations.
2.4 Duality
Every theorem has a dual. Erzin’s recipe: pick a theorem, then
- swap 1’s with 0’s,
- swap variables with their complements,
- swap ANDs with ORs,
and you obtain another theorem. The textbook’s duality principle swaps only AND/OR and 0/1 (variables unchanged); both recipes produce valid theorems. This is why the theorem list in Section 3 comes in pairs.
2.5 Minterms and Maxterms
- Minterm : a product (AND) term in which every variable appears exactly once, complemented or not. It equals 1 on exactly one row (row ).
- Maxterm : a sum (OR) term in which every variable appears exactly once. It equals 0 on exactly one row (row ).
There are of each for variables, one per binary number to . In a minterm a 0 bit gives a complemented variable; in a maxterm a 0 bit gives an uncomplemented variable.
2.6 SOP and POS
- Sum of Products (SOP): OR of AND terms. Built from the rows where . Two-level AND-OR circuit.
- Product of Sums (POS): AND of OR terms. Built from the rows where . Two-level OR-AND circuit. POS is the dual of SOP.
A canonical form uses full minterms/maxterms. A standard (simplified) form uses shorter terms.
3. Main Governing Equations and Formulas
3.1 Single-Variable Theorems
Each one can be proven by checking and (perfect induction).
3.2 Commutative and Associative
Meaning: input order on an AND or OR gate does not matter, and multi-input AND/OR gates are well defined.
3.3 Distributive
The second form has no decimal counterpart. Use it to “sum out” an SOP into POS.
3.4 Absorption
Use to delete redundant terms.
3.5 Combining (Adjacency)
Erzin calls these the key theorems for circuit simplification. They are exactly what a K-map group does in Chapter 3.
3.6 DeMorgan’s Theorems
-variable form:
Generalized form (complement of any function):
To complement an expression: swap and and complement every literal. Keep the original grouping with parentheses.
3.7 Shannon Expansion
Use to split a function on one variable. This is the basis of 5-variable K-maps and MUX implementations (Chapters 3 and 4).
3.8 Minterm/Maxterm Relation
Two-variable case:
3.9 Canonical SOP and POS
Example from the slides: gives and .
The POS index list is exactly the indices missing from the SOP list.
3.10 Getting POS from
Write as SOP, then apply DeMorgan. Example: XOR has , so .
Use this whenever you need a POS (or a NOR circuit).
3.11 Two-Level Gate Equivalences
Bubble trick: add a bubble at each first-level output and at each matching second-level input. Two bubbles on a wire cancel (). The OR with bubbled inputs is a NAND (DeMorgan), so the whole circuit becomes NAND gates. Same idea with OR-AND giving NOR-NOR.
A single literal feeding the second level directly has no first-level gate, so per the textbook it must be complemented when the output gate becomes NAND/NOR.
4. Problem-Solving Workflow
4.1 Truth Table to Circuit
- List the rows where .
- Write one minterm per row (0 → complemented variable, 1 → plain variable).
- OR them: canonical SOP.
- Simplify with the theorems (Sections 3.4, 3.5) or a K-map (Chapter 3).
- Draw AND-OR, then convert to NAND-NAND if asked.
4.2 Converting Between Forms
- list to list: take the missing indices.
- Expression to canonical form: build the truth table, or expand each term by multiplying in for missing variables.
- Arbitrary circuit to SOP: “multiply out” with the first distributive law. Slide example: .
- Arbitrary circuit to POS: “sum out” with , or go through (Section 3.10).
4.3 Complementing an Expression
- Swap every with and every with .
- Complement every literal.
- Keep the original operator precedence by adding parentheses.
5. Decision Rules / Decision Trees
5.1 SOP or POS?
Fewer 1’s than 0’s in the truth table? → SOP from the 1-rows is usually shorter
Fewer 0’s than 1’s? → POS from the 0-rows is usually shorter
Asked for NAND-only? → start from SOP, use NAND-NAND
Asked for NOR-only? → start from POS, use NOR-NOR
5.2 Which Theorem?
Two terms differ in exactly one variable? → combining:
One term contains another term entirely? → absorption:
Complement over a product or sum? → DeMorgan
Need to split on one variable? → Shannon expansion
6. Important Tables / Correlations Needed
6.1 Gate Summary
| Gate | Expression | Output is 1 when |
|---|---|---|
| AND | all inputs are 1 | |
| OR | any input is 1 | |
| NOT | input is 0 | |
| NAND | any input is 0 | |
| NOR | all inputs are 0 | |
| XOR | inputs differ | |
| XNOR | inputs are equal |
6.2 Three-Variable Minterms and Maxterms
| Minterm | Maxterm | |
|---|---|---|
| 000 | ||
| 001 | ||
| 010 | ||
| 011 | ||
| 100 | ||
| 101 | ||
| 110 | ||
| 111 |
6.3 Properties of Minterms and Maxterms
| Minterms | Maxterms |
|---|---|
| of them, one per number to | of them, one per number to |
| Every function is a sum of minterms | Every function is a product of maxterms |
| Absent minterms belong to | Absent maxterms belong to |
| Sum of all minterms | Product of all maxterms |
7. Key Takeaways
- A combinational circuit is fully defined by its truth table; output depends only on current inputs.
- Boolean algebra: set , operations OR, AND, NOT.
- Combining () and absorption () are the main simplification tools.
- DeMorgan: complement swaps AND/OR and complements each literal.
- is 1 only on row ; is 0 only on row ; .
- and use complementary index lists.
- POS shortcut: write as SOP, then apply DeMorgan.
- AND-OR becomes NAND-NAND; OR-AND becomes NOR-NOR (bubble trick).
- Shannon expansion splits a function on one variable; it reappears in MUX design.
- Trap: in a maxterm, a 0 bit means the uncomplemented variable.