3.1.7Boolean Algebra & Logic Gates

Boolean algebra laws (commutative, associative, distributive)

2,015 words9 min readdifficulty · medium

Notation first (so nothing is mysterious)

  • ABA \cdot B (or ABAB) means AND — output 1 only if both are 1.
  • A+BA + B means OR — output 1 if at least one is 1.
  • A\overline{A} means NOT — flip the bit.
  • Values are only ==00 and 11== (there is no 22, no 1-1).

1. Commutative Law

WHY it's true: max(A,B)=max(B,A)\max(A,B)=\max(B,A) and min(A,B)=min(B,A)\min(A,B)=\min(B,A). Swapping two numbers doesn't change which is bigger or smaller.

HOW to prove it — truth table (Derivation from scratch):

AA BB A+BA+B B+AB+A
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1

Columns A+BA+B and B+AB+A are identical → the law holds. Same trick works for AND.


2. Associative Law

WHY it's true: max(max(A,B),C)=max(A,B,C)=max(A,max(B,C))\max(\max(A,B),C) = \max(A,B,C) = \max(A,\max(B,C)). The maximum of three numbers is the same no matter which pair you compare first.

HOW — verify one line of the truth table: Take A=1,B=0,C=0A=1, B=0, C=0.

  • (A+B)+C=(1+0)+0=1+0=1(A+B)+C = (1+0)+0 = 1+0 = 1
  • A+(B+C)=1+(0+0)=1+0=1A+(B+C) = 1+(0+0) = 1+0 = 1

3. Distributive Law

WHY the first one is true (Feynman-style): "AA AND (B or C)" fires when AA is on and at least one of B,CB,C is on. That's exactly "(AA and BB) or (AA and CC)". Splitting the OR across AA doesn't change the meaning.

HOW — prove the second (the one that trips people up) by truth table:

AA BB CC BCB\cdot C A+(BC)A+(B\cdot C) A+BA+B A+CA+C (A+B)(A+C)(A+B)(A+C)
0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 0
0 1 0 0 0 1 0 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1
1 0 1 0 1 1 1 1
1 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1

Columns A+(BC)A+(B\cdot C) and (A+B)(A+C)(A+B)(A+C) match every row → law proven from scratch.

Figure — Boolean algebra laws (commutative, associative, distributive)

Common Mistakes (Steel-manned)


Recall Feynman: explain to a 12-year-old

Imagine two light switches. Commutative: it doesn't matter which switch you call "first" — flipping switch-A-then-B or switch-B-then-A gives the same light. Associative: if three friends must ALL agree (AND) to go to the park, it doesn't matter whether the first two decide first or the last two — you still need all three saying yes. Distributive: "I'll eat cake if (it's a party) AND (it's chocolate OR vanilla)" is the same as "I'll eat if (party and chocolate) OR (party and vanilla)". Same rules, just written two ways — and picking the shorter way means a factory can build the machine with fewer parts.


Active Recall

Commutative law (OR form)
A+B=B+AA + B = B + A — order of operands doesn't change the result.
Commutative law (AND form)
AB=BAA \cdot B = B \cdot A.
Associative law (AND)
(AB)C=A(BC)(A\cdot B)\cdot C = A\cdot(B\cdot C) — grouping of same operator doesn't matter.
Distributive law (AND over OR)
A(B+C)=AB+ACA(B+C) = AB + AC, identical to ordinary algebra.
Distributive law (OR over AND)
A+BC=(A+B)(A+C)A + BC = (A+B)(A+C) — the lone term duplicates into both brackets.
Why does A+BC=(A+B)(A+C)A+BC=(A+B)(A+C) hold?
Expand (A+B)(A+C)=A+AC+AB+BC(A+B)(A+C)=A+AC+AB+BC, use AA=AA\cdot A=A and 1+X=11+X=1 to collapse to A+BCA+BC.
Gates saved by factoring AB+ACA(B+C)AB+AC \to A(B+C)
From 3 gates (2 AND + 1 OR) to 2 gates (1 AND + 1 OR).
Does associativity let you mix AND and OR?
No — it only applies within the same operator; crossing operators needs distributive.
Underlying meaning of ABA\cdot B and A+BA+B
min(A,B)\min(A,B) and max(A,B)\max(A,B) — every law follows from min/max properties.
Common wrong distribution of A+BCA+BC
Writing (A+B)C(A+B)\cdot C; correct is (A+B)(A+C)(A+B)(A+C) — the AA must appear twice.

Connections

  • Boolean Algebra Identity & Null Laws (uses AA=AA\cdot A=A, 1+X=11+X=1 in the proofs above)
  • De Morgan's Theorems (next tool for simplification after these laws)
  • Logic Gates AND OR NOT (physical meaning of \cdot, ++, A\overline{\phantom{A}})
  • Karnaugh Maps (visual method that automates distributive factoring)
  • Combinational Circuit Simplification (where fewer gates = the payoff)

Concept Map

proves

proves

proves

verifies

verifies

aligns

enables

allows

removes

optimises

yields

min and max engine

Commutative Law

Associative Law

Distributive Law

Truth table proof

Common factor A

Fewer gates

Cheaper faster hardware

Flexible gate wiring

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, Boolean algebra basically true/false ka math hai — sirf do values chalti hain, 00 aur 11. Yahan \cdot ka matlab AND hai (dono on ho tabhi output 1) aur ++ ka matlab OR hai (koi ek bhi on ho to output 1). Sabse important trick: AND ko min\min samjho aur OR ko max\max samjho. Ek baar yeh samajh gaye, to teenon laws khud-ba-khud prove ho jaate hain.

Commutative matlab order se farak nahi padta: A+B=B+AA+B = B+A, kyunki max\max mein kaun pehle likha hai isse koi matlab nahi. Associative matlab bracket ki grouping se farak nahi padta jab tak same operator ho: (A+B)+C=A+(B+C)(A+B)+C = A+(B+C). Lekin dhyan rakho — yeh sirf same operator ke andar chalta hai, AND aur OR mix karoge to yeh law fail ho jaayega.

Distributive thoda tricky hai kyunki iske do form hain. Pehla normal algebra jaisa: A(B+C)=AB+ACA(B+C)=AB+AC. Doosra "ulta" wala jo students ko confuse karta hai: A+BC=(A+B)(A+C)A+BC=(A+B)(A+C) — yahan lone term AA ko dono brackets mein copy karna padta hai, warna galat. Isko proof karne ke liye (A+B)(A+C)(A+B)(A+C) expand karo aur AA=AA\cdot A = A use karke collapse kar do.

Yeh matter kyun karta hai? Kyunki har simplification se hardware mein gates kam ho jaate hain. Jaise AB+ACAB+AC (3 gates) ko A(B+C)A(B+C) (2 gates) bana do — same output, sasta chip, kam power, zyada speed. Exam mein bhi aur real chip design mein bhi yahi kaam aata hai.

Go deeper — visual, from zero

Test yourself — Boolean Algebra & Logic Gates

Connections