A three-computer flight controller has to agree on one answer, even if one of the computers fails. The rule is simple: trust any answer that at least two computers give. Written as logic, that rule is AB + AC + BC, and it fits into four gates. Every decision a chip makes, from a safety interlock to the control logic of a processor, starts the same way: a sentence of conditions becomes a Boolean expression, the expression gets simplified, and what is left becomes gates and transistors.
16 min read | Beginner Level
What You'll Learn
- The basic logic gates, their truth tables, and how to turn a word problem into an expression
- The laws of Boolean algebra, including absorption, consensus, and duality, and how to use them to simplify logic
- Minterms, maxterms, and how to move between sum-of-products and product-of-sums forms
- How De Morgan's theorem shapes the transistor networks inside a CMOS gate
Boolean Values and Operators
Boolean logic works with only two values: 0 (false) and 1 (true). In a digital circuit these are two voltage ranges: a voltage near ground reads as 0, and a voltage near the supply reads as 1. Every digital function, however large, is built from three basic operations:
| Operation | Written as | Result is 1 when |
|---|---|---|
| NOT (complement) | A' or a bar over A | A is 0 |
| AND (product) | A · B or AB | A and B are both 1 |
| OR (sum) | A + B | A or B or both are 1 |
The operators have a fixed precedence, just like multiplication before addition in ordinary arithmetic:
Precedence: NOT first, then AND, then OR A + B · C' means A + (B · (C')) (A + B) · C needs the brackets to force the OR first (AB)' is NOT of the product; A'B' is the product of two NOTs
Logic Gates and Their Truth Tables
A logic gate is a circuit that computes one Boolean operation. A truth table lists the output for every combination of inputs: n inputs give 2n rows. Besides AND, OR, and NOT, four combined gates are used everywhere:
| A | B | AND AB | OR A + B | NAND (AB)' | NOR (A + B)' | XOR A ⊕ B | XNOR (A ⊕ B)' |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
Two quick ways to read the table: XOR is 1 when the inputs differ, and XNOR is 1 when they are equal, which makes XNOR a 1-bit equality checker. NAND and NOR are simply AND and OR with the output inverted.
From Words to an Expression to a Circuit
Take the voting rule from the opening: output F is 1 when at least two of the three inputs A, B, C are 1. The method works for any word problem:
Step 1 Write the truth table. (8 rows for 3 inputs)
Step 2 Mark every row where F = 1. (rows 011, 101, 110, 111)
Step 3 Write one AND term per marked row, using A for a 1 and A' for a 0:
011 -> A'BC 101 -> AB'C 110 -> ABC' 111 -> ABC
Step 4 OR the terms together:
F = A'BC + AB'C + ABC' + ABC
Step 5 Simplify (shown in the simplification section):
F = AB + AC + BC
| A | B | C | F (majority) | Term |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | |
| 0 | 0 | 1 | 0 | |
| 0 | 1 | 0 | 0 | |
| 0 | 1 | 1 | 1 | A'BC |
| 1 | 0 | 0 | 0 | |
| 1 | 0 | 1 | 1 | AB'C |
| 1 | 1 | 0 | 1 | ABC' |
| 1 | 1 | 1 | 1 | ABC |
The Laws of Boolean Algebra
Boolean algebra has its own rules. Some look like ordinary algebra, and some, such as A + A = A, do not. Every law comes in a pair: swap AND with OR and 0 with 1, and you get its dual, which is also true. This is the duality principle.
| Law | OR form | AND form (dual) |
|---|---|---|
| Identity | A + 0 = A | A · 1 = A |
| Null (annulment) | A + 1 = 1 | A · 0 = 0 |
| Idempotent | A + A = A | A · A = A |
| Complement | A + A' = 1 | A · A' = 0 |
| Involution | (A')' = A | |
| Commutative | A + B = B + A | AB = BA |
| Associative | (A + B) + C = A + (B + C) | (AB)C = A(BC) |
| Distributive | A + BC = (A + B)(A + C) | A(B + C) = AB + AC |
| Absorption | A + AB = A | A(A + B) = A |
| Redundant literal | A + A'B = A + B | A(A' + B) = AB |
| Consensus | AB + A'C + BC = AB + A'C | (A + B)(A' + C)(B + C) = (A + B)(A' + C) |
| De Morgan | (A + B)' = A'B' | (AB)' = A' + B' |
Any law can be proved by perfect induction: check both sides on every row of the truth table. For the redundant-literal law A + A'B = A + B:
| A | B | A'B | A + A'B | A + B |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 |
In words: if A is already 1, the OR is already 1, so the A' in the second term adds nothing. The consensus law says something similar: in AB + A'C + BC, the term BC is only 1 when B = C = 1, and then either AB or A'C is already 1, depending on A. BC is redundant.
Quick Check
Q: Use De Morgan's theorem to complement (ABC)'. Which gate does the result describe?
Show Answer
(ABC)' = A' + B' + C'. It is a 3-input NAND gate: its output is 0 only when all three inputs are 1. It is not a NOR gate; a 3-input NOR would be (A + B + C)' = A'B'C'.
Simplifying Expressions Step by Step
Simplification removes terms and literals, and every literal removed is a gate input, and two transistors, that never get built. Three worked examples:
Example 1: the majority function
F = A'BC + AB'C + ABC' + ABC
= A'BC + AB'C + ABC' + ABC + ABC + ABC idempotent: ABC = ABC + ABC + ABC
= (A'+A)BC + A(B'+B)C + AB(C'+C) group each term with one copy of ABC
= BC + AC + AB complement: X' + X = 1, identity: 1 . Y = Y
Example 2: removing a consensus term
G = AB + A'C + BC
= AB + A'C consensus: BC is covered by AB or A'C
Example 3: complementing with De Morgan
H = (AB + C)'
= (AB)' . C' De Morgan on the OR
= (A' + B') . C' De Morgan on the AND
What the majority simplification saves in hardware, built as two-level NAND logic (an n-input NAND uses 2n transistors, an inverter uses 2):
| Form | Gates | Transistors |
|---|---|---|
| A'BC + AB'C + ABC' + ABC | 3 inverters, 4 NAND3, 1 NAND4 | 6 + 24 + 8 = 38 |
| AB + AC + BC | 3 NAND2, 1 NAND3 | 12 + 6 = 18 |
What comes out of synthesis: you never have to do this by hand in a real design. Synthesis tools apply the same laws automatically: they remove redundant terms, share common sub-expressions, and propagate constants (a signal tied to 0 makes every AND it feeds 0, by the null law, so that logic disappears). The majority function above typically comes out as a NAND2/NAND3 network or a single complex AND-OR-INVERT cell plus an inverter, whichever meets timing with less area.
Minterms, Maxterms, and Canonical Forms
A product term is an AND of literals, such as AB or A'C. A minterm is a special product term that contains every variable exactly once, such as A'BC. Each minterm is 1 on exactly one row of the truth table. A maxterm is an OR of every variable, and is 0 on exactly one row.
| Row | A B C | Minterm (1 on this row only) | Maxterm (0 on this row only) |
|---|---|---|---|
| 0 | 0 0 0 | m0 = A'B'C' | M0 = A + B + C |
| 1 | 0 0 1 | m1 = A'B'C | M1 = A + B + C' |
| 2 | 0 1 0 | m2 = A'BC' | M2 = A + B' + C |
| 3 | 0 1 1 | m3 = A'BC | M3 = A + B' + C' |
| 4 | 1 0 0 | m4 = AB'C' | M4 = A' + B + C |
| 5 | 1 0 1 | m5 = AB'C | M5 = A' + B + C' |
| 6 | 1 1 0 | m6 = ABC' | M6 = A' + B' + C |
| 7 | 1 1 1 | m7 = ABC | M7 = A' + B' + C' |
Note the opposite conventions: in a minterm, a 0 in the row becomes a complemented variable; in a maxterm, a 1 becomes a complemented variable. Each one is built to match exactly its own row.
- Sum of products (SOP) is an OR of product terms, such as AB + AC + BC. The canonical SOP uses only minterms, one per row where F = 1.
- Product of sums (POS) is an AND of sum terms, such as (A + B)(A + C). The canonical POS uses only maxterms, one per row where F = 0.
Converting between the two canonical forms needs no algebra: just list the rows that are missing.
Majority function, rows where F = 1: 3, 5, 6, 7
Canonical SOP: F = sum of m(3, 5, 6, 7) = A'BC + AB'C + ABC' + ABC
Rows where F = 0 are all the others: 0, 1, 2, 4
Canonical POS: F = product of M(0, 1, 2, 4)
= (A + B + C)(A + B + C')(A + B' + C)(A' + B + C)
Use whichever form needs fewer terms: a function that is 1 on most rows has a short POS, and a function that is 1 on few rows has a short SOP.
De Morgan's Theorem Inside a CMOS Gate
De Morgan's theorem is not just an algebra trick: it is how every static CMOS gate is designed. A CMOS gate has two transistor networks:
- The pull-down network of NMOS transistors connects the output to ground. An NMOS conducts when its input is 1. Transistors in series conduct only if all are on (AND); transistors in parallel conduct if any is on (OR).
- The pull-up network of PMOS transistors connects the output to the supply. A PMOS conducts when its input is 0, so it naturally works with complemented inputs.
For Y = (AB + C)', the pull-down must conduct when AB + C = 1: A and B in series, in parallel with C. The pull-up must conduct exactly when the output is 1, that is, when (AB + C)' = 1. De Morgan's theorem turns this into (A' + B')C', which tells you the pull-up structure directly: A and B in parallel, in series with C.
Rule that falls out of De Morgan's theorem:
pull-down network: series <-> parallel :pull-up network
parallel <-> series
(the pull-up is the dual of the pull-down, so exactly one of them conducts)
This gate is a single AOI21 cell (AND-OR-INVERT) of 6 transistors, with one stage of delay. Building the same function from separate gates, an AND2 (6 transistors) driving a NOR2 (4 transistors), takes 10 transistors and two stages. Synthesis tools look for exactly this pattern.
Quick Check
Q: A pull-down network has two NMOS transistors in parallel (inputs A and B), and that pair is in series with a third NMOS (input C). What function does the gate compute, and what does its pull-up look like?
Show Answer
The pull-down conducts when (A + B)C = 1, so Y = ((A + B)C)'. By De Morgan, Y = A'B' + C', so the pull-up has PMOS A and B in series, and that pair in parallel with PMOS C. This gate is an OAI21 (OR-AND-INVERT).
Where Does Boolean Logic Show Up?
- Fault-tolerant voting: Triple modular redundancy runs three copies of a circuit and passes their outputs through the majority function AB + AC + BC, so a single faulty copy is outvoted. It is used in spacecraft, avionics, and radiation-hardened chips.
- Address decoding: In a processor system, a memory chip is selected by a product term of the high address bits. For example, a chip that occupies addresses 0x4000 to 0x5FFF is enabled by A15' . A14 . A13', a single 3-input AND of address lines.
- Safety interlocks: A machine may run only if Start is pressed AND the guard is closed AND the emergency stop is NOT pressed: Run = Start . Guard . EStop'. In safety logic this is often implemented with redundant channels and checked with exactly these truth tables.
- Equality and parity checks: XNOR gates compare bits for equality, and chains of XOR gates compute parity bits for error detection in memories and serial links.
Common Mistakes
Mistake #1: Misapplying De Morgan's theorem
When you break the bar, you must also change the operator: (A + B)' = A'B', not A' + B'. A quick sanity check: with A = 1, B = 0, (A + B)' is 0, while A' + B' would be 1.
Mistake #2: Using rules from ordinary algebra
In Boolean algebra A + A = A (not 2A) and A + 1 = 1. You also cannot cancel: AB = AC does not mean B = C (try A = 0). In the other direction, A + BC = (A + B)(A + C) is true in Boolean algebra even though it is false for ordinary numbers.
Mistake #3: Ignoring operator precedence
AND binds tighter than OR, so A + BC means A + (BC). If you mean (A + B)C, you must write the brackets. A misplaced bracket changes the truth table and therefore the circuit.
Mistake #4: Calling every product term a minterm
AB is a product term but, in a 3-variable function, not a minterm: a minterm must contain every variable. AB covers two minterms, ABC' and ABC. An SOP expression is a sum of product terms; only the canonical SOP is a sum of minterms.
Mistake #5: Confusing the complemented-AND form with NOR
A' + B' + C' is (ABC)', a NAND, because it is 0 only when all inputs are 1. A'B'C' is (A + B + C)', a NOR. Check the all-ones row to tell them apart.
Practice Exercise
Challenge: Design and Simplify a Boolean Function
A car's interior light (F) must turn on when the door is open (C = 1), or when the headlights are on (A = 1) and the key has just been removed (B = 1).
- Write the truth table and the canonical SOP as a sum of minterms.
- Simplify the expression using the laws of Boolean algebra, naming each law you use.
- Write the canonical POS and a simplified POS.
- How many 2-input NAND gates does the simplified function need?
Hint
F is 1 on rows 1, 3, 5, 6, and 7. Combine the four rows where C = 1 first, then use the redundant-literal law A + A'B = A + B.
Solution
1. A B C | F
0 0 0 | 0
0 0 1 | 1 m1
0 1 0 | 0
0 1 1 | 1 m3
1 0 0 | 0
1 0 1 | 1 m5
1 1 0 | 1 m6
1 1 1 | 1 m7
F = sum of m(1, 3, 5, 6, 7) = A'B'C + A'BC + AB'C + ABC' + ABC
2. A'B'C + A'BC = A'C(B' + B) = A'C distributive, complement, identity
AB'C + ABC = AC(B' + B) = AC same laws
A'C + AC = C(A' + A) = C same laws
F = C + ABC'
= C + AB redundant literal: X + X'Y = X + Y, with X = C
3. Rows where F = 0: 0, 2, 4
Canonical POS: F = (A + B + C)(A + B' + C)(A' + B + C)
Simplified POS: F = (A + C)(B + C) distributive: C + AB = (C + A)(C + B)
4. F = C + AB = ((AB)' . C')' De Morgan
= (A NAND B) NAND (C NAND C)
3 NAND gates: one for A NAND B, one as an inverter for C, one to combine.
Summary
In this tutorial, you learned:
- Boolean logic uses two values and three basic operations; NOT binds tightest, then AND, then OR
- Truth tables define every gate: XOR detects difference, XNOR detects equality, NAND and NOR invert AND and OR
- A word problem becomes a truth table, then one minterm per true row, then a simplified expression
- Every Boolean law has a dual; absorption, redundant-literal, and consensus laws remove terms, and each removed literal saves transistors
- Canonical SOP lists the rows where F = 1 as minterms; canonical POS lists the rows where F = 0 as maxterms
- De Morgan's theorem makes the CMOS pull-up network the series-parallel dual of the pull-down network, which is how complex gates like AOI21 are built