Discrete MathLogic

Truth Tables

List every combination of truth values, 2ⁿ rows for n statements, and work out the compound statement one column at a time.

Not started Jump to practice

A compound statement's truth depends only on the truth of its letters. A truth table lists every possible combination of truth values for the letters and works out the statement in each one. It builds directly on the connectives $\neg$, $\wedge$ and $\vee$, and it is the tool for every later logic question: equivalence, conditionals and valid arguments.

Key idea

With $n$ different letters there are $2^{n}$ rows: each letter is true or false, and the choices multiply. Fill the table one column at a time, from the innermost pieces of the statement outward.

Why it works

Why $2^{n}$? One letter has $2$ possibilities. Adding a second letter doubles that: each of the old rows splits into one where the new letter is T and one where it is F. Every new letter doubles again, so $n$ letters give $2 \cdot 2 \cdots 2 = 2^{n}$ rows. Listing them in a fixed pattern guarantees none is missed: the first letter is T for the top half and F for the bottom half, the next letter alternates in blocks half as long, and the last letter alternates every row.
Press Next column to build the table for $(P \vee Q) \wedge \neg R$ one column at a time. With three letters there are $2^{3} = 8$ rows.

Worked examples

Worked example: A table with two letters

Make the truth table of $\neg P \vee Q$.
  1. Two letters, so $2^{2} = 4$ rows: TT, TF, FT, FF for $P, Q$.
  2. Column $\neg P$: flip $P$, giving F, F, T, T.
  3. Column $\neg P \vee Q$: true when $\neg P$ or $Q$ is true. Row 1: F or T is T. Row 2: F or F is F. Row 3: T or T is T. Row 4: T or F is T.
  4. Final column, top to bottom: T, F, T, T. It is false only when $P$ is true and $Q$ is false.

Answer: T, F, T, T

Worked example: Counting the true rows

In how many rows of its truth table is $(P \wedge Q) \vee \neg R$ true?
  1. Three letters, so $8$ rows.
  2. $\neg R$ is true in the $4$ rows where $R$ is false. All of those make the whole statement true.
  3. In the $4$ rows where $R$ is true, the statement needs $P \wedge Q$, which happens in exactly one of them ($P$ and $Q$ both true).
  4. Total: $4 + 1 = 5$ rows.

Answer: $5$

Common mistake

Listing fewer than $2^{n}$ rows. Writing rows "as they come to mind" easily skips a case, and the skipped case may be the one where the statement fails. Check: count your rows (it must be $2^{n}$), and use the halving pattern for the letter columns so every combination appears exactly once.
A statement that is true in every row, such as $P \vee \neg P$, is a tautology. One that is false in every row, such as $P \wedge \neg P$, is a contradiction.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 1 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Oscar Levin, Discrete Mathematics: An Open Introduction (3rd ed.), section "Propositional Logic" (truth tables)
  • MIT OpenCourseWare 6.042J Mathematics for Computer Science (Lehman, Leighton and Meyer), chapter "Logical Formulas"
@teddyrookbook GitHub