Propositional Logic and Truth Tables Explained
Learn the five basic connectives, build truth tables step by step, and use them to test whether an argument really holds.
Key takeaways
- A proposition is a statement that is either true or false, and propositional logic treats each simple one as an unbroken unit.
- Five connectives (not, and, or, if-then, if and only if) are each defined completely by a small truth table.
- A formula with n distinct letters needs a table with 2ⁿ rows, one for every assignment of truth values.
- An argument is valid when no row makes all the premises true and the conclusion false.
Propositional logic studies how the truth of a compound statement depends on the truth of its parts. A truth table lists every possible combination of true and false for those parts and shows what the whole statement does in each case.
That gives you a mechanical test. You can check whether two sentences say the same thing, whether a statement is true no matter what, or whether a conclusion really follows from its premises, all without knowing anything about the subject matter.
What counts as a proposition
A proposition is a sentence that is either true or false. "7 is a prime number" is a proposition, and so is "8 is a prime number", which happens to be false. Questions, commands and exclamations are not propositions because there is nothing for them to be true of.
A sentence such as "x is greater than 3" is not yet a proposition either. It becomes one only after you say what x is, or say how many values of x you mean. Handling that kind of sentence is the job of predicate logic.
Propositional logic replaces whole simple statements with letters, usually P, Q and R. If P stands for "the triangle has two equal sides" and Q stands for "the triangle has two equal angles", the logic does not care about triangles. It cares only about which of P and Q are true.
The system described here, called classical logic, makes two assumptions. Every proposition has at least one of the values true or false, and none has both.
The five connectives
A connective is a word or symbol that builds a new proposition from old ones. Each is defined by what it outputs for every input.
| Name | Symbol | Read as | True exactly when |
|---|---|---|---|
| Negation | ¬P | not P | P is false |
| Conjunction | P ∧ Q | P and Q | both are true |
| Disjunction | P ∨ Q | P or Q | at least one is true |
| Conditional | P → Q | if P then Q | P is false or Q is true |
| Biconditional | P ↔ Q | P if and only if Q | both have the same value |
Here are the four two-letter connectives side by side, with T for true and F for false.
| P | Q | P ∧ Q | P ∨ Q | P → Q | P ↔ Q |
|---|---|---|---|---|---|
| T | T | T | T | T | T |
| T | F | F | T | F | F |
| F | T | F | T | T | F |
| F | F | F | F | T | T |
Two entries surprise people. The "or" of logic is inclusive: P ∨ Q is still true when both parts are true. If you mean "one or the other but not both", that is the exclusive or, which you can write as (P ∨ Q) ∧ ¬(P ∧ Q).
The other surprise is that P → Q counts as true whenever P is false. There are good reasons for this convention, laid out in why a false premise makes an implication true.
Only one of the four cases breaks the promise.
How to build a truth table
For longer formulas, you work from the inside out. The steps never change.
- List the distinct letters. With n letters you need 2ⁿ rows: 2 rows for one letter, 4 for two, 8 for three, 16 for four.
- Fill the letter columns systematically. For three letters, give the first column four T then four F, the second alternating pairs, and the third alternating singles.
- Add a column for each smaller piece of the formula, innermost first.
- Combine those columns using the connective tables until you reach the whole formula.
Brackets tell you what is inside what. The usual convention when brackets are left out is that ¬ binds most tightly, then ∧, then ∨, then →, then ↔. So ¬P ∧ Q means (¬P) ∧ Q. When in doubt, write the brackets.
A worked example with three letters
Take the formula (P ∨ Q) → R. Suppose P is "it rains", Q is "the sprinkler runs" and R is "the lawn gets wet".
| 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 formula is false in exactly three rows: those where at least one cause is present and the lawn stays dry. In the last two rows there is no rain and no sprinkler, so the claim is not tested and counts as true.
Now compare it with (P → R) ∧ (Q → R). The first part is false when P is true and R is false, which covers rows 2 and 4. The second is false when Q is true and R is false, which covers rows 2 and 6. Their conjunction is therefore false in rows 2, 4 and 6, exactly the same rows as before. The two formulas always agree.
Tautologies, contradictions and equivalence
A tautology is a formula that is true in every row. The simplest is P ∨ ¬P, known as the law of excluded middle. A contradiction is false in every row, such as P ∧ ¬P. Everything else is contingent: true in some rows and false in others.
Two formulas are logically equivalent when their final columns match row for row. You can then swap one for the other anywhere. Several equivalences are worth memorizing.
- ¬¬P is equivalent to P.
- P → Q is equivalent to ¬P ∨ Q.
- P → Q is equivalent to its contrapositive, ¬Q → ¬P.
- P ↔ Q is equivalent to (P → Q) ∧ (Q → P).
- ¬(P ∧ Q) is equivalent to ¬P ∨ ¬Q.
The last one is half of a famous pair covered in De Morgan's laws. The contrapositive line explains a standard proof technique, and it differs sharply from the converse Q → P, as this guide to converse, inverse and contrapositive shows.
Testing an argument
An argument has premises and a conclusion. It is valid if the conclusion is true in every row where all the premises are true. To test it, build one table with a column for each premise and for the conclusion, then look for a counterexample row: premises all true, conclusion false.
Consider these premises: P → Q and Q. Conclusion: P.
| P | Q | P → Q (premise) | Q (premise) | P (conclusion) |
|---|---|---|---|---|
| T | T | T | T | T |
| T | F | F | F | T |
| F | T | T | T | F |
| F | F | T | F | F |
Row 3 has both premises true and the conclusion false, so the argument is invalid. In words: "If it is a square, it has four sides. It has four sides. So it is a square." A non-square rectangle sits in row 3.
Change the second premise to P and the conclusion to Q. The only row with both premises true is row 1, where Q is true. That pattern is valid, and it is the first of the standard rules of inference.
Fewer connectives, same power
Five connectives are convenient, but you do not strictly need all of them. Because P → Q matches ¬P ∨ Q, and P ↔ Q is two conditionals joined by "and", everything can be written with ¬, ∧ and ∨. One of the last two can go as well, since P ∨ Q is equivalent to ¬(¬P ∧ ¬Q).
You can also run the process in reverse. Pick any output column you like for letters P and Q. For each row where the output should be true, write a conjunction that is true only in that row, then join those conjunctions with "or".
Say you want a formula that is true exactly when P and Q differ. The wanted rows are (T, F) and (F, T), so the formula is (P ∧ ¬Q) ∨ (¬P ∧ Q). This shape, an "or" of "ands", is called disjunctive normal form. If a column has no true rows at all, a contradiction such as P ∧ ¬P produces it.
The method shows that these connectives are functionally complete: every possible truth table has a formula. A single connective, "not both", can even do the whole job alone, which is why one type of logic gate is enough to build any digital circuit.
Where truth tables stop
Truth tables always finish and always give the right answer for propositional formulas, so propositional logic is decidable: a fixed procedure settles every question of validity. The cost grows fast, though. Ten letters need 1,024 rows, and twenty letters need 1,048,576.
Asking whether any row makes a formula true is called the satisfiability problem. Whether it can always be solved efficiently is tied to the P versus NP question, open as of the mid-2020s. In practice, programs called SAT solvers handle many very large formulas by pruning whole blocks of rows at once.
There is also a limit on what the letters can express. "All humans are mortal; Socrates is human; so Socrates is mortal" is a good argument, but in propositional logic it is just P, Q, therefore R, which is invalid. The reasoning lives inside the sentences, where this logic does not look.
Common mistakes
- Reading "or" as exclusive. Unless stated otherwise, a mathematician's "or" allows both.
- Treating P → Q as cause and effect. The connective records only a pattern of truth values. "If 2 + 2 = 4, then 9 is odd" is true.
- Confusing the converse with the original. P → Q and Q → P differ in two of the four rows.
- Skipping rows. A single missing assignment can hide the counterexample. Count to 2ⁿ before you start.
- Negating a conditional as another conditional. The negation of P → Q is P ∧ ¬Q, not P → ¬Q.
A good habit is to try the table on a small formula you think you understand, such as ¬(P → Q), and check that the single true row matches your intuition. When it does not, the table is usually showing you a hidden assumption in the English.