Part 3: Boolean Algebra and Logic Gates
Source: Part-3-+Boolean+Algebra+and+Logic+Gates.pdf
Formal Definition: A logic gate is a physical device implementing a Boolean function. It takes binary inputs and produces a single binary output based on a specific logical operation.
AND gate: Output is 1 ONLY when ALL inputs are 1. Symbol: $F = A \cdot B$ or $F = AB$
OR gate: Output is 1 when ANY input is 1. Symbol: $F = A + B$
NOT gate (Inverter): Output is the opposite of input. Symbol: $F = \overline{A}$ or $A'$
These correspond to Boolean algebra operations: AND = multiplication, OR = addition, NOT = complement.
Key Points
- AND: output 1 only if ALL inputs are 1. $F = A \cdot B$
- OR: output 1 if ANY input is 1. $F = A + B$
- NOT: inverts the input. $F = \overline{A}$
- AND with 0 → always 0 (like multiplying by 0)
- OR with 1 → always 1
- These 3 gates can build ANY digital circuit
- Truth table: lists all input combinations and their outputs
Formulas
Worked Examples
Problem: Write the truth table for a 2-input AND gate.
- List all input combinations for A and B: (0,0), (0,1), (1,0), (1,1)
- A=0, B=0: $0 \cdot 0 = 0$
- A=0, B=1: $0 \cdot 1 = 0$
- A=1, B=0: $1 \cdot 0 = 0$
- A=1, B=1: $1 \cdot 1 = 1$
Answer: Truth table: output is 1 ONLY when A=1 AND B=1. All other combinations give 0.
⚠️ Common Traps
🧪 Quick Self-Test
NOR: OR followed by NOT. $F = \overline{A+B}$. Output is 1 ONLY when all inputs are 0.
XOR (Exclusive OR): $F = A \oplus B$. Output is 1 when inputs are DIFFERENT.
XNOR (Exclusive NOR): $F = \overline{A \oplus B}$. Output is 1 when inputs are the SAME.
Universal gates: NAND and NOR are each individually capable of implementing ANY Boolean function. This makes them highly versatile in circuit design.
Key Points
- NAND = NOT-AND: $F = \overline{AB}$ — universal gate
- NOR = NOT-OR: $F = \overline{A+B}$ — universal gate
- XOR: $F = A \oplus B = A\overline{B} + \overline{A}B$ — outputs 1 when inputs differ
- XNOR: $F = \overline{A \oplus B} = AB + \overline{A}\overline{B}$ — outputs 1 when inputs are same
- NAND and NOR are universal: can build AND, OR, NOT from either alone
- NOT from NAND: connect both inputs together → $\overline{A \cdot A} = \overline{A}$
- XOR is useful for parity checking and addition circuits
Formulas
Worked Examples
Problem: Implement a NOT gate using only NAND gates.
- A NAND gate with both inputs connected to A: $\overline{A \cdot A} = \overline{A}$
- Since $A \cdot A = A$, we get $\overline{A}$
Answer: Connect both inputs of a NAND gate to the same signal A → output is $\overline{A}$.
Problem: Write the truth table for XOR.
- A=0, B=0: same → $0 \oplus 0 = 0$
- A=0, B=1: different → $0 \oplus 1 = 1$
- A=1, B=0: different → $1 \oplus 0 = 1$
- A=1, B=1: same → $1 \oplus 1 = 0$
Answer: XOR outputs 1 when inputs are different, 0 when they're the same.
⚠️ Common Traps
🧪 Quick Self-Test
Key Points
- Identity: $A + 0 = A$, $A \cdot 1 = A$
- Null: $A + 1 = 1$, $A \cdot 0 = 0$
- Complement: $A + \overline{A} = 1$, $A \cdot \overline{A} = 0$
- Idempotent: $A + A = A$, $A \cdot A = A$
- Involution: $\overline{\overline{A}} = A$ (double complement)
- Commutative: $A + B = B + A$, $AB = BA$
- Associative: $A + (B + C) = (A + B) + C$
- Distributive: $A(B + C) = AB + AC$ and $A + BC = (A+B)(A+C)$
- Absorption: $A + AB = A$, $A(A + B) = A$
- De Morgan's: $\overline{AB} = \overline{A} + \overline{B}$, $\overline{A+B} = \overline{A} \cdot \overline{B}$
- Consensus: $AB + \overline{A}C + BC = AB + \overline{A}C$
Formulas
Worked Examples
Problem: Simplify: $F = A\overline{B} + AB$
- Factor out $A$: $F = A(\overline{B} + B)$
- By complement law: $\overline{B} + B = 1$
- So $F = A \cdot 1 = A$
Answer: $F = A$
Problem: Simplify: $F = \overline{\overline{A}\,\overline{B}}$
- Apply De Morgan's: $\overline{\overline{A} \cdot \overline{B}} = \overline{\overline{A}} + \overline{\overline{B}}$
- Apply involution: $= A + B$
Answer: $F = A + B$
Problem: Simplify using absorption: $F = A + A \cdot B$
- By absorption law: $A + AB = A$
Answer: $F = A$
⚠️ Common Traps
🧪 Quick Self-Test
Formal Definition: SOP (Sum of Products) is a Boolean expression written as an OR of AND terms (minterms). POS (Product of Sums) is written as an AND of OR terms (maxterms).
POS: Each term is a sum (OR) of literals. Terms are multiplied (AND'd) together. Example: $F = (A+B)(\overline{A}+C)(B+C)$
To get SOP from truth table: find all rows where output = 1, write the corresponding minterms (AND terms), OR them together.
To get POS from truth table: find all rows where output = 0, write the corresponding maxterms (OR terms), AND them together.
Key Points
- SOP = OR of AND terms (minterms) — from rows where F=1
- POS = AND of OR terms (maxterms) — from rows where F=0
- A minterm: product term where every variable appears exactly once (normal or complemented)
- A maxterm: sum term where every variable appears exactly once
- Canonical SOP: all terms are minterms (every variable present in every term)
- Can convert between SOP and POS using De Morgan's or algebraically
Worked Examples
Problem: Write the SOP expression from this truth table: A=0,B=0→0; A=0,B=1→1; A=1,B=0→1; A=1,B=1→0
- F=1 for rows: (A=0,B=1) and (A=1,B=0)
- Row (0,1): minterm = $\overline{A}B$
- Row (1,0): minterm = $A\overline{B}$
- SOP: $F = \overline{A}B + A\overline{B}$
Answer: $F = \overline{A}B + A\overline{B}$ (this is actually XOR!)