Salick Academy

Logic and Boolean Algebra

No calculator

Boolean algebra is the arithmetic of two values, 1 and 0 — true and false, on and off. It is the mathematics inside every digital circuit, and the point of it is simplification: fewer gates, less cost, less delay.

Propositions and connectives

A proposition is either true (1) or false (0). Three basic operations combine them:

Operation Boolean notation Logic notation Meaning
AND ABA \cdot B or ABAB ABA \wedge B both
OR A+BA + B ABA \vee B at least one
NOT AA' or Aˉ\bar{A} ¬A\neg A the opposite

Truth tables

A truth table lists every combination of inputs and the resulting output. With nn inputs there are 2n2^n rows — 4 for two inputs, 8 for three, 16 for four.

ABABA+BAB(AB)000001010111100111111100\begin{array}{cc|cccc} A & B & AB & A+B & A \oplus B & (AB)' \\ \hline 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 0 & 0 \end{array}

Logic gates

Gate Output is 1 when Boolean form
AND all inputs are 1 ABAB
OR at least one input is 1 A+BA + B
NOT the input is 0 AA'
NAND not all inputs are 1 (AB)(AB)'
NOR no input is 1 (A+B)(A+B)'
XOR exactly one input is 1 ABA \oplus B

NAND is an AND gate followed by a NOT; NOR is an OR gate followed by a NOT. Both are important in practice because every logic function can be built from NAND gates alone — a fact that simplifies manufacturing enormously.

Boolean algebra laws

Law AND form OR form
Identity A1=AA \cdot 1 = A A+0=AA + 0 = A
Null A0=0A \cdot 0 = 0 A+1=1A + 1 = 1
Idempotent AA=AA \cdot A = A A+A=AA + A = A
Complement AA=0A \cdot A' = 0 A+A=1A + A' = 1
Double negation (A)=A(A')' = A (A)=A(A')' = A
Commutative AB=BAAB = BA A+B=B+AA+B = B+A
Associative (AB)C=A(BC)(AB)C = A(BC) (A+B)+C=A+(B+C)(A+B)+C = A+(B+C)
Distributive A(B+C)=AB+ACA(B+C) = AB + AC A+BC=(A+B)(A+C)A + BC = (A+B)(A+C)
Absorption A(A+B)=AA(A+B) = A A+AB=AA + AB = A

De Morgan's laws

(AB)=A+B(A+B)=AB(A \cdot B)' = A' + B' \qquad (A + B)' = A' \cdot B'

Break the bar and change the sign. Negating a compound expression negates each part and swaps AND with OR.

Check the first against the table above: (AB)(AB)' gives 1,1,1,01,1,1,0, and A+BA'+B' gives 1+11+1, 1+01+0, 0+10+1, 0+00+0 — that is 1,1,1,01,1,1,0

In circuit terms: a NAND gate is equivalent to an OR gate with both inputs inverted.

Simplifying circuits

Fewer gates means cheaper, faster, more reliable hardware.

Simplify A+ABA + AB.

A+AB=A(1+B)=A1=AA + AB = A(1 + B) = A \cdot 1 = A

The BB input is irrelevant, and an entire AND gate can be removed.

Simplify AB+ABAB + AB'.

AB+AB=A(B+B)=A1=AAB + AB' = A(B + B') = A \cdot 1 = A

Simplify A+ABA + A'B.

A+AB=(A+A)(A+B)=1(A+B)=A+BA + A'B = (A + A')(A + B) = 1 \cdot (A+B) = A + B

using the second distributive law. Verify with a truth table: the values are 0,1,1,10, 1, 1, 1 for both expressions ✓