Truth Tables
Learn to build a truth table for any compound expression step by step and use it to find tautologies, contradictions and equivalent expressions.
Intermediate25 min18 problems
Definition
A truth table lists every possible combination of truth values of the variables in an expression and shows the value of the whole expression in each row.
How many rows? Each variable can be T or F, so every new variable doubles the number of rows:
So 2 variables need rows and 3 variables need rows.
Building a table in 4 steps:
- 1.Count the variables and write empty rows.
- 2.Fill the variable columns in a fixed order: the first column is half T, then half F; each next column switches twice as often; the last column alternates T, F, T, F.
- 3.Add a helper column for every part of the expression, innermost part first (a NOT on a single variable, then the brackets).
- 4.Combine the helper columns into the final column.
Example:
| T | T | F | F |
| T | F | T | T |
| F | T | F | F |
| F | F | T | F |
The final column tells you everything: this expression is true in exactly one row, when is true and is false.
Reading the final column:
- All T: the expression is a tautology (always true).
- All F: it is a contradiction (always false).
- Two expressions with the same final column in every row are logically equivalent.
Try it now
How many rows does a truth table with 3 variables have?
Interactive Visual
Truth Table
ExpressionP ∧ Q ∨ ¬R
| P | Q | R | P ∧ Q | ¬R | P ∧ Q ∨ ¬R |
|---|---|---|---|---|---|
| T | T | T | T | F | T |
| T | T | F | T | T | T |
| T | F | T | F | F | F |
| T | F | F | F | T | T |
| F | T | T | F | F | F |
| F | T | F | F | T | T |
| F | F | T | F | F | F |
| F | F | F | F | T | T |
T= TrueF= False
Truth Table
ExpressionP ∨ ¬Q
| P | Q | P ∨ ¬Q |
|---|---|---|
| T | T | |
| T | F | |
| F | T | |
| F | F |
T= TrueF= False
Interactive Sandbox
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
18 problemsProblem 1 of 18
Easy
How many rows does a truth table with 3 variables have?
Glossary
- Truth table
- A table that shows the value of an expression for every combination of its variables
- Compound expression
- An expression built from variables and operators, such as
- Helper column
- An extra column for one part of an expression, used to build the final column step by step
- Tautology
- An expression that is true in every row, such as
- Contradiction
- An expression that is false in every row, such as
- Logically equivalent
- Two expressions with the same value in every row, written with
Formula Card
Number of rows
$n$ is the number of variables: $2^2 = 4$, $2^3 = 8$, $2^4 = 16$
Tautology
Always true: the final column is all T
Contradiction
Always false: the final column is all F
De Morgan's laws
Two equivalences you can prove with a truth table