Read this lesson as text
Truth Tables
Math for CS · Axiom Academy
Systematically evaluate any compound proposition A truth table is a complete listing of every possible combination of truth values for the variables in a proposition, along with the resulting truth value of the entire expression. It is the brute-force method for verifying logical equivalences, testing validity of arguments, and understanding compound statements. Consider the proposition (p q) p . Break it down: Variables: p, q — so we need 2^2 = 4 rows. Sub-expressions (innermost first): p , then p q , then (p q) p . Use a systematic pattern — the first variable alternates every 2^ n-1 rows, the second every 2^ n-2 , and so on (like counting in binary). For 3 variables you'd have 8 rows, for 4 variables 16 rows, and so on. Evaluate each sub-expression column by column: The final column is the truth value of the entire proposition for each input combination. Build the truth table for (p q) r . Three variables means 2^3 = 8 rows. This is a contingency — it's true in exactly 3 out of 8 rows. n variables produce 2^n rows — truth tables grow exponentially. Always add a column for each sub-expression and evaluate inside-out. Use the binary counting pattern to systematically list all input combinations. Check the final column: all T = tautology, all F = contradiction, mixed = contingency.
This is the written version of the interactive lesson above. See the full Math for CS course.