Boolean Algebra

Learn the laws of Boolean algebra, including De Morgan's laws, and use them to simplify expressions step by step and check the result with a truth table.

Advanced30 minLesson

Definition

Boolean algebra is a set of laws for rewriting Boolean expressions. Each law says that two expressions are equivalent: they have the same truth value for every input, so you may always replace one with the other. With the laws you can simplify an expression without building a new truth table every time.
We write 1 for true and 0 for false (the interactive truth tables use 1 and 0 too). Engineers often write A⋅BA \cdot B for A∧BA \land B, A+BA + B for A∨BA \lor B and A‾\overline{A} for ¬A\neg A: these mean exactly the same. In this lesson we use ∧\land, ∨\lor and ¬\neg.
The laws (AA, BB and CC are Boolean variables):
LawAND formOR form
IdentityA∧1=AA \land 1 = AA∨0=AA \lor 0 = A
Null (domination)A∧0=0A \land 0 = 0A∨1=1A \lor 1 = 1
IdempotentA∧A=AA \land A = AA∨A=AA \lor A = A
ComplementA∧¬A=0A \land \neg A = 0A∨¬A=1A \lor \neg A = 1
Double negation¬¬A=A\neg\neg A = A(only one form)
CommutativeA∧B=B∧AA \land B = B \land AA∨B=B∨AA \lor B = B \lor A
Associative(A∧B)∧C=A∧(B∧C)(A \land B) \land C = A \land (B \land C)(A∨B)∨C=A∨(B∨C)(A \lor B) \lor C = A \lor (B \lor C)
DistributiveA∧(B∨C)=(A∧B)∨(A∧C)A \land (B \lor C) = (A \land B) \lor (A \land C)A∨(B∧C)=(A∨B)∧(A∨C)A \lor (B \land C) = (A \lor B) \land (A \lor C)
AbsorptionA∧(A∨B)=AA \land (A \lor B) = AA∨(A∧B)=AA \lor (A \land B) = A
De Morgan¬(A∧B)=¬A∨¬B\neg(A \land B) = \neg A \lor \neg B¬(A∨B)=¬A∧¬B\neg(A \lor B) = \neg A \land \neg B
Notice the pattern: swap ∧\land with ∨\lor and 0 with 1 in one column and you get the other column. This is called duality.
Simplifying step by step: use one law per step and name it. Then check the result with a truth table: if the final columns match in every row, the simplification is correct.

Try it now

Which law says A∧¬A=0A \land \neg A = 0?

Worked Examples

Simplify (A∧1)∨(B∧0)(A \land 1) \lor (B \land 0).

1

Use the identity law on the first bracket

A∧1=AA \land 1 = A, because AND with true changes nothing → A∨(B∧0)A \lor (B \land 0)

2

Use the null law on the second bracket

B∧0=0B \land 0 = 0, because AND with false is always false → A∨0A \lor 0

3

Use the identity law again

A∨0=AA \lor 0 = A, because OR with false changes nothing → AA

Common Mistakes

Writing ¬(A∧B)=¬A∧¬B\neg(A \land B) = \neg A \land \neg B

Why it's wrong: De Morgan's law flips the operator as well as the variables. Test A=1A = 1, B=0B = 0: the left side is ¬0=1\neg 0 = 1, the right side is 0∧1=00 \land 1 = 0.

Correct: Break the bar and change the sign: ¬(A∧B)=¬A∨¬B\neg(A \land B) = \neg A \lor \neg B and ¬(A∨B)=¬A∧¬B\neg(A \lor B) = \neg A \land \neg B.

Using rules of ordinary algebra, such as A∨A=2AA \lor A = 2A or A∧A=A2A \land A = A^2

Why it's wrong: Boolean variables are only 0 or 1, and 1∨11 \lor 1 is 1, not 2. Repeating a variable adds nothing new.

Correct: Use the idempotent law: A∨A=AA \lor A = A and A∧A=AA \land A = A.

Reading A∨B∧CA \lor B \land C as (A∨B)∧C(A \lor B) \land C

Why it's wrong: AND is evaluated before OR, just like multiplication before addition. With A=1A = 1, B=0B = 0, C=0C = 0 the correct value is 1∨0=11 \lor 0 = 1, but the wrong reading gives 1∧0=01 \land 0 = 0.

Correct: Add the brackets before you apply a law: A∨B∧C=A∨(B∧C)A \lor B \land C = A \lor (B \land C).

Using the complement law on two different variables, as in A∧¬B=0A \land \neg B = 0

Why it's wrong: The complement law only works for a variable and its own negation. With A=1A = 1, B=0B = 0: A∧¬B=1∧1=1A \land \neg B = 1 \land 1 = 1, not 0.

Correct: Look for the same letter: A∧¬A=0A \land \neg A = 0 and B∨¬B=1B \lor \neg B = 1, but A∧¬BA \land \neg B cannot be simplified.

Interactive Visual

Truth Table

ExpressionA ∧ B ∨ A ∧ ¬B
ABA ∧ B¬BA ∧ ¬BA ∧ B ∨ A ∧ ¬B
000100
010000
100111
111001

1= True0= False

Truth Table

A ∧ B
ABA ∧ B
000
010
100
111

1= True0= False

Interactive Sandbox

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

18 problems
Problem 1 of 18
Easy

Which law says A∧¬A=0A \land \neg A = 0?

Why It Matters

Every ∧\land, ∨\lor and ¬\neg in an expression becomes a logic gate in a circuit. A shorter expression means fewer gates, and fewer gates mean a chip that is cheaper, smaller, faster and uses less power.
  • Electronics: a processor contains billions of gates, so saving one gate in a circuit that is copied a million times saves a million gates
  • Programming: a condition like NOT (weekend OR holiday) can be rewritten as (NOT weekend) AND (NOT holiday), which is often easier to read and test
  • Search and databases: a filter such as math OR (math AND logic) gives exactly the same results as just math
  • Proofs: the laws let you prove that two circuits or two conditions do the same job without trying every input
In the lesson Truth Tables you checked equivalences row by row, and in the lesson Logic Gates you built circuits. Boolean algebra connects the two: it turns a big circuit into a small one, and a truth table confirms that nothing changed.

Real World Applications

Designing Cheaper Chips

Chip designers simplify every circuit with Boolean algebra before it is built, because each gate costs space, power and money.

Example:

A circuit for (A∧B)∨(A∧C)(A \land B) \lor (A \land C) uses 3 gates. Factored as A∧(B∨C)A \land (B \lor C), it needs only 2.

1Try It Yourself

A chip contains 1000 copies of a circuit that computes (A∧B)∨(A∧C)(A \land B) \lor (A \land C). Count one gate for each ∧\land and each ∨\lor.

How many gates does the whole chip save when the circuit is simplified to A∧(B∨C)A \land (B \lor C)?

Step 1: Write the mathematical expression

Write the saving as a calculation:

Readable Program Conditions

Programmers use De Morgan's laws to remove confusing double negations from conditions in their code.

Example:

NOT (weekend OR holiday) is the same as (NOT weekend) AND (NOT holiday): the shop is open on days that are neither.

2Try It Yourself

A program opens a barrier if ¬(¬P∧¬G)\neg(\neg P \land \neg G), where PP means the visitor has a pass and GG means the visitor is on the guest list.

What is the simplest form of the condition, and how many NOT operators does it remove?

Step 1: Write the mathematical expression

Write the number of NOT operators before and after as a subtraction:

Search Filters

Search engines and databases simplify filters with the absorption law before they run them.

Example:

The filter math OR (math AND logic) returns exactly the same books as the filter math.

3Try It Yourself

A library has 40 math books, and 15 of them are also about logic. A reader searches for math OR (math AND logic).

How many books does the search return?

Step 1: Write the mathematical expression

Add the math books and the extra books that (math AND logic) brings in:

Key Takeaways

  • 1Boolean algebra uses laws to rewrite an expression into an equivalent one, without a new truth table each time
  • 2Identity, null, idempotent and complement laws remove constants and repeated variables: A∧1=AA \land 1 = A, A∨1=1A \lor 1 = 1, A∨A=AA \lor A = A, A∧¬A=0A \land \neg A = 0
  • 3Commutative, associative and distributive laws reorder, regroup and factor; in Boolean algebra OR also distributes over AND
  • 4Absorption laws: A∨(A∧B)=AA \lor (A \land B) = A and A∧(A∨B)=AA \land (A \lor B) = A
  • 5De Morgan's laws: break the bar and change the sign, ¬(A∧B)=¬A∨¬B\neg(A \land B) = \neg A \lor \neg B and ¬(A∨B)=¬A∧¬B\neg(A \lor B) = \neg A \land \neg B
  • 6Simplify one law at a time, name each law and check the result with a truth table; a simpler expression means fewer gates

Frequently Asked Questions

Because Boolean variables are only 0 or 1. Check both cases: if A=1A = 1, both sides of A∨(B∧C)=(A∨B)∧(A∨C)A \lor (B \land C) = (A \lor B) \land (A \lor C) are 1; if A=0A = 0, both sides become B∧CB \land C. With ordinary numbers 1+2×3=71 + 2 \times 3 = 7 but (1+2)×(1+3)=12(1 + 2) \times (1 + 3) = 12, so this law only holds in Boolean algebra.
Because Boolean variables are only 0 or 1. Check both cases: if A=1A = 1, both sides of A∨(B∧C)=(A∨B)∧(A∨C)A \lor (B \land C) = (A \lor B) \land (A \lor C) are 1; if A=0A = 0, both sides become B∧CB \land C. With ordinary numbers 1+2×3=71 + 2 \times 3 = 7 but (1+2)×(1+3)=12(1 + 2) \times (1 + 3) = 12, so this law only holds in Boolean algebra.
Look for patterns: a NOT in front of brackets calls for De Morgan, a variable repeated in two brackets calls for factoring (distributive law), and a variable next to its own negation calls for the complement law. The constants 0 and 1 disappear with the identity and null laws.
The laws find the simplification, the truth table confirms it. A table with 2 variables has only 4 rows, so it is a quick and reliable check, especially when you are not sure about a step.
Yes, with 0 and 1: A∧B=A×BA \land B = A \times B, ¬A=1−A\neg A = 1 - A and A∨B=A+B−A×BA \lor B = A + B - A \times B. For example, with A=1A = 1 and B=1B = 1: 1+1−1×1=11 + 1 - 1 \times 1 = 1, so 1∨1=11 \lor 1 = 1. The calculator in this lesson works with these numbers.

Glossary

Boolean algebra
The set of laws for rewriting and simplifying Boolean expressions
Law
An equivalence that holds for every value of the variables, such as A∨0=AA \lor 0 = A
Equivalent
Having the same truth value in every row of the truth table
Simplify
Rewrite an expression with fewer operators while keeping it equivalent
De Morgan's laws
¬(A∧B)=¬A∨¬B\neg(A \land B) = \neg A \lor \neg B and ¬(A∨B)=¬A∧¬B\neg(A \lor B) = \neg A \land \neg B
Absorption law
A∨(A∧B)=AA \lor (A \land B) = A and A∧(A∨B)=AA \land (A \lor B) = A

Formula Card

Identity and null laws

A∧1=A,A∨0=A,A∧0=0,A∨1=1A \land 1 = A, \quad A \lor 0 = A, \quad A \land 0 = 0, \quad A \lor 1 = 1

AND with 1 and OR with 0 change nothing; AND with 0 and OR with 1 decide the result

Idempotent and complement laws

A∧A=A,A∨A=A,A∧¬A=0,A∨¬A=1A \land A = A, \quad A \lor A = A, \quad A \land \neg A = 0, \quad A \lor \neg A = 1

Repeating a variable adds nothing; a variable with its own negation gives a constant

Double negation

¬¬A=A\neg\neg A = A

Two NOTs cancel each other out

Distributive laws

A∧(B∨C)=(A∧B)∨(A∧C),A∨(B∧C)=(A∨B)∧(A∨C)A \land (B \lor C) = (A \land B) \lor (A \land C), \quad A \lor (B \land C) = (A \lor B) \land (A \lor C)

Both hold in Boolean algebra; the second one does not work for ordinary numbers

Absorption laws

A∨(A∧B)=A,A∧(A∨B)=AA \lor (A \land B) = A, \quad A \land (A \lor B) = A

The longer part is swallowed by $A$

De Morgan's laws

¬(A∧B)=¬A∨¬B,¬(A∨B)=¬A∧¬B\neg(A \land B) = \neg A \lor \neg B, \quad \neg(A \lor B) = \neg A \land \neg B

Break the bar, change the sign

More in This Topic