Skip to content

How to Make a Truth Table, Step by Step

Build a truth table without errors: count the rows, fill the input columns in a fixed pattern, add one column per connective, and read the final column.

By Published 5 min read

Reign Creative LLC makes Discrete Math: Study & Quiz, which this article links to, so we have a commercial interest in it. How we write and check articles.

AI-assisted article. Drafted with AI tools from the sources cited below and checked by automated tests and an AI editorial review. No person has reviewed it yet. How we write and check articles.

Key takeaways

  • A truth table with n different simple statements needs 2ⁿ rows: 4 rows for two variables, 8 for three, 16 for four.
  • Fill the input columns in a fixed pattern, halving the block size each column, so that every combination appears exactly once.
  • Add one column per connective, working from the innermost parentheses outward: negation first, then and and or, then if-then, then if-and-only-if.
  • The conditional p → q is false in exactly one row, when p is true and q is false; every other row is true.
  • The final column is the answer, and it tells you whether the statement is a tautology, a contradiction or a contingency.

A truth table lists every possible combination of true and false for the simple statements in a compound statement, and works out whether the whole statement is true in each case. It is a purely mechanical tool, which is its strength: if you follow the same steps every time, you cannot miss a case.

The method below has five steps. The worked examples use the standard symbols: ¬ for "not", ∧ for "and", ∨ for "or", → for "if… then" and ↔ for "if and only if".

Step 1: count the variables and the rows

List the different simple statements, usually letters such as p, q and r. Each can be true or false independently, so a table with n variables needs 2ⁿ rows.

Variables Rows
1 2
2 4
3 8
4 16

Count distinct letters, not appearances. The statement p ∧ (q ∨ ¬p) contains p twice but has only two variables, so it needs four rows.

Step 2: fill the input columns in a fixed pattern

Write the variables as the first columns. In the first column, make the top half of the rows T and the bottom half F. In the next column, alternate in blocks half that size. Keep halving until the last column alternates every row. For three variables:

p q r
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F

This is the order OpenStax's Contemporary Mathematics uses. Applied Discrete Structures writes 0 and 1 instead and runs the other way, listing the rows as the binary numbers 000 up to 111. Either works if you use it consistently. A fixed pattern matters for two reasons: it guarantees every combination appears once, and it makes your table comparable row by row with anyone using the same order.

Step 3: know the five basic tables

Every compound statement is built from these. Learn them well enough to write them from memory.

p q ¬p p ∧ q p ∨ q p → q p ↔ q
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T

Two entries need particular care.

  • "Or" is inclusive. p ∨ q is true when both are true. If a course means "one or the other but not both", it uses a separate exclusive-or symbol.
  • The conditional is false in exactly one row. p → q fails only when p is true and q is false. Think of it as a promise: "if you finish the assignment, you can go out." If you do not finish it, the promise has not been broken whatever happens, so the conditional counts as true. The guide to conditional reasoning works through this with everyday examples.

The biconditional p ↔ q is true when p and q have the same truth value, which is why it reads "p if and only if q".

Step 4: add one column per connective, inside out

Break the statement into pieces, starting with the innermost parentheses, and give each piece its own column. Negations come first, then "and" and "or", then the conditional, and the biconditional last. Conventions differ about whether "and" outranks "or": OpenStax's dominance of connectives treats them as equal and reads them left to right, while other conventions put "and" first. Put parentheses around any mix of the two and the disagreement never matters.

Worked example: (p → q) ∧ ¬q. The pieces are p → q, then ¬q, then the "and" of the two.

p q p → q ¬q (p → q) ∧ ¬q
T T T F F
T F F T F
F T T F F
F F T T T

The statement is true only in the last row, when p and q are both false. That result is the logic behind modus tollens: if p → q holds and q is false, then p must be false. The rules of inference guide builds on it.

Worked example with three variables: (p ∨ q) → r.

p q r p ∨ q (p ∨ q) → r
T T T T T
T T F T F
T F T T T
T F F T F
F T T T T
F T F T F
F F T F T
F F F F T

The final column is false in three rows, each one where p ∨ q is true but r is false. Spotting that pattern is a good habit: once you know when a conditional fails, you can check a finished table by looking only for those rows.

Step 5: read the final column

The last column answers the question you were asked.

  • All T: the statement is a tautology, true whatever its parts are.
  • All F: it is a contradiction.
  • A mix: it is a contingency, true in some cases and false in others.

Tautology, contradiction or contingency? covers these labels in more depth. Truth tables also test whether two statements are equivalent: build both final columns and compare. If they match in every row, the statements are logically equivalent, which is one way to prove De Morgan's laws.

Where tables go wrong

  1. Too few rows. Three variables in eight rows, never six. Recount the distinct letters before you start.
  2. Out-of-order input columns. Use the halving pattern every time.
  3. Skipping intermediate columns. Writing (p → q) ∧ ¬q in one step invites errors. A column per connective costs seconds.
  4. Treating "or" as exclusive. The first row of p ∨ q is T.
  5. Reading the conditional backwards. p → q and q → p differ in two rows. The converse, inverse and contrapositive guide shows which variants are equivalent.

Checking your tables

Truth tables are easy to verify, and you should verify them while you are learning. The truth-table generator among the tools in Discrete Math: Study & Quiz builds a truth table for you, so you can compare it with yours row by row; when they disagree, find the first of your own columns that is wrong to see which connective tripped you up. Build the table by hand first, because an exam will ask you to. For more logic and reasoning practice, browse our education and brain-training apps or the discrete math hub.

Good to know

Frequently asked questions

How many rows does a truth table need?
Two to the power of the number of different simple statements. Each statement can be true or false independently, so two statements give 2 × 2 = 4 rows, three give 8 and four give 16. Count distinct letters, not occurrences: p ∧ (q ∨ p) still has only two variables and four rows.
Why is 'if p then q' true when p is false?
Because the statement only makes a promise about what happens when p is true. If p is false, the promise has not been broken, so the conditional is counted as true. It is false only when p is true and q is false, which is the single case where the promise fails.
What order do I evaluate connectives in?
Parentheses first, then negation, then and and or, then the conditional, then the biconditional. Conventions differ on whether and binds more tightly than or: OpenStax treats the two as equal and evaluates them left to right, while other conventions put and first. Add parentheses whenever both appear, so the statement cannot be read two ways.
Can I write T and F as 1 and 0?
Yes. *Applied Discrete Structures*, like digital logic, writes 1 for true and 0 for false, and the tables are otherwise identical. Use whichever your course uses so that row orders and answers match the textbook.

Sources

  1. 2.2 Compound Statements (Contemporary Mathematics) (opens in a new tab)OpenStax — accessed
  2. 2.3 Constructing Truth Tables (Contemporary Mathematics) (opens in a new tab)OpenStax — accessed
  3. 2.4 Truth Tables for the Conditional and Biconditional (Contemporary Mathematics) (opens in a new tab)OpenStax — accessed
  4. Truth Tables and Propositions Generated by a Set (Applied Discrete Structures) (opens in a new tab)discretemath.org — accessed

About the author

— The independent app studio that builds the apps covered on this site and publishes every article here. On Google Play it publishes as Reign Collective Apps.

We use AI tools to help research, draft and edit our articles. Each article lists the sources its factual claims rely on, and details about our apps come from their live Google Play listings. No article on this site has been reviewed by an independent expert unless the reviewer is named on it.

No person at Reign Creative LLC has read this article in full. It was published after automated checks and an AI editorial review, which are described in our editorial policy and are not the same as a person reading every sentence.

Spotted an error? Tell us — how corrections are handled is set out in our editorial policy.