69

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

  • 20
    The moon is made of lemon meringue only if $1+1=2$. – Ilmari Karonen Sep 28 '11 at 20:08
  • 1
    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'. – ameyask Feb 11 '14 at 11:18
  • 2
    @Ilmari: So moon rocks are frozen lemon meringue? – Asaf Karagila Jun 07 '15 at 12:52
  • 6
    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 06:58

11 Answers11

70

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)$

michael
  • 1,030
  • 8
    @RossMillikan & Josh: Thanks for the answers. So I can conclude it as 'only if' is same as implies and 'iff' is same as equivalence? –  Sep 28 '11 at 20:05
  • 5
    @Akito: that is correct – Ross Millikan Sep 28 '11 at 20:07
  • Does the statement "A if and only if B" also imply that B is necessary and sufficient for A? – Minh Tran Apr 23 '16 at 14:31
  • 8
    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
  • 1
    Nice explanation here https://criticalthinkeracademy.com/courses/2514/lectures/51574 – Devasish Jan 11 '18 at 02:16
  • So there is no difference? – Geremia Feb 06 '18 at 03:48
  • @FahadUddin So "only if" and "if" (implication) are the same? – Geremia Feb 06 '18 at 03:49
  • @Geremia: 'A only if B' is the same as 'If A, then B' and 'A implies B'. If that was what you were asking, then you are right. – Nick The Swede Nov 22 '18 at 14:00
  • 3
    @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
  • The statements using logical symbols seem to be backwards. $A \text{ if } B$, which is correctly stated to mean "A is true if B is true" is actually expressed as follows in logic: $B \implies A$, i.e. the statement "$B$ implies $A$", or in plain English: "If $B$ is true, then $A$ is true." What's actually written in the formulas above with $A \implies B$ is "If $A$ is true, then $B$ is true.", which is the reverse. The same applies to the other logical formulas. – code_dredd Jun 16 '19 at 19:05
  • 1
    @code_dredd The logic formulas are correct; "A only if B" means that the truth of A implies the truth of B, since B is necessary for A. The reverse is not true: B could still be true whilst A is false. – michael Jun 16 '20 at 17:52
40

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.

17

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.

AtilioA
  • 175
carsaab
  • 171
9

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$

Ross Millikan
  • 374,822
4

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.

Asaf Karagila
  • 393,674
3

The way logic is written can be confusing. Tip: whenever you see something like "A only if B", mentally insert "A [is true] only if B [is true]".

What does "A only if B" mean? It means "if A then B", or more precisely, "If A is true, then B is true".

  • "I cry only if I'm sad" = "If I cry, then I'm sad" = "If I'm crying, you know I'm sad"

What does "A if B" mean? It means "If B then A", or more precisely, "If B is true, then A is true", the reverse from before.

  • "I cry if I'm sad" = "If I'm sad, then I cry" = "If I'm sad, you know I'm crying"

What does "A if and only if B" mean? It means "A if B and A only if B". In other words, "If B is true, then A is true, and if A is true, then B is true". A and B are always both true or both false.

  • "I cry if and only if I'm sad" = "If I cry, then I'm sad, and if I'm sad, then I cry" = " You know I'm either crying and sad, or neither"
2

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.

Voitcus
  • 193
2

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)$.

John K
  • 644
2

$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$

user127891
  • 29
  • 1
0

I am just putting an another comprehnsive answer which steals important points from other answers. Other answers don't break the IF AND ONLY IF correctly.

Let's try to prove the truth table of P IFF Q

Label   P    Q    P IFF Q
-------------------------
tt      T    T       T
tf      T    F       F
ft      F    T       F
ff      F    F       T

Proof:

###             P IFF Q
<=>          P IF AND ONLY IF Q
<=>      (P IF Q) AND (P ONLY IF Q)
<=> (IF Q THEN P) AND (P THEN Q)

Let's put a truth table for our last expression now.

P  |  Q  |  (IF Q THEN P)  |  (P THEN Q)  |  R AND S <=> P IFF Q
   |     |       (R)       |     (S)      |
----------------------------------------------------------------
T     T           T               T                  T
T     F           T               F                  F
F     T           F               T                  F
F     F           T               T                  T

QED.
0

I win the competition if I compete.
This sentence implies that if I compete, I necessarily win the competition, but not that I only win if I compete.

I win the competition only if I compete.
This sentence implies I only win if I compete, but not necessarily that if I compete, I win the competition.

I win the competition if and only if I compete.
This sentence implies that if I compete, I necessarily win the competition AND that I only win if I compete.

Eduardo M
  • 113