conditional statements cs 2312, discrete structures ii poorvi l. vora, gw
TRANSCRIPT
![Page 1: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/1.jpg)
Conditional StatementsCS 2312, Discrete Structures II
Poorvi L. Vora, GW
![Page 2: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/2.jpg)
Conditional StatementA implies B
A => B
If A then B
A is the hypothesis; B the conclusion
Example: If x is a prime larger than 2 then x is oddA: “x is a prime number larger than 2”B: “x is odd”
• Generally, the truth of the conditional statement is a function of one or more variables; in this case, x.
• This example statement is true for all values of x.
![Page 3: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/3.jpg)
Truth value a function of variables
Generally speaking, the truth value of a statement depends on variables.
For example, consider the inequality: 0 ≤ n3 ≤ Bn2
– Whether it is true or not depends on the values of the variables: n and B
– There are quite likely value of n and B for which it is true, as well as values for which it is false
![Page 4: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/4.jpg)
: for every
Consider a modification of the previous example: 0 ≤ n3 ≤ Bn2 n ≥ b
The truth value of this inequality is now a function of B and b
On fixing b and B, • If it is untrue for a single value of n ≥ b then the statement is false• If it is true n ≥ b then it is true• Thus the truth is not dependent on n
![Page 5: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/5.jpg)
Counterexample
Sometimes you may have statement that is false: x is divisible by 4 even integers x
The way to show it is false is to show that the statement is not true “ even integers x”
one even integer for which it is false is enough.
However, this does not mean that x is not divisible by 4 even integers x
![Page 6: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/6.jpg)
Counterexample, contd
The statement “x is divisible by 4” is sometimes true and sometimes false
Thus neither of the statements below is true, because there are counterexamples for both: • x is divisible by 4 even integers x• x is not divisible by 4 even integers x
![Page 7: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/7.jpg)
: There exists
Sometimes you may be asked to show that there exist values of variables such that a statement is true.
Continuing the previous example: $ B, b > 0 such that 0 ≤ n3 ≤ Bn2 n ≥ b
One way of proving above is to • find one value of b, B and • show that the inequality is true for these values.
![Page 8: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/8.jpg)
How and and change a statement
Consider the statement: “x is divisible by 6”Its truth depends on the value of x
Adding or can eliminate the dependence on x to allow you to say definitively whether the statement is true or false:
x such that x divisible by 6: True$ odd x such that x is divisible by 6: False
x is divisible by 6 integers x that are multiples of 12: Truex is divisible by 6 integers x: False
![Page 9: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/9.jpg)
The truth table of A=>B
We want to know the truth value ofA => B
Note: statement makes no claims when A is false. – when A is false, the statement is true independent of the
value of B
![Page 10: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/10.jpg)
Negation or Counterexample
Examining the statement A(x) => B(x) x (where both A and B are functions of x)
– If you think it is true, you need to provide a proof.• Begin with the assumption A(x) is true and show B(x) is true.
– If you think it is false, you could provide a counterexample. • Exactly one example of the variable which makes A true but B false.• Notice that providing an example where B is true but A false gives you nothing at
all– because the statement is making no claims when A is false.
don’t care
![Page 11: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/11.jpg)
A Counterexample
Suppose you are presented with the conditional statement:
integers x, if 2 divides x then 4 divides x
What is a valid counterexample?
Are there values of x for which the statement is true?
![Page 12: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/12.jpg)
Converse
Given: A => B
The converse isB => A
Does it follow?
Example: If x is a prime larger than 2 then x is odd
What is the converse?
Does it follow?
![Page 13: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/13.jpg)
Proving the converse does not prove the main statement
Suppose you have to showA => B
And you begin with B to show A
You have not shown A => B
You have shown B => A
![Page 14: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/14.jpg)
Examples of incorrect proofs
To show that If 2 divides x, then 4 divides x (this is not true, but examples of incorrect proofs will conclude it is)
Example 1: Suppose 4 divides x. Then x = 4q (for q the quotient when 4 divides x). Hence x is even and 2 divides x.
Incorrect! Why?
![Page 15: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/15.jpg)
Examples of incorrect proofs, contd.
To show that If 2 divides x, then 4 divides x (this is not true, but examples of incorrect proofs will conclude it is)
Example 2: Suppose 2 divides x. Then x = 2q1
Suppose 4 divides x. Then x = 4q2
x = x => 2q1 = 4q2 => q1 = 2q2
LHS = RHS
Incorrect! Why?
![Page 16: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/16.jpg)
ContrapositiveOne can show
A=> B by assuming A is true and showing that then B is true
OR
by assuming that B is not true and showing that then A is not true.
That is, by showing: not B => not A
Which is the contrapositive
Which is logically equivalent to A => B
![Page 17: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/17.jpg)
Why is the contrapositive equivalent to the original statement?
A B A => B not B => not A
T T T T
T F F F
F T T T
F F T T
Consider the truth table
![Page 18: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/18.jpg)
Inverse
not A => not B
Is this related to the original statement? The converse? The contrapositive?
It is the contrapositive of the converse
![Page 19: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/19.jpg)
Summary
Conditional Statement: A => B
– Converse: B => A
– Contrapositive: not B => not A
– Inverse: not A => not B
– Counterexample: an example of A and not B
![Page 20: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/20.jpg)
Necessary and Sufficient
A => BA sufficient for B
B => A A necessary for B
A <=> BA is necessary and sufficient for BB is necessary and sufficient for A
![Page 21: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/21.jpg)
Bidirectional
If and only if (iff)
If A then B AND If B then A
A <=> BA iff B
A and B are equivalent statements
![Page 22: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/22.jpg)
False Premise, Valid Argument, False Conclusion
Claim: If 0 + 1 = 0 then 2=0
Proof: Begin with correct statement: 2 = 0 + 1 + 1 => 2 = (0+1)+1 = 0+1=0
![Page 23: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/23.jpg)
Valid Premise, Invalid Argument, Valid Conclusion gives zero credit
Assume: If 4 divides x then 2 divides xShow that 4 divides 16
Invalid proof:2 divides 16. Hence, applying assumption, 4 divides 16.
![Page 24: Conditional Statements CS 2312, Discrete Structures II Poorvi L. Vora, GW](https://reader035.vdocuments.site/reader035/viewer/2022062422/56649e955503460f94b999d2/html5/thumbnails/24.jpg)
Proof by Contradiction
To show A=> B
Recall, if A is not true, you cannot determine anything.
Assume A is true. Suppose B is not. Then show there is a contradiction. That is, B has to be true.