Skip to main content
Be Bitwise

Boolean Algebra

Logic Gates · Foundations track

3 min read

In this module

The Maths Behind the Gates

You've seen how individual logic gates behave. Boolean algebra is the mathematical system that lets us describe, analyse, and simplify circuits made from those gates. George Boole came up with it in the 1840s, more than a century before the first digital computer existed to apply it to.

Variables and Operations

In Boolean algebra, every variable is either 0 or 1. There are three core operations, and each maps directly to a gate you already know:

  • AND is written as multiplication: A * B or simply AB
  • OR is written as addition: A + B
  • NOT is written with a bar or prime: A' or A with an overline

So the expression A * B + C' means "A AND B, OR (NOT C)."

Key Laws

Boolean algebra follows a set of rules that let you transform expressions into simpler forms. The most important ones:

Commutative: A + B = B + A and A * B = B * A

Associative: A + (B + C) = (A + B) + C and A * (B * C) = (A * B) * C

Distributive: A * (B + C) = A * B + A * C

Identity: A + 0 = A and A * 1 = A

Complement: A + A' = 1 and A * A' = 0

De Morgan's Theorems

Two of the most powerful rules in Boolean algebra are De Morgan's Theorems:

  • (A * B)' = A' + B' — the complement of AND equals OR of the complements
  • (A + B)' = A' * B' — the complement of OR equals AND of the complements

They let you swap freely between AND and OR, and they're the missing step in showing NAND is universal. A NAND with its inputs tied gives you NOT, NAND followed by NOT gives you AND, and De Morgan turns NOTs and an AND into an OR. AND, OR and NOT together can build any logic function, so NAND alone can too. The same argument, mirrored, works for NOR.

Simplifying Expressions

Why bother simplifying? Every term in a Boolean expression maps to a gate in a physical circuit. Fewer terms, fewer gates, less silicon, less power, faster operation.

Take the expression A * B + A * B'. Factor out A:

text
A * B + A * B' = A * (B + B') = A * 1 = A

The original expression needed two AND gates and one OR gate. The simplified version needs no gates at all. The output is just A. That kind of optimisation is exactly what chip designers do every day.

From Algebra to Circuits

Every Boolean expression can be drawn as a circuit, and every circuit can be written as a Boolean expression. That two-way mapping is what makes Boolean algebra the working language of digital design.

Here's the expression from the previous section, A * B + A * B', drawn gate for gate. Each * becomes an AND, the + becomes an OR and the ' becomes a NOT:

Four gates, and after simplification the whole thing collapses to a wire from A to the output. Input B doesn't affect the result at all, which is something the algebra told you before you'd built anything.

Next lesson you'll see how gates and algebra come together to build circuits that do something genuinely useful.