Up A Level
"And"
"And" of An "Or"
Contrapositive
"For All"
"If and Only If"
"If..., Then..."
"Not"
"Not" of An "And"
"Not" of An "If...Then"
"Not" of An "Or"
"Or"
"Or" of An "And"
Short Tautologies
"There exists"

IF AND ONLY IF

Compound sentences of the form "P if and only if Q" are true when P and Q are both false or are both true; this compound sentence is false otherwise. It says that P and Q have the same truth values; when "P if and only if Q" is true, it is often said that P and Q are logically equivalent. In fact, when "P if and only Q" is true, P can subsitute for Q and Q can subsitute for P in other compound sentences without changing the truth. "P if and only if Q" is rarely found in ordinary English; it's rather legalistic sounding!

The truth table below formalizes this understanding of "if and only if". T stands for true, and F stands for false.

Truth Table For "If and only if"
P Q P if and only if Q
T T T
T F F
F T F
F F T

What happens if you interchange (commute) P and Q in an "if and only if"? You get a sentence that means the same thing: if P and Q have the same truth values, it doesn't matter which is listed first. This is shown in the table below:

Second Truth Table For "If and only if"
P Q P if and only if Q Q if and only if P
T T T T
T F F F
F T F F
F F T T

Some Uses of "if and only if" in Writing About Mathematics

Theorems which have the form "P if and only Q" are much prized in mathematics. They give what are called "necessary and sufficient" conditions, and give completely equivalent and hopefully interesting new ways to say exactly the same thing. In high school geometry, an triangle is said to be equilateral if all three sides are equal. There is a theorem that says that a triangle is equilateral if and only if all three angles are equal. Once this theorem is presented, there are now at least two different ways to prove that something is (or is not) equilateral: work with the lengths of the sides or work with the sizes of the angles.

Theorems of the style "P if and only Q" are proved in several common ways. One style has two paragraphs: one of them show "if P then Q" and the other shows "if Q then P". Nothing more needs to be said, because the writer assumes that you know that "P if and only if Q" means the same as "(if P then Q) and (if Q then P)". This is proved in the truth table below:

Third Truth Table For "If and only if"
P Q P if and only if Q If P, then Q If Q, then P (If P, then Q) and (if Q, then P)
T T T T T T
T F F F T F
F T F T F F
F F T T T T

Another style proceeds by a chain of "if and only if"'s. The writer explains that "P if and only if S". Then the writer explains that "S if and only if Q". Now the writer stops. It's supposed to be obvious that "P if and only if Q" is now proven (and to most people it is). Here's one way to understand it: if P and S always have the same truth values, and S and Q always have the same truth values, then P and Q always have the same truth values. The chain does not have to stop with two "if and only if"'s: suppose we know "P if and only if S1", "S1 if and only if S2", ..., and "S18 if and only Q". Then we know, "P if and only Q".

Test Your Understanding
  • Construct a truth table to show that "P if and only if Q" means the same thing as "(Not(P)) if and only if (not(Q))".
  • Construct a truth table to show that "Not(P if and only if Q)" means the same thing as "( P and (not(Q)) ) or ( (not(P)) and Q )".
  • Construct a truth table for "P if and only if P". Regardless of the truth of P, this is always true.
  • Construct a truth table for "P if and only if (not(P))". Regardless of the truth of P (as long as P is not both true and false!), this is always false.
  • Construct a truth table for "if [( P if and only if Q) and (Q if and only if R)], then (P if and only if R)". This will always be true, regardless of the truths of P, Q, and R. This is another way of understanding that "if and only if" is transitive. By the way, this principle can proved another way as well: if you already know that "if...then" is transitive, and you know the third truth table above, you can prove that "if and only if" is transitive.

Go to an overview of logic.
Go to the home page for Tom Ram sey
Go to the home page for the UHM Depart ment of Mathematics
Your comments and questions are welcome. Please email them ramsey@math.hawaii.edu.