Boolean Algebra and De Morgan's Laws
Learn the Boolean identities, absorption and consensus, and De Morgan's laws, with worked simplification examples and truth table proofs you can check.
Algebra for two valued variables
Boolean algebra is the algebra of variables that can be only 0 or 1. It has three basic operations: AND, written as a dot or as two letters side by side, OR, written with a plus sign, and NOT, written with an apostrophe or a bar. Every circuit of gates can be written as a Boolean expression, and every expression can be built as a circuit.
The reason to learn the rules is economy. A simpler expression needs fewer gates, fewer chips and fewer wires. It also has fewer places to go wrong.
The basic identities
| Rule | AND form | OR form |
|---|---|---|
| Identity | A · 1 = A | A + 0 = A |
| Null | A · 0 = 0 | A + 1 = 1 |
| Idempotent | A · A = A | A + A = A |
| Complement | A · A' = 0 | A + A' = 1 |
| Double negation | (A')' = A | (A')' = A |
| Commutative | A · B = B · A | A + B = B + A |
| Distributive | A (B + C) = AB + AC | A + BC = (A + B)(A + C) |
Every row has two forms. If you swap AND and OR and swap 0 and 1 in a true statement, the result is also true. This is called duality.
Absorption and consensus
Three rules remove terms from an expression, and they are used constantly.
A + AB = A A + A'B = A + B AB + A'C + BC = AB + A'C
The first rule says that when A is 1, the term AB adds nothing, and when A is 0 the term AB is 0. The second removes a variable. The third is the consensus theorem: the term BC is redundant, because whenever it would matter, one of the other two terms is already 1.
De Morgan's laws
De Morgan's laws tell you how a NOT sign passes through an AND or an OR.
(A · B)' = A' + B' (A + B)' = A' · B'
In words: the opposite of an AND is the OR of the opposites, and the opposite of an OR is the AND of the opposites. They work for any number of variables. Prove the first one with a truth table. For A = 1 and B = 1, the left side is (1)' = 0 and the right side is 0 + 0 = 0. For A = 1 and B = 0, the left side is 0' = 1 and the right side is 0 + 1 = 1. The other two rows agree as well.
Gate form of De Morgan's laws
The laws also have a drawing form. A NAND gate is the same as an OR gate with a bubble on each input. A NOR gate is the same as an AND gate with a bubble on each input. Circuit designers use the form that makes the signal polarity clear. An active low enable is often drawn as an OR gate with bubbled inputs, even though the chip is a NAND.
A worked simplification
Simplify F = AB + AB' + A'B step by step.
F = AB + AB' + A'B = A (B + B') + A'B take A out of the first two terms = A · 1 + A'B complement rule = A + A'B identity rule = A + B absorption
The original expression needs three AND gates and one OR gate. The result is one OR gate. You can check it by a truth table: F is 0 only for A = 0 and B = 0, exactly as A + B is.
Simplifying with De Morgan
Take Y = ((A + B) · C)'. Apply De Morgan to the outer bar: Y = (A + B)' + C'. Apply it again to the first term: Y = A'B' + C'. The expression now has no long bars, and can be built with two inverters, one AND and one OR.
When a result is long, try the truth table and a Karnaugh map as a check, since algebra can hide a better answer.
Try it in the virtual lab
SinBench has free 3D benches and interactive demos for this topic. Open one to try the ideas above with real instruments, no sign up needed.
NAND and NOR as Universal Gates
Questions and answers
What are De Morgan's laws?
The complement of an AND is the OR of the complements: (AB)' = A' + B'. The complement of an OR is the AND of the complements: (A + B)' = A'B'.
What is the absorption law?
A + AB = A. The term AB is absorbed, because it can be 1 only when A is already 1.
Why simplify a Boolean expression?
A simpler expression needs fewer gates and chips, costs less, uses less power and has fewer wires that can be wrong.
What is the consensus theorem?
It says AB + A'C + BC = AB + A'C. The third term is redundant and can be removed.
Related topics
Logic Gates and Truth Tables: AND, OR, NOT, NAND, NOR, XOR
Learn the seven basic logic gates with truth tables, symbols and expressions, the common TTL chips that hold them and how to read a gate level circuit.
Digital Logic DesignNAND and NOR as Universal Gates
See why NAND and NOR are universal gates. Build NOT, AND, OR and XOR from NAND only and from NOR only, count the gates and use two level NAND logic.
Digital Logic DesignKarnaugh Maps: Simplify Boolean Functions Step by Step
A step by step guide to Karnaugh maps: how to fill a 4 variable map, group cells, use don't cares and write the simplest sum of products, with a worked example.