Boolean algebra and simplification
A-Level Computer Science · Logic Gates and Boolean Algebra
The laws worth memorising
Identity: $A+0=A$, $A\cdot1=A$. Null: $A+1=1$, $A\cdot0=0$. Idempotent: $A+A=A$, $A\cdot A=A$. Complement: $A+\overline{A}=1$, $A\cdot\overline{A}=0$. Double negation: $\overline{\overline{A}}=A$.
The three that do the real work
Distributive: $A\cdot(B+C)=AB+AC$ and, less obviously, $A+(B\cdot C)=(A+B)\cdot(A+C)$. Absorption: $A+AB=A$ and $A\cdot(A+B)=A$. De Morgan: $\overline{A+B}=\overline{A}\cdot\overline{B}$ and $\overline{A\cdot B}=\overline{A}+\overline{B}$ — break the bar, change the sign.
Why simplify
Fewer gates means lower cost, lower power, less heat and a faster circuit because the signal passes through fewer levels. Questions almost always ask for the practical reason as well as the algebra.
Karnaugh maps
For up to four variables a K-map is faster and safer than algebra. Label rows and columns in Gray code ($00,01,11,10$) so adjacent cells differ in one variable. Group 1s in rectangles of $1,2,4,8$ — as large as possible, overlapping allowed, wrapping around edges allowed. Each group drops the variable that changes within it. A variable that stays 0 throughout the group appears complemented; one that stays 1 appears plain.
Checking your answer
Always verify a simplification against the original truth table, or at least against the rows where the output is 1. An algebraic slip is invisible until you test it.
Worked example: simplifying with laws, then checking with a table
Simplify $Y = A\cdot B + A\cdot\overline{B} + \overline{A}\cdot B$ and state how many gates the simplified circuit needs.
Solution
Method 1: algebraic manipulation.
Group the first two terms: $A\cdot B + A\cdot\overline{B} = A\cdot(B+\overline{B})$ by the distributive law.
Since $B+\overline{B}=1$ (complement law), that part equals $A\cdot1=A$.
What remains: $Y = A + \overline{A}\cdot B$.
Apply $A+\overline{A}B=A+B$ (a form of the absorption law): $\boxed{Y = A + B}$.
Method 2: check with a truth table.
$A\,B=00$: $0+0+0=0$; $A+B=0$ ✓
$A\,B=01$: $0+0+1=1$; $A+B=1$ ✓
$A\,B=10$: $0+1+0=1$; $A+B=1$ ✓
$A\,B=11$: $1+0+0=1$; $A+B=1$ ✓
All four rows match exactly, so the simplification is correct.
Number of gates. The original expression needs $2$ NOT gates, $3$ AND gates and $2$ OR gates, a total of $7$. The simplified expression needs exactly $1$ OR gate. This is the practical reason for simplifying: $6$ fewer gates means cheaper, less power, and the signal passes through only one stage so it is faster.