Draft preview. Lessons are being written and reviewed.

Digital Design / Module 1: Numbers and logic

3. Boolean algebra and De Morgan

Simplify logic before spending gates on it.

Lecture coming soon

See it move

The idea

Every gate costs area, power and delay. Boolean algebra lets you rewrite a function into a cheaper one with exactly the same . Synthesis tools do this automatically, yet you still need the skill, to read logic, spot bugs and answer interview questions.

The rules you actually use

  • Identity: A + 0 = A, A·1 = A
  • Annihilator: A + 1 = 1, A·0 = 0
  • Complement: A + A' = 1, A·A' = 0
  • Absorption: A + AB = A
  • Redundancy: A + A'B = A + B

De Morgan's laws

(AB)' = A' + B' and (A + B)' = A'B'. As a recipe: invert each input, swap AND with OR, and invert the output. In hardware terms, a NAND is the same as an OR with inverted inputs. This matters because CMOS gates naturally invert, so real circuits are full of these conversions.

Worked example

Simplify F = AB + AB' + A'B.

  • Factor the first two terms: A(B + B') + A'B
  • Since B + B' = 1: A + A'B
  • By the redundancy rule: A + B

Three AND terms have become a single OR gate. The animation lets you confirm this across all four rows of the truth table.

Common mistake

Treating a shorter expression as automatically better. Removing a "redundant" term can bring back a : the consensus term in AB + A'C + BC adds nothing logically, yet it holds the output steady while A changes. In the Barrel shifters and glitches lesson, you can watch this happen.

Key ideas

  • De Morgan: invert the inputs, swap AND and OR, invert the output.
  • Absorption removes redundant terms: A + AB = A.
  • Consensus terms can matter when removing hazards.

Your exercise

Simplify F = AB + AB' + A'B.

Interview questions

coreSimplify A + A'B.

coreState De Morgan for (AB)'.

basicSimplify A(A + B).

basicApply De Morgan to (A + B')'.

coreShow that AB + A'C + BC equals AB + A'C. Why might a designer keep the BC term anyway?

coreRewrite F = AB + CD so that it uses only NAND gates.

coreThe comment says what the designer wanted. What does the code actually build, and how do you fix it?

// y should be 1 only when a and b are both 0
assign y = ~a | ~b;

coreIn ordinary arithmetic, a + bc does not equal (a + b)(a + c). Is A + BC = (A + B)(A + C) true in Boolean algebra?

advancedWhat is the dual of the identity A + A'B = A + B, and is the dual also true?

advancedSimplify F = (A + B)(A' + C) to a sum of products.

Practise these 10 questions with animations