The Idea: When Two Things Are Locked Together
Imagine you're told: "You can enter the club if and only if you are wearing a blue badge."
What does that mean? Two things, and both are true:
- If you have a blue badge, you can enter. (Blue badge → entry allowed.)
- If you enter, you must have a blue badge. (Entry allowed → blue badge.)
The two statements — "you have a blue badge" and "you can enter" — are equivalent. One cannot happen without the other. They are locked together: whenever one is true, the other is true; whenever one is false, the other is false.
That's the intuition. Now let's make it precise.
The Precise Statement
In logic, "P if and only if Q" (written P⟺Q) means:
P is true exactly when Q is true.
It is a two-way implication. It breaks into two separate implications:
- If P then Q (P⟹Q) — the "only if" part.
- If Q then P (Q⟹P) — the "if" part.
Both must hold. If either direction fails, the "if and only if" is false.
P⟺Q≡(P⟹Q) ∧ (Q⟹P)
Truth Table
| P | Q | P⟺Q |
|---|
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |
Notice: the statement is true only when P and Q have the same truth value — both true or both false.
Why It Matters
In mathematics, "if and only if" is the language of equivalence. When you prove a theorem that says "A triangle is equilateral if and only if all its angles are 60∘", you are saying:
- If the triangle is equilateral, then each angle is 60∘.
- If each angle is 60∘, then the triangle is equilateral.
These are two separate facts. Proving both is harder than proving just one direction — but the payoff is a complete, reversible description.
A common mistake is to prove only one direction and claim you've proved "if and only if". You haven't. You must prove both P⟹Q and Q⟹P.
A Simple Example
Let P be "An integer is even" and Q be "The integer is divisible by 2".
- If an integer is even, then it is divisible by 2. (P⟹Q)
- If an integer is divisible by 2, then it is even. (Q⟹P)
Both are true. So: "An integer is even if and only if it is divisible by 2." This is a definition — it tells you that "even" and "divisible by 2" are the same property.
A Non-Example …