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.

OperationNotationValueLogic
OR (Boolean sum)x + y1 if at least one of x, y is 1p \lor q
AND (Boolean product)xy or x \cdot y1 only if both x and y are 1p \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

LawOR formAND form
Identityx + 0 = xx \cdot 1 = x
Dominationx + 1 = 1x \cdot 0 = 0
Idempotentx + x = xx \cdot x = x
Complementx + \overline{x} = 1x\overline{x} = 0
Double complement\overline{\overline{x}} = x
Commutativex + y = y + xxy = yx
Associativex + (y + z) = (x + y) + zx(yz) = (xy)z
Distributivex + 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}
Absorptionx + xy = xx(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.

A Venn diagram of two overlapping circles labeled x and y inside a rectangle. The whole circle x is shaded light blue. The overlap of x and y, the region for xy, is also crossed with orange diagonal lines, and it lies completely inside the shaded circle x.
Absorption: the region for xy (orange lines) is already inside x, so x + xy is just x.

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}y

Start 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})z

Double 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.

xyzF
0000
0010
0100
0111
1000
1011
1101
1111
F = \overline{x}yz + x\overline{y}z + xy\overline{z} + xyz

Write 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 + xyz

Idempotent 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

MistakeExample of the errorFix
Treating + like ordinary addition1 + 1 = 2 or x + x = 2xIn 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 operationsReading x + yz as (x + y)zAND comes before OR, just as multiplication comes before addition in the order of operations.
Cancelling as in real algebraFrom x + y = x + z, concluding y = zThere is no subtraction. With x = 1, the equation holds for any y and z.
Forgetting the second distributive lawLeaving (x + y)(x + \overline{y}) multiplied out into four termsUse (x + y)(x + z) = x + yz to collapse it in one step.
Dropping a variable that is not redundantSimplifying x + \overline{x}y to just xAbsorption 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

  1. Simplify x + xy.
  2. Simplify x(\overline{x} + y).
  3. Simplify \overline{\overline{x} + y}.
  4. Simplify xyz + xy\overline{z}.
  5. Simplify (x + y)(\overline{x} + y).
  6. Write the dual of the identity x(y + \overline{y}) = x.
  7. Evaluate F = \overline{x}y + x\overline{z} when x = 1, y = 0 and z = 0.
  8. Write a sum-of-products expression for the function that is 1 exactly when x and y are different (exclusive OR).
  9. Prove that \overline{x} + xy = \overline{x} + y.
  10. 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} + xy

Distributive 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} = x

Swap · 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 = 0

The 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} + y

Identity 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