# What is the difference between only if and iff?

I have read this question. I am now stuck with the difference between "if and only if" and "only if". Please help me out.

Thanks

• The moon is made of lemon meringue only if $1+1=2$. – Ilmari Karonen Sep 28 '11 at 20:08
• Also try to understand in terms of plain translation. AiffB means A is true 'if' B is true & A is true 'only if' B is true.The 'only if' means that A is true in no other cases.'A if B' can be written as B => A.And 'A only if B' can be written as notB => notA. It is the property of => sign that c=>d is same as notd=>notc. Thus , you can replace notB=>notA by A=>B. Thus A iff B can be written as A=>B and B=>A . Of course what I am saying is same as what others have already said . I just wanted to emphasise how we can intuitively try to understand the logic from the meaning of 'if' and 'only if'. – ameyask86 Feb 11 '14 at 11:18
• @Ilmari: So moon rocks are frozen lemon meringue? – Asaf Karagila Jun 7 '15 at 12:52
• The mathematician R.L. Moore used "only if" to mean "if and only if". This sounds weird to us now, because it goes against the accepted convention, but I can see what Moore was thinking. The statement "A only if B" sounds like the statement "A if B", except that you are also given an extra piece of information: not just A if B, but A only if B. – littleO Jun 25 '15 at 6:58

Let's assume A and B are two statements. Then to say "A only if B" means that A can only ever be true when B is true. That is, B is necessary for A to be true. To say "A if and only if B" means that A is true if B is true, and B is true if A is true. That is, A is necessary and sufficient for B. Succinctly,

$A \text{ only if } B$ is the logic statement $A \Rightarrow B$.

$A \text{ iff } B$ is the statement $(A \Rightarrow B) \land (B \Rightarrow A)$

• @RossMillikan & Josh: Thanks for the answers. So I can conclude it as 'only if' is same as implies and 'iff' is same as equivalence? – Fahad Uddin Sep 28 '11 at 20:05
• @Akito: that is correct – Ross Millikan Sep 28 '11 at 20:07
• Then shouldn't your first line read "A only if B is the logic statement B⇒A"? – Michael Fulton Apr 11 '17 at 19:06
• Nice explanation here criticalthinkeracademy.com/courses/2514/lectures/51574 – Devasish Jan 11 '18 at 2:16
• @erised: Nope, the accepted answer is correct. What comes before the "only if" is the antecedent. For clarification, see "2. A only if B" in the link to which you (via @Devasish) refer. – Nick The Swede Nov 22 '18 at 14:13

I will find a million dollars inside this locker only if I know the combination.

But that doesn't mean I will find a million dollars there if I know the combination. After all, there might be only a half million in there.

• I don't know why the answer received so many votes when this is the correct one. – Karmin Wehr Dec 3 '16 at 6:42

If A then B is true unless A is true and B is false and written $A \implies B$.

A only if B is true unless A is true and B is false, equivalent to if A then B.

A if B is true unless A is false and B is true, the converse of the above, and is written $B \implies A$

A iff B, also written A if and only if B, is true if A and B have the same truth value. It represents (A if B) and (A only if B) and is written $A \iff B$

A "only if B"

is the same as saying

"B is necessary" for A

which is the same as saying

A could not have happened without B

but that does mean that other things do not also need to happen for A to be true.

Therefore,

$$A \to B$$

but it is not true that $$B \to A$$ because B being true does not guarantee A happened. There could also be other requirements for A to be true.

e.g.:

You are eligible to be president only if you are at least 35 years old.

let $$p$$: "You are eligible to be president" and $$a$$: "You are at least 35 years old".

Here is is the case that $$p \to a$$,

but it is not the case that $$a \to p$$

In other words, $$a$$ is necessary for $$p$$, but just because $$a$$ is true does not mean that $$a$$ is the one single requirement for $$p$$. Just because you're at least 35 years old does not mean that you are eligible to be president.

As far as the difference goes, (which I guess was the specific question), if and only if means just that. $$p$$ if and only if $$q$$ means ($$p$$ if $$q$$) AND ($$p$$ only if $$q$$).

The bottom line is:

$$p$$ if $$q$$

equates

if $$q$$, then $$p$$

which is the same as $$q \to p$$

I just (hopefully well) explained that

$$p$$ only if $$q$$

equates

$$p \to q$$

Also,

$$q \to p$$ and $$p \to q$$

is the same as saying $$p \iff q$$

So there you have. One statement is unidirectional, the other is bidirectional.

A real number is positive if and only if it is greater than zero.

A real number is an rational only if it has a finite decimal expansion. A real number, in general, however need not be rational.

• I'd be happy to improve this, if someone has some suggestions as to what's wrong. – Asaf Karagila Jun 6 '15 at 19:59
• I'm not the downvoter, but it looks like you've explained the difference between 'if and only if' and 'if', while the question asked about 'if and only if' and 'only if'. – Strants Jun 6 '15 at 21:38
• You're right. There, now it's all better. – Asaf Karagila Jun 7 '15 at 12:51

$A \text{ iff } B$ is the statement

"if B then A" and "only if B then A"

$(B \Rightarrow A) \land (notB \Rightarrow notA)$

$(B \Rightarrow A) \land (A \Rightarrow B)$

$A=B$

What does "A only if B" mean? It means "if A then B". In other words, "If A is true, then B is true".

• "I cry only if I'm sad" = "If I cry, then I'm sad"
• The above allows for me to be sad but not crying.

What does "A if B" mean? It means "If B then A". In other words, "If B is true, then A is true".

• "I cry if I'm sad" = "If I'm sad, then I cry"
• The above allows for me to be crying but not sad.

What does "A if and only if B" mean? It means "A if B" and "A only if B". This means "A if B" and "A then B". In other words, "If B is true, then A is true" and "If A is true, then B is true".

• "I cry if and only if I'm sad" = "If I cry, then I'm sad, and if I'm sad, then I cry"
• The above means that I can be sad and crying, or neither.

How I understood this:

A rectangle is a square only if it has all sides equal. In this case the sentence gives us information, how we should name rectangles fulfilling the condition. It does not say that only these rectangles are squares. There may be many other rectangles which do not have equal sides, but are squares as well, for example the definition of "a square" could be "a square is a rectangle with equal sides or a circle with radius larger than 2 cm". So from this sentence I only know how to name particular rectangle, but I don't know what a square is in general, I know only one case.

Each square is a rectangle with all sides equal (or using "if" a square exists only if it is a rectangle with its sides equal). In this sentence we know that it is necessary for squares to be rectangles with equal sides. However, it does not say, that each rectangle with equal sides is a square. The might be some rectangles with equal sides, that we could name "circles". So again, I know only one case.

A rectangle is a square if and only if it has equal sides means that 1. only each rectangle with equal sides can be called a square, but also 2. each square is a rectangle with equal sides. There are no other conditions for both. No other figure can be a square, and a rectangle with equal sides can be nothing but a square.

If I say that an object is an apple only if it is a fruit ($\text{Fruit} \Leftarrow \text{Apple}$), then that means that something has to be a fruit in order for it to be an apple, but it does not have to be an apple. If something is a fruit, it can also be an orange or a banana.

However, if said that an object is an apple if and only if it is a fruit ($\text{Fruit} \iff \text{Apple}$), then that would once again mean that something has to be a fruit in order for it to be an apple, but here the main difference is that it would also have to be an apple and not an orange or a banana. If it is a fruit, then it's an apple, and if it is an apple, then it is a fruit.

In the second example, we have also added $\text{Fruit} \Rightarrow \text{Apple}$ which, on it's own, means that if something is a fruit, then it has to be an apple. Another way of writing $A \iff B$ is $(A \Rightarrow B) \ \& \ (A\Leftarrow B)$.

## protected by Zev ChonolesJun 25 '15 at 6:00

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?