Discretica

Truth Tables Explained

6 min read · Free to read

A truth table is the most honest tool in propositional logic. It lists every possible combination of truth values for the variables in a statement and records what the whole statement evaluates to in each case. Because it leaves nothing to intuition, a truth table can settle questions that arguments in words tend to muddle: is this compound statement always true, is it ever true, and do these two statements really mean the same thing?

This guide covers the standard logical connectives and their tables, shows how to build the table for a compound expression column by column, and then puts the technique to work. You will see how to classify a statement as a tautology, a contradiction, or a contingency, how to test two statements for logical equivalence, and how truth tables make De Morgan's laws visible at a glance.

The building blocks: connectives

Propositional logic combines simple statements, written as variables like p and q, using a small set of connectives. Negation, written not p, flips a truth value: it is true exactly when p is false. Conjunction, p and q, is true only when both parts are true. Disjunction, p or q, is true when at least one part is true, including when both are.

Two connectives cause more confusion. The conditional, if p then q, is false in exactly one situation, when p is true but q is false; in every other case it is true. That means a conditional with a false hypothesis is automatically true, which feels strange until you read it as a promise that is only broken when the hypothesis holds yet the conclusion fails. The biconditional, p if and only if q, is true precisely when p and q share the same truth value.

  • not p is true when p is false.
  • p and q is true only when both are true.
  • p or q is true when at least one is true.
  • if p then q is false only when p is true and q is false.
  • p if and only if q is true when p and q have the same value.

How many rows does a table need?

A truth table must include one row for every combination of truth values of its variables. With one variable there are 2 rows, with two variables there are 4, with three variables there are 8, and in general n variables produce 2 to the n rows. This doubling is why hand-built tables become unwieldy past three or four variables.

To list the rows systematically and never miss a combination, use a fixed pattern. In the leftmost variable column, fill the top half with true and the bottom half with false; in the next column, alternate in blocks half as tall; continue halving until the rightmost variable column simply alternates true, false, true, false. This mirrors counting in binary and guarantees all 2 to the n combinations appear exactly once.

Building the table for a compound statement

To evaluate a compound expression, add a column for each subexpression, working from the innermost pieces outward, and finish with a column for the whole statement. Respect the order of operations: negation binds tightest, then conjunction, then disjunction, and the conditional and biconditional are evaluated last. Parentheses override this ordering, exactly as in arithmetic.

Consider the statement if p then q, evaluated alongside its parts. First write the p and q columns using the row pattern above. Then compute the if p then q column row by row, marking it false only where p is true and q is false. Taking the columns one subexpression at a time keeps even a long formula manageable, because each new column depends only on columns you have already filled in.

Tautologies, contradictions, and contingencies

Once the final column is filled in, classifying the statement is immediate. If the final column is true in every row, the statement is a tautology: it is true regardless of the inputs. If it is false in every row, the statement is a contradiction. If it is true in some rows and false in others, it is a contingency, meaning its truth depends on the values of its variables.

A useful tautology to verify by hand is if p then q, if and only if, not p or q. Building both sides shows their final columns match in all four rows, which is why an implication can always be rewritten as a disjunction. Tautologies matter because they are the valid laws of logic; every rule you use to transform statements is, underneath, a tautology confirmed by a truth table.

Testing logical equivalence

Two statements are logically equivalent when they have identical final columns across the entire table. This is the precise meaning of saying they say the same thing: no assignment of truth values can tell them apart. To test equivalence, build both tables using the same row ordering and compare the two result columns row by row.

Equivalence is what licenses rewriting one expression as another in proofs and in circuit design. For instance, double negation says not not p is equivalent to p, and the contrapositive law says if p then q is equivalent to if not q then not p. Each claim is settled the same way: if the columns agree everywhere, the equivalence holds; if a single row differs, it fails.

De Morgan's laws in a table

De Morgan's laws describe how negation interacts with conjunction and disjunction. The first says not the quantity p and q is equivalent to not p or not q. The second says not the quantity p or q is equivalent to not p and not q. In words, negating an and turns it into an or of the negations, and negating an or turns it into an and of the negations.

A truth table makes both laws undeniable. Build the four rows for p and q, compute not the quantity p and q on one side and not p or not q on the other, and the two columns coincide in every row. These laws are not just tidy identities; they are used constantly to simplify logical expressions, to push negations inward when reasoning about quantifiers, and to transform digital logic circuits into equivalent, cheaper forms.

Frequently asked questions

Why is a conditional with a false hypothesis considered true?

The conditional if p then q only claims something when p holds. If p is false, the promise was never triggered, so it cannot be broken; logicians therefore assign the conditional the value true in those rows. It is false only when p is true and q is false.

How many rows will my truth table have?

It depends only on the number of distinct variables. With n variables you need 2 to the n rows to cover every combination: 2 rows for one variable, 4 for two, 8 for three, and so on. The number of connectives affects columns, not rows.

How do I use a truth table to prove two statements are equivalent?

Build a table for each statement using the same ordering of rows, then compare their final result columns. If the two columns match in every single row, the statements are logically equivalent; if even one row differs, they are not.

What is the difference between a tautology and a contradiction?

A tautology is true in every row of its truth table, so it holds no matter what values its variables take. A contradiction is false in every row. A statement that is true in some rows and false in others is called a contingency.