LogicGates.org Open the simulatorSimulator

The laws of boolean algebra

30 identities for rewriting logic without changing what it does. Each one is shown with the truth table that proves it.

Want to check your own? The calculator compares any two expressions row by row.

Basic

a ∧ 1 = a Identity

ANDing with 1 leaves a signal untouched, which is how an enable line passes data through.

Proof
a a ∧ 1 a
0 0 0
1 1 1

Both columns match on all 2 rows, so the identity holds.

a ∨ 0 = a Identity

The OR counterpart: 0 is the neutral value for OR, the way 1 is for AND.

Proof
a a ∨ 0 a
0 0 0
1 1 1

Both columns match on all 2 rows, so the identity holds.

a ∧ 0 = 0 Annulment

A single 0 into an AND forces the output low no matter what else happens.

Proof
a a ∧ 0 0
0 0 0
1 0 0

Both columns match on all 2 rows, so the identity holds.

a ∨ 1 = 1 Annulment

And a single 1 into an OR pins the output high.

Proof
a a ∨ 1 1
0 1 1
1 1 1

Both columns match on all 2 rows, so the identity holds.

a ∧ a = a Idempotence

Feeding one signal into both inputs of a gate wastes a gate.

Proof
a a ∧ a a
0 0 0
1 1 1

Both columns match on all 2 rows, so the identity holds.

a ∨ a = a Idempotence

Wiring one signal into both inputs of an OR gate is just as wasteful.

Proof
a a ∨ a a
0 0 0
1 1 1

Both columns match on all 2 rows, so the identity holds.

Negation

a ∧ ¬a = 0 Complement

A signal and its inverse are never both high, so the AND can never fire.

Proof
a a ∧ ¬a 0
0 0 0
1 0 0

Both columns match on all 2 rows, so the identity holds.

a ∨ ¬a = 1 Complement

One of the two is always high, so the OR is always high.

Proof
a a ∨ ¬a 1
0 1 1
1 1 1

Both columns match on all 2 rows, so the identity holds.

¬(¬a) = a Double negation

Two inverters in a row cancel out, though they are still useful as a buffer.

Proof
a ¬(¬a) a
0 0 0
1 1 1

Both columns match on all 2 rows, so the identity holds.

¬0 = 1 Constant negation

An inverter tied low sits high, which is how a 1 is made where no signal supplies one.

Proof
¬0 1
1 1

Both columns match on all 1 rows, so the identity holds.

¬1 = 0 Constant negation

And the other way round. Not much of a theorem, but it is the step that clears a negated constant out of an expression.

Proof
¬1 0
0 0

Both columns match on all 1 rows, so the identity holds.

¬(a ∧ b) = ¬a ∨ ¬b De Morgan

Push a negation through a bracket and AND becomes OR. The rule behind every NAND-only design.

Proof
ab ¬(a ∧ b) ¬a ∨ ¬b
0 0 1 1
0 1 1 1
1 0 1 1
1 1 0 0

Both columns match on all 4 rows, so the identity holds.

¬(a ∨ b) = ¬a ∧ ¬b De Morgan

The mirror image of the first, and the reason NOR is universal in the same way NAND is.

Proof
ab ¬(a ∨ b) ¬a ∧ ¬b
0 0 1 1
0 1 0 0
1 0 0 0
1 1 0 0

Both columns match on all 4 rows, so the identity holds.

Order

a ∧ b = b ∧ a Commutativity

Input order does not matter to a gate.

Proof
ab a ∧ b b ∧ a
0 0 0 0
0 1 0 0
1 0 0 0
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

a ∨ b = b ∨ a Commutativity

The same holds for OR, and for every other two input gate on this site.

Proof
ab a ∨ b b ∨ a
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

(a ∧ b) ∧ c = a ∧ (b ∧ c) Associativity

Grouping does not matter either, which is why a three input AND gate is well defined.

Proof
abc (a ∧ b) ∧ c a ∧ (b ∧ c)
0 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 1 1 0 0
1 0 0 0 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1

Both columns match on all 8 rows, so the identity holds.

(a ∨ b) ∨ c = a ∨ (b ∨ c) Associativity

So a wide OR can be built from a chain of two input ORs.

Proof
abc (a ∨ b) ∨ c a ∨ (b ∨ c)
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 1 1
1 0 0 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1

Both columns match on all 8 rows, so the identity holds.

Distribution

a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c) Distributivity

Reads like ordinary algebra: AND distributes over OR.

Proof
abc a ∧ (b ∨ c) (a ∧ b) ∨ (a ∧ c)
0 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 1 1 0 0
1 0 0 0 0
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1

Both columns match on all 8 rows, so the identity holds.

a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c) Distributivity

Unlike ordinary algebra, it works the other way round too: OR distributes over AND.

Proof
abc a ∨ (b ∧ c) (a ∨ b) ∧ (a ∨ c)
0 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 1 1 1 1
1 0 0 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1

Both columns match on all 8 rows, so the identity holds.

Reduction

a ∨ (a ∧ b) = a Absorption

If a alone is enough, the extra term adds nothing. Deletes a gate outright.

Proof
ab a ∨ (a ∧ b) a
0 0 0 0
0 1 0 0
1 0 1 1
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

a ∧ (a ∨ b) = a Absorption

The dual form: if a is low the whole thing is low regardless of b.

Proof
ab a ∧ (a ∨ b) a
0 0 0 0
0 1 0 0
1 0 1 1
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

a ∨ (¬a ∧ b) = a ∨ b Redundancy

The ¬a is doing no work: if a is low the second term decides, and if a is high the first does.

Proof
ab a ∨ (¬a ∧ b) a ∨ b
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

a ∧ (¬a ∨ b) = a ∧ b Redundancy

The dual. Easy to miss by eye, which is why minimisers earn their keep.

Proof
ab a ∧ (¬a ∨ b) a ∧ b
0 0 0 0
0 1 0 0
1 0 0 0
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

(a ∧ b) ∨ (a ∧ ¬b) = a Adjacency

b takes both values, so it cancels. This is exactly what grouping two squares on a Karnaugh map does.

Proof
ab (a ∧ b) ∨ (a ∧ ¬b) a
0 0 0 0
0 1 0 0
1 0 1 1
1 1 1 1

Both columns match on all 4 rows, so the identity holds.

(a ∧ b) ∨ (¬a ∧ c) ∨ (b ∧ c) = (a ∧ b) ∨ (¬a ∧ c) Consensus

The third term is already covered by the other two. The classic trap when minimising by hand.

Proof
abc (a ∧ b) ∨ (¬a ∧ c) ∨ (b ∧ c) (a ∧ b) ∨ (¬a ∧ c)
0 0 0 0 0
0 0 1 1 1
0 1 0 0 0
0 1 1 1 1
1 0 0 0 0
1 0 1 0 0
1 1 0 1 1
1 1 1 1 1

Both columns match on all 8 rows, so the identity holds.

(a ∨ b) ∧ (¬a ∨ c) ∧ (b ∨ c) = (a ∨ b) ∧ (¬a ∨ c) Consensus

The product of sums version of the same idea.

Proof
abc (a ∨ b) ∧ (¬a ∨ c) ∧ (b ∨ c) (a ∨ b) ∧ (¬a ∨ c)
0 0 0 0 0
0 0 1 0 0
0 1 0 1 1
0 1 1 1 1
1 0 0 0 0
1 0 1 1 1
1 1 0 0 0
1 1 1 1 1

Both columns match on all 8 rows, so the identity holds.

Exclusive or

a ⊻ b = (a ∧ ¬b) ∨ (¬a ∧ b) Definition

XOR written with the basic three, which is how it is built when no XOR gate is available.

Proof
ab a ⊻ b (a ∧ ¬b) ∨ (¬a ∧ b)
0 0 0 0
0 1 1 1
1 0 1 1
1 1 0 0

Both columns match on all 4 rows, so the identity holds.

a ⊻ 0 = a Identity

XOR with 0 passes the signal through unchanged.

Proof
a a ⊻ 0 a
0 0 0
1 1 1

Both columns match on all 2 rows, so the identity holds.

a ⊻ 1 = ¬a Inversion

XOR with 1 inverts it, which makes XOR a controlled inverter.

Proof
a a ⊻ 1 ¬a
0 1 1
1 0 0

Both columns match on all 2 rows, so the identity holds.

a ⊻ a = 0 Self cancel

Anything XORed with itself is 0, the property behind parity checks.

Proof
a a ⊻ a 0
0 0 0
1 0 0

Both columns match on all 2 rows, so the identity holds.

Using them

The laws are how a circuit gets smaller. In practice you rarely apply them one at a time by hand past three or four variables, but knowing them is what lets you read someone else's simplification and see why it works.

  • Absorption and redundancy delete whole terms, so they are the ones worth spotting first.
  • Adjacency is the algebraic form of circling two squares on a Karnaugh map: one variable takes both values and cancels.
  • De Morgan converts between AND and OR forms, which is what makes NAND-only and NOR-only circuits possible.
  • Consensus is the one people miss by hand: a term that looks necessary is already covered by two others.

Simplify an expression

Reference card

Every identity on one sheet, black on white, for printing or a slide.

Boolean algebra laws reference: 30 identities including De Morgan, distributivity, absorption and consensus Click to download: Boolean algebra laws

Questions

What are the laws of boolean algebra?

A set of identities that let you rewrite a logic expression without changing what it computes. The core ones are identity, annulment, idempotence, complement, commutativity, associativity, distributivity, absorption and De Morgan. Together they are what circuit minimisation is built on.

How is boolean algebra different from ordinary algebra?

Variables take only two values, there is no subtraction or division, and OR distributes over AND as well as the other way round, which has no equivalent in ordinary arithmetic. Absorption and idempotence have no counterpart either: a + a is a, not 2a.

What are De Morgan's laws?

They say that negating a bracket swaps the operator inside it: not (a and b) equals not a or not b, and not (a or b) equals not a and not b. They are what lets any circuit be rebuilt from NAND gates alone, or from NOR gates alone.

How do I prove a boolean identity?

Build the truth table for both sides and check every row matches. With n variables that is 2^n rows, so it is exhaustive rather than a sample, which makes it a genuine proof. Every law on this page is shown with its table, and the calculator will check your own expressions the same way.