How to Make a Truth Table (Step-by-Step with Examples)
Last updated · Part of the Discretiq guides
A truth table lists every combination of true and false values for the variables in a logical formula and shows the formula's value for each one. It is the most reliable way to decide whether a statement is always true, never true or sometimes true, and whether two statements say the same thing.
The method is the same for every formula: set up the rows, add a column for each part of the formula working from the inside out, then read the last column.
The five steps
- List the variables. Collect each distinct letter, such as P, Q and R.
- Count the rows. With n variables there are 2ⁿ rows: 4 for two variables, 8 for three, 16 for four.
- Fill the variable columns in a fixed pattern. The last variable alternates T, F, T, F…; the one before it alternates in pairs (T, T, F, F…); the one before that in fours. Starting with all T and ending with all F means no row is missed or repeated.
- Add one column per sub-formula, working from the innermost brackets outward: negations first, then ∧, then ∨, then → and ↔. Use brackets to show the order you intend.
- Read the last column. It gives the value of the whole formula in every row.
The connective rules you need
| P | Q | P ∧ Q | P ∨ Q | P → Q | P ↔ Q | P ⊕ Q |
|---|---|---|---|---|---|---|
| T | T | T | T | T | T | F |
| T | F | F | T | F | F | T |
| F | T | F | T | T | F | T |
| F | F | F | F | T | T | F |
P → Q is false in exactly one case: P true and Q false. That is the row students most often get wrong. When P is false the implication is true whatever Q is (a vacuous truth).
Example 1: (P ∨ Q) ∧ ¬(P ∧ Q)
| P | Q | P ∨ Q | P ∧ Q | ¬(P ∧ Q) | (P ∨ Q) ∧ ¬(P ∧ Q) |
|---|---|---|---|---|---|
| T | T | T | T | F | F |
| T | F | T | F | T | T |
| F | T | T | F | T | T |
| F | F | F | F | T | F |
The last column reads F, T, T, F: the formula is true exactly when P and Q differ. That is the exclusive or, so the formula is equivalent to P ⊕ Q.
Example 2: three variables, P → (Q ∨ R)
Three variables give 2³ = 8 rows. Work out Q ∨ R first, then the implication.
| P | Q | R | Q ∨ R | P → (Q ∨ R) |
|---|---|---|---|---|
| T | T | T | T | T |
| T | T | F | T | T |
| T | F | T | T | T |
| T | F | F | F | F |
| F | T | T | T | T |
| F | T | F | T | T |
| F | F | T | T | T |
| F | F | F | F | T |
Only one row is false: P true with Q and R both false. Whenever P is false, the implication is true.
What the last column tells you
- All T: a tautology, such as P ∨ ¬P.
- All F: a contradiction, such as P ∧ ¬P.
- A mixture: a contingency, true for some inputs and false for others.
- Two formulas with identical last columns are equivalent. For example P → Q and ¬P ∨ Q are both false only in the row P = T, Q = F.
Common mistakes
- Writing the wrong number of rows. Always check that you have 2ⁿ.
- Filling the variable columns in an inconsistent order, which makes it easy to skip or repeat a row.
- Skipping the intermediate columns and trying to evaluate a long formula in one step.
- Treating P → Q as false when P is false.
- Dropping brackets: ¬P ∨ Q means (¬P) ∨ Q, which is not the same as ¬(P ∨ Q).
When the table gets large
A four-variable table has 16 rows and a five-variable table has 32. To show a formula is not a tautology you only need one row that makes it false, so you can search for a counterexample instead of building the whole table. For larger formulas, build the table with the calculator and use your hand method to understand each column.
Try it yourself
Work the examples above by hand first, then confirm your answers.
Check your table with the free logic calculator