What Is a Truth Table?
A truth table is a structured chart that displays the output of a logical expression for every possible input combination. Each row represents one scenario, showing what happens when variables take on specific true or false values. The rightmost column reveals whether the entire expression evaluates to true or false under those conditions.
Truth tables serve several purposes:
- Verification: Confirm that a logical design produces the expected output in all cases.
- Identification: Spot whether an expression is a tautology (always true) or a contradiction (always false).
- Simplification: Compare different expressions to see if they're logically equivalent.
- Circuit design: Map the behavior of logic gates before building hardware.
Building and Interpreting Truth Tables
Constructing a truth table follows a straightforward method. First, identify all distinct variables in your expression—these become column headers. Add one final column for the expression's result. Then systematically fill each row with a unique combination of input values, computing the expression's truth value for that row.
For an expression with n variables, the table always contains 2n rows because each variable has two states (true or false). A two-variable expression like A AND B needs 2² = 4 rows. Three variables require 2³ = 8 rows. Seven variables demand 2⁷ = 128 rows—which is why most generators cap full-table output at 6 variables.
Reading the results tells you about your expression's behavior: if every row shows true, it's a tautology. If every row shows false, it's unsatisfiable. Mixed results show conditional truth—the expression is true only for certain input combinations.
Truth Table Row Count Formula
The number of rows in a complete truth table depends directly on how many independent logical variables appear in your expression. Use this formula to predict table size:
Total rows = 2n
where n = number of distinct variables
n— The count of distinct Boolean variables in the logical expression
Common Logic Gates and Their Truth Tables
Logic gates are the physical building blocks of digital circuits. Their truth tables show the fundamental operations:
NOT Gate (inverter):
- Input T → Output F
- Input F → Output T
AND Gate (true only when both inputs are true):
- T AND T = T
- T AND F = F
- F AND T = F
- F AND F = F
OR Gate (true when at least one input is true):
- T OR T = T
- T OR F = T
- F OR T = T
- F OR F = F
XOR Gate (true when inputs differ):
- T XOR T = F
- T XOR F = T
- F XOR T = T
- F XOR F = F
NAND Gate (opposite of AND):
- T NAND T = F
- T NAND F = T
- F NAND T = T
- F NAND F = T
NOR Gate (opposite of OR):
- T NOR T = F
- T NOR F = F
- F NOR T = F
- F NOR F = T
NAND and NOR are universal gates—you can build any other logic function using only copies of a single universal gate type.
Tips for Working with Truth Tables
Avoid common pitfalls when generating and interpreting truth tables.
- Order your input combinations systematically — List variable combinations in binary order (e.g., 00, 01, 10, 11 for two variables). This prevents accidentally skipping a row and ensures your table is complete and easy to verify.
- Watch for operator precedence — NOT binds most tightly, then AND, then OR. Use parentheses to clarify intent: <code>(A OR B) AND C</code> differs from <code>A OR (B AND C)</code>. When in doubt, add brackets.
- Use shorthand notation carefully — Different contexts use different symbols: <code>+</code> for OR, <code>·</code> or juxtaposition for AND, <code>'</code> or <code>!</code> for NOT. Stick to one convention per analysis to avoid confusion.
- Verify tautologies with a complete table — If you need to prove an expression is always true (or always false), generate the full table, not just one row. A single true case doesn't prove the expression is a tautology.