Boolean Algebra
Boolean algebra is the algebra of variables that can only be 0 (false) or 1 (true), combined with OR (written x + y), AND (written xy) and NOT (written \overline{x}). Its laws, such as De Morgan’s laws, distribution and absorption, let you simplify a Boolean expression to an equivalent one with fewer operations.
Before this lesson: Truth Tables, Logical Equivalence and Set Operations
What is Boolean algebra?
In Boolean algebra every variable has the value 0 or 1. There are three basic operations, and each matches a logical connective from propositional logic.
| Operation | Notation | Value | Logic |
|---|---|---|---|
| OR (Boolean sum) | x + y | 1 if at least one of x, y is 1 | p \lor q |
| AND (Boolean product) | xy or x \cdot y | 1 only if both x and y are 1 | p \land q |
| NOT (complement) | \overline{x} | 1 if x is 0, and 0 if x is 1 | \neg p |
The arithmetic looks almost normal: 0 + 0 = 0, 0 + 1 = 1, 1 \cdot 1 = 1, 1 \cdot 0 = 0. The one surprise is 1 + 1 = 1, because “true or true” is just true. NOT is done first, then AND, then OR, so x + yz means x + (yz).
A Boolean expression is built from variables, 0, 1 and the three operations. Two expressions are equivalent when they give the same value for every choice of 0s and 1s, which you can always check with a truth table. The laws below let you prove equivalence and simplify without writing out every row.
Laws of Boolean algebra
| Law | OR form | AND form |
|---|---|---|
| Identity | x + 0 = x | x \cdot 1 = x |
| Domination | x + 1 = 1 | x \cdot 0 = 0 |
| Idempotent | x + x = x | x \cdot x = x |
| Complement | x + \overline{x} = 1 | x\overline{x} = 0 |
| Double complement | \overline{\overline{x}} = x | |
| Commutative | x + y = y + x | xy = yx |
| Associative | x + (y + z) = (x + y) + z | x(yz) = (xy)z |
| Distributive | x + yz = (x + y)(x + z) | x(y + z) = xy + xz |
| De Morgan’s laws | \overline{x + y} = \overline{x}\,\overline{y} | \overline{xy} = \overline{x} + \overline{y} |
| Absorption | x + xy = x | x(x + y) = x |
Two laws differ from ordinary algebra. Idempotence says x + x = x, not 2x. And OR distributes over AND: x + yz = (x + y)(x + z), which has no match for real numbers.
Duality. Swap every + with ·, and every 0 with 1, and a true law becomes another true law. That is why the table has two columns: each law’s AND form is the dual of its OR form.
The picture shows why the laws match the laws of set operations: read + as union, · as intersection and the complement as the set complement. Absorption says that adding a piece of x to x changes nothing.
Simplifying Boolean expressions examples
Example 1: Factoring out a variable
Simplify xy + x\overline{y}.
xy + x\overline{y}Start with the expression.
x(y + \overline{y})Factor out x with the distributive law (see the distributive property).
x \cdot 1
Complement law: y + \overline{y} = 1.
x
Identity law.
So xy + x\overline{y} = x. Whatever y is, the output equals x.
Example 2: Using the other distributive law
Simplify (x + y)(x + \overline{y}).
(x + y)(x + \overline{y})Start with the expression.
x + y\overline{y}Distributive law (OR form) read from right to left: (x + y)(x + z) = x + yz.
x + 0
Complement law: y\overline{y} = 0.
x
Identity law.
So (x + y)(x + \overline{y}) = x. This is the dual of Example 1: swap + and · in Example 1 and you get this example.
Example 3: Proving a useful identity
Prove that x + \overline{x}y = x + y.
x + \overline{x}yStart with the left side.
(x + \overline{x})(x + y)Distributive law (OR form).
1 \cdot (x + y)
Complement law: x + \overline{x} = 1.
x + y
Identity law.
This identity is worth remembering. In words: “x, or else not-x and y” is the same as “x or y”. You can check it with a truth table: both sides are 0 only when x = 0 and y = 0.
Example 4: Taking a complement with De Morgan’s laws
Find a simplified expression for the complement \overline{xy + \overline{z}}.
\overline{xy + \overline{z}}Start with the complement.
\overline{xy} \cdot \overline{\overline{z}}De Morgan’s law for a sum: \overline{a + b} = \overline{a}\,\overline{b}.
(\overline{x} + \overline{y}) \cdot \overline{\overline{z}}De Morgan’s law for a product: \overline{xy} = \overline{x} + \overline{y}.
(\overline{x} + \overline{y})zDouble complement law.
So \overline{xy + \overline{z}} = (\overline{x} + \overline{y})z. When you complement, every + becomes ·, every · becomes +, and each variable is complemented. These are the same De Morgan’s laws used to negate statements in logic.
Example 5: A majority vote (word problem)
Three judges each vote yes (1) or no (0), with votes x, y and z. A contestant advances when at least two judges vote yes. Write a Boolean expression F for “advances” from its truth table, then simplify it.
| x | y | z | F |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
F = \overline{x}yz + x\overline{y}z + xy\overline{z} + xyzWrite a product (a minterm) for each row with F = 1: a variable is complemented where it is 0.
F = \overline{x}yz + x\overline{y}z + xy\overline{z} + xyz + xyz + xyzIdempotent law: xyz = xyz + xyz + xyz.
F = (\overline{x}yz + xyz) + (x\overline{y}z + xyz) + (xy\overline{z} + xyz)Commutative and associative laws: regroup into pairs.
F = yz(\overline{x} + x) + xz(\overline{y} + y) + xy(\overline{z} + z)Distributive law in each pair.
F = yz \cdot 1 + xz \cdot 1 + xy \cdot 1
Complement law, three times.
F = xy + xz + yz
Identity law, then reorder.
The contestant advances exactly when some pair of judges both vote yes: F = xy + xz + yz. The first line is called the sum-of-products (or disjunctive normal) form; every Boolean function can be written this way from its truth table.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Treating + like ordinary addition | 1 + 1 = 2 or x + x = 2x | In Boolean algebra 1 + 1 = 1 and x + x = x (idempotent law). |
| Breaking a complement over a sum without switching the operation | \overline{x + y} = \overline{x} + \overline{y} | De Morgan: \overline{x + y} = \overline{x}\,\overline{y}. |
| Ignoring the order of operations | Reading x + yz as (x + y)z | AND comes before OR, just as multiplication comes before addition in the order of operations. |
| Cancelling as in real algebra | From x + y = x + z, concluding y = z | There is no subtraction. With x = 1, the equation holds for any y and z. |
| Forgetting the second distributive law | Leaving (x + y)(x + \overline{y}) multiplied out into four terms | Use (x + y)(x + z) = x + yz to collapse it in one step. |
| Dropping a variable that is not redundant | Simplifying x + \overline{x}y to just x | Absorption needs the same variable: x + xy = x, but x + \overline{x}y = x + y. |
Related ideas
Logic and sets. Boolean algebra, propositional logic and the algebra of sets follow the same laws. A truth table in logic, a membership table for sets and an input-output table for a Boolean function are the same object.
Circuits. Each Boolean operation can be built as an electronic gate, so a simpler expression means a cheaper, faster circuit. The next lesson, Logic Gates, draws circuits for the expressions in this lesson.
Normal forms. Besides the sum-of-products form in Example 5, every function also has a product-of-sums form, built from the rows where the output is 0. Karnaugh maps are a picture-based way to find the simplest sum of products for up to four variables.
Practice problems
- Simplify x + xy.
- Simplify x(\overline{x} + y).
- Simplify \overline{\overline{x} + y}.
- Simplify xyz + xy\overline{z}.
- Simplify (x + y)(\overline{x} + y).
- Write the dual of the identity x(y + \overline{y}) = x.
- Evaluate F = \overline{x}y + x\overline{z} when x = 1, y = 0 and z = 0.
- Write a sum-of-products expression for the function that is 1 exactly when x and y are different (exclusive OR).
- Prove that \overline{x} + xy = \overline{x} + y.
- A car’s buzzer sounds when the key is in (k = 1) and a door is open (d = 1), or when the key is in, the doors are closed and the seat belt is not buckled (b = 0). Write the buzzer as a Boolean expression and simplify it.
Show answers
1.
x + xy = x \cdot 1 + xy
Identity law: x = x \cdot 1.
x(1 + y)
Distributive law: factor out x.
x \cdot 1
Domination law: 1 + y = 1.
x
Identity law.
x + xy = x, the absorption law.
2.
x\overline{x} + xyDistributive law.
0 + xy
Complement law: x\overline{x} = 0.
xy
Identity law.
x(\overline{x} + y) = xy.
3.
\overline{\overline{x}}\,\overline{y}De Morgan’s law for a sum.
x\overline{y}Double complement law.
\overline{\overline{x} + y} = x\overline{y}.
4.
xy(z + \overline{z})Distributive law: factor out xy.
xy \cdot 1
Complement law.
xy
Identity law.
xyz + xy\overline{z} = xy.
5.
(y + x)(y + \overline{x})Commutative law in each factor.
y + x\overline{x}Distributive law (OR form).
y + 0
Complement law.
y
Identity law.
(x + y)(\overline{x} + y) = y.
6.
x + y\overline{y} = xSwap · with + (and 1 with 0, though there are none here).
The dual is x + y\overline{y} = x, which is also true, since y\overline{y} = 0.
7.
\overline{1} \cdot 0 + 1 \cdot \overline{0}Substitute the values.
0 \cdot 0 + 1 \cdot 1
Take the complements.
0 + 1
Multiply.
1
Add.
F = 1.
8.
x = 0,\; y = 1 \;\text{and}\; x = 1,\; y = 0The output is 1 in exactly two rows.
\overline{x}y + x\overline{y}Write one minterm per row and add them.
Exclusive OR is \overline{x}y + x\overline{y}.
9.
(\overline{x} + x)(\overline{x} + y)Distributive law (OR form).
1 \cdot (\overline{x} + y)Complement law.
\overline{x} + yIdentity law.
This is Example 3 with x replaced by \overline{x}.
10.
F = kd + k\overline{d}\,\overline{b}Translate: key and door open, or key and door closed and belt off.
F = k(d + \overline{d}\,\overline{b})Distributive law: factor out k.
F = k(d + \overline{b})Use x + \overline{x}y = x + y from Example 3 with x = d.
The buzzer sounds when the key is in and either a door is open or the belt is not buckled: F = k(d + \overline{b}).
Boolean algebra FAQ
What are the basic laws of Boolean algebra?
The main laws are identity, domination, idempotent, complement, double complement, commutative, associative, distributive, De Morgan’s and absorption laws. Each one comes in an OR form and a dual AND form.
Why is 1 + 1 = 1 in Boolean algebra?
The + sign means OR. “True or true” is true, so 1 + 1 = 1. The values never go above 1.
How do you simplify a Boolean expression?
Look for a common factor to pull out, a variable next to its complement (which gives 0 or 1), and absorption patterns like x + xy. Apply one law per step, and check the result with a truth table if you are unsure.
What is the difference between Boolean algebra and ordinary algebra?
The variables are only 0 and 1, so x + x = x and xx = x. OR also distributes over AND, and there is no subtraction or division.
Summary
- Boolean variables are 0 or 1; + means OR, a product means AND, and a bar means NOT.
- NOT comes first, then AND, then OR.
- Key laws: idempotent x + x = x, complement x + \overline{x} = 1 and x\overline{x} = 0, De Morgan’s laws and absorption x + xy = x.
- OR distributes over AND: x + yz = (x + y)(x + z), and x + \overline{x}y = x + y.
- Every Boolean function can be written in sum-of-products form from its truth table, then simplified with the laws.
Previous lesson: Tree Traversal
Next lesson: Logic Gates
Back to the Discrete Math Index