Conditional statements
"If p, then q" is the most used and most misread statement in logic. Here is exactly when it is true, how its converse, inverse and contrapositive relate to it, and how to translate "only if", "unless" and "necessary" into symbols.
What a conditional statement says
A conditional statement joins two statements with "if ... then": "if p, then q", written p → q. The part after "if" is the antecedent (or hypothesis); the part after "then" is the consequent (or conclusion). It is also called an implication, and read "p implies q".
| p | q | p → q |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
Think of it as a promise: "if you finish the report, I will buy you lunch". The promise is broken in one case only, when you finish the report and get no lunch. That is the highlighted row: p true, q false. In every other row the promise is kept, so p → q is true.
A conditional does not say that p causes q, or that p is true, or that q is true. It says only that p true and q false does not happen. That makes it the same as ¬p ∨ q: "not p, or q".
Vacuous truth: when the "if" part is false
The two rows where p is false are the ones that surprise people. A conditional with a false antecedent is true whatever the consequent says, and is called vacuously true. "If 2 + 2 = 5, then the moon is made of cheese" is true, because it makes no claim about any situation that actually happens.
This is not a trick; it is what makes general rules work. "Every number divisible by 4 is even" means "for every n, if n is divisible by 4 then n is even". For n = 7 the antecedent is false. If that instance counted as false, the rule would be false, which it is not. So every instance with a false antecedent has to count as true.
Converse, inverse and contrapositive
Swap the parts of a conditional, negate them, or both, and you get three related statements:
| Statement | Example |
|---|---|
| Conditional p → q if p then q | If it is a square, then it is a rectangle. True |
| Converse q → p swap the parts | If it is a rectangle, then it is a square. False |
| Inverse ¬p → ¬q negate both parts | If it is not a square, then it is not a rectangle. False |
| Contrapositive ¬q → ¬p swap and negate | If it is not a rectangle, then it is not a square. True |
The truth table settles which of them say the same thing:
| p | q | Conditional p → q | Converse q → p | Inverse ¬p → ¬q | Contrapositive ¬q → ¬p |
|---|---|---|---|---|---|
| T | T | T | T | T | T |
| T | F | F | T | T | F |
| F | T | T | F | F | T |
| F | F | T | T | T | T |
Columns that match in every row: conditional and contrapositive; converse and inverse. So a conditional is logically equivalent to its contrapositive, and the converse is equivalent to the inverse, but a conditional is not equivalent to its converse. Check it in the calculator.
This is why proof by contrapositive works. To prove "if n² is even, then n is even", prove instead "if n is odd, then n² is odd", which is easier, and which says exactly the same. And it is why the converse is a trap: all squares are rectangles, but a rectangle need not be a square. Reasoning from a conditional to its converse is the fallacy of affirming the consequent.
Printable conditional statements chart
The conditional, converse, inverse and contrapositive with their truth table on one sheet, for printing or revision.
Click to download: Conditional statements chart
The biconditional: if and only if
"p if and only if q", written p ↔ q and often shortened to "p iff q", says that p and q always have the same truth value. It is true when both are true or both are false.
| p | q | p ↔ q | (p → q) ∧ (q → p) |
|---|---|---|---|
| T | T | T | T |
| T | F | F | F |
| F | T | F | F |
| F | F | T | T |
The two columns match: a biconditional is a conditional in both directions, (p → q) ∧ (q → p), which is where its name comes from. "If" gives one direction and "only if" the other. To prove an "if and only if" theorem you prove both conditionals. Definitions work this way too: "a number is even if and only if it is divisible by 2". In circuits the biconditional is the XNOR gate, and its negation is exclusive or.
Necessary and sufficient conditions
In p → q:
- p is a sufficient condition for q: p on its own is enough to guarantee q. Being a square is sufficient for being a rectangle.
- q is a necessary condition for p: p cannot happen without q. Being a rectangle is necessary for being a square.
When p is both necessary and sufficient for q, the two imply each other and p ↔ q. A quick check for which way the arrow points: the sufficient condition goes on the left, the necessary one on the right.
Ways English says "if p then q"
All of these are p → q:
"Only if" is the one that catches people out. "p only if q" puts q on the right: p → q. "I will go only if you go" says my going requires yours; it does not promise that I go whenever you do.
"Unless" means "if not". "p unless q" is ¬q → p, which is equivalent to p ∨ q. "I will walk unless it rains" says that if it does not rain, I walk. Strictly it says nothing about what I do when it does rain, even though in everyday speech people often mean that too.
Worked examples: English to symbols
Pick a letter for each simple statement, find the antecedent, then write the arrow. The last column is the contrapositive of each, which says the same thing in other words.
| English | Symbols | Contrapositive |
|---|---|---|
| If it rains, the match is cancelled. r: it rains, c: the match is cancelled |
r → c | ¬c → ¬r |
| The alarm sounds whenever the door opens. a: the alarm sounds, d: the door opens |
d → a | ¬a → ¬d |
| You can vote only if you are 18 or older. v: you can vote, e: you are 18 or older |
v → e | ¬e → ¬v |
| The program compiles only if it has no syntax errors. c: it compiles, s: it has a syntax error |
c → ¬s | s → ¬c |
| I will walk unless it rains. w: I walk, r: it rains |
¬r → w | ¬w → r |
| Being a square is sufficient for being a rectangle. s: it is a square, r: it is a rectangle |
s → r | ¬r → ¬s |
| A charged battery is necessary for the car to start. b: the battery is charged, t: the car starts |
t → b | ¬b → ¬t |
| You get a refund if and only if you return it within 30 days. f: you get a refund, d: you return it within 30 days |
f ↔ d | ¬f ↔ ¬d |
The biconditional has no single contrapositive, but negating both sides gives an equivalent statement, shown in its row.
Negating a conditional
A conditional is false in exactly one row, where p is true and q is false. So its negation is true in exactly that row: ¬(p → q) ≡ p ∧ ¬q, "p, and not q". The negation of "if it rains, the match is cancelled" is "it rains and the match is not cancelled". It is not p → ¬q, which differs from ¬(p → q) whenever p is false: compare all three. More negations are in the table of logical equivalences.
Common mistakes
- Treating the converse as the same statement. "If it is a square, it is a rectangle" does not give "if it is a rectangle, it is a square".
- Reading "only if" as "if". "p only if q" is p → q, not q → p.
- Thinking a false antecedent makes the conditional false. It makes it true.
- Reading causation into the arrow. p → q can be true when p and q have nothing to do with each other, as long as p is not true while q is false.
- Negating to another conditional. The negation of p → q is p ∧ ¬q.
Check any of these with the truth table calculator, or see which statements are always true on the tautology page.
Questions
What is a conditional statement?
A conditional statement is a statement of the form "if p, then q", written p → q. p is the antecedent (or hypothesis) and q the consequent (or conclusion). It is false only when p is true and q is false, and true in every other case.
What is the contrapositive of a statement?
The contrapositive of "if p, then q" is "if not q, then not p", written ¬q → ¬p: swap the two parts and negate both. It is logically equivalent to the original, so a statement and its contrapositive are always both true or both false. That is why proving the contrapositive proves the statement.
What is the difference between the converse and the inverse?
The converse swaps the parts: "if q, then p". The inverse negates both parts: "if not p, then not q". Neither is equivalent to the original conditional, but they are equivalent to each other, because the inverse is the contrapositive of the converse.
Why is a conditional true when the "if" part is false?
A conditional only makes a claim about the cases where its antecedent holds. When the antecedent is false the claim is not tested, so it cannot have been broken, and logic counts it as true. This is called vacuous truth. "If it rains, I will take an umbrella" is not broken on a dry day, whatever I carry.
What does "p only if q" mean?
"p only if q" means p → q: p cannot happen without q, so whenever p is true, q is. It does not mean q → p. "You can vote only if you are 18" says being 18 is required to vote, not that every 18 year old votes.
What is a biconditional statement?
A biconditional, "p if and only if q", written p ↔ q, is true when p and q have the same truth value and false when they differ. It says both p → q and its converse q → p. Definitions are biconditionals: a triangle is equilateral if and only if all three sides are equal.
How do you negate an if-then statement?
The negation of p → q is p ∧ ¬q: "p happens and q does not". A conditional is false only when the antecedent is true and the consequent false, so that case is exactly its negation. The negation is not another conditional; in particular it is not p → ¬q.