Lecture 2
Lecture 2
P ¬P ?
Logical Negation Proof by Contradiction
P Q
Q ¬Q ¬P
Logical Negation
Negations
●
A proposition is a statement that is either true or
false.
●
Some examples:
●
If n is an even integer, then n2 is an even integer.
●
Ø = ℝ.
●
The negation of a proposition X is a proposition that
is true when X is false and is false when X is true.
●
For example, consider the proposition “it is snowing
outside.”
●
Its negation is “it is not snowing outside.”
●
Its negation is not “it is sunny outside.” ⚠
●
Its negation is not “we’re in the Bay Area.” ⚠
How do you find the negation
of a statement?
“All My Friends Are Taller Than Me”
Me
My Friends
The negation of the universal statement
Every P is a Q
Me
My Friends
The negation of the existential statement
Every P is not a Q.
The negation of the existential statement
P Q
Q ¬Q ¬P
Proof by Contradiction
First, let’s reflect on the direct proof
= 4k2
P is
=“If
2(2k2).true, then Q is true,”
From this, we see we
that there
start is an integer
by asking m to
our reader
(namely, 2k2) where n2 =assume
2m. Therefore,
P is true. n2
= 2(2k2).
From this, we see that there is an integer m
(namely, 2k2) where n2 = 2m. Therefore, n2
is even, which is what we wanted to show. ■
More generally speaking,
is e ven
n
Direct Proof
is e ven
n
is e ven
n
there is some
m∈ℤ n2 = (2k)2
(namely, 2k2)
where
n2 = 2 m
n2 = 4k2
n2 = 2(2k2)
Direct Proof
Direct Proof
?
P i
This might radiate
SOME truth.
s tr ue
?
P i
This might radiate
SOME truth.
s tr ue
?
P i
This might radiate What does it mean
SOME truth. if we start
generating
statements we
know are false?
s tr ue
?
P i
This might radiate What does it mean
3 is even
SOME truth. if we start
generating
statements we
know are false?
s tr ue
?
P i
5 > 10 1=0
s tr ue
?
P i
5 > 10 1=0
i s tr ue P must
P
be false!
5 > 10 1=0
i.e., P is false
i s f alse
P
Suppose we want to use this technique to show that P is true.
What proposition can we place in the Zone of Uncertainty to accomplish this?
Answer: The negation of P !
i.e., P is false
i s f alse Then apply sound logic...
P
i.e., P is false
i s f alse Then apply sound logic...
P
|Ø| > 0
😭😬 🤬 😮 …and derive a statement
we know to be false.
Suppose we want to use this technique to show that P is true.
What proposition can we place in the Zone of Uncertainty to accomplish this?
Answer: The negation of P !
i.e., P is false
i s f alse P is Then apply sound logic...
P
true!
|Ø| > 0
😭😬 🤬 😮 …and derive a statement
we know to be false.
Suppose we want to use this technique to show that P is true.
What proposition can we place in the Zone of Uncertainty to accomplish this?
Answer: The negation of P !
i.e., P is false
i s f alse P is Then apply sound logic...
P
true!
●
Key Idea: Prove a statement P is true by
showing that it isn’t false.
●
First, assume that P is false. The goal is to
show that this assumption is silly.
●
Next, show this leads to an impossible result.
●
For example, we might have that 1 = 0, that
x ∈ S and x ∉ S, that a number is both even and
odd, etc.
●
Finally, conclude that since P can’t be false,
we know that P must be true.
An Example: Set Cardinalities
Set Cardinalities
●
We’ve seen sets of many different cardinalities:
●
|Ø| = 0
●
|{1, 2, 3}| = 3
●
|{ n ∈ ℕ | n < 137 }| = 137
●
|ℕ| = ℵ₀.
●
|℘(ℕ)| > |ℕ|
●
These span from the finite up through the infinite.
●
Question: Is there a “largest” set? That is, is
there a set that’s bigger than every other set?
Theorem: There is no largest set.
Proof: Assume for the sake of contradiction that
there is a largest set; call it S.
Now, consider the set ℘(S). By Cantor’s Theorem,
we know that |S| < |℘(S)|, so ℘(S) is a larger set
than S. To prove this statement by contradiction,
This contradicts the fact that S is the
we’re going to assume its negation.
largest set.
We’ve reached a contradiction,
What is the so our
negation of the statement
assumption must have
“there is no been
largestwrong.
set?” Therefore,
there is no largest set. ■
One option: “there is a largest set.”
Theorem: There is no largest set.
Proof: Assume for the sake of contradiction that
there is a largest set; call it S.
Now, consider the set ℘(S). By Cantor’s Theorem,
we know
Notice that |S| <announcing
that we're |℘(S)|, so ℘(S) is a larger set
than S. This contradicts the fact that S is the
largest1.set.
that this is a proof by contradiction, and
2. what, specifically, we're assuming.
We’ve reached a contradiction, so our
assumption must have been wrong. Therefore,
This helps the reader understand where we're
there is noRemember
going. largest– set. ■ are meant to be
proofs
read by other people!
Theorem: There is no largest set.
Proof: Assume for the sake of contradiction that
there is a largest set; call it S.
Now, consider the set ℘(S). By Cantor’s Theorem,
we know that |S| < |℘(S)|, so ℘(S) is a larger set
than S. This contradicts the fact that S is the
largest set.
We’ve reached a contradiction, so our
assumption must have been wrong. Therefore,
there is no largest set. ■
Theorem: There is no largest set.
Proof: Assume for the sake of contradiction that
there is a largest set; call it S.
The three key pieces:
Now, consider the set ℘(S). By Cantor’s Theorem,
1. Say that the proof is by contradiction.
2.we
Say know
what youthat |S| <is|℘
are assuming (Snegation
the S)statement
)|, so of℘(the is a larger set
to prove.
3.than Shave
Say you . This contradicts
reached the
a contradiction and fact that
what the S is the
contradiction means.
1 2 3 4 5 3 2 5 1 4 2 5 1 4 3
1 2 3 2 5 4 1 3 2 1 4 5 3 5 1 3 2 4
2 3 1 3 4 2 5 1 5 4 2 3 1 1 3 4 5 2
3 1 2 4 1 5 3 2 1 5 3 4 2 4 2 5 3 1
5 3 1 2 4 4 3 1 2 5 3 4 2 1 5
Latin Squares
●
Notice anything about what’s on the main
diagonals of these symmetric Latin squares?
●
Theorem: Every odd-sized symmetric Latin
square has every number 1, 2, …, n on its main
diagonal.
1 2 3 4 5 3 2 5 1 4 2 5 1 4 3
1 2 3 2 5 4 1 3 2 1 4 5 3 5 1 3 2 4
2 3 1 3 4 2 5 1 5 4 2 3 1 1 3 4 5 2
3 1 2 4 1 5 3 2 1 5 3 4 2 4 2 5 3 1
5 3 1 2 4 4 3 1 2 5 3 4 2 1 5
Theorem: Every symmetric Latin square of odd size n × n has each
of the numbers 1, 2, …, n on its main diagonal.
Proof: Assume for the sake of contradiction that there is a
symmetric Latin square of odd size n × n where one of the
numbers 1, 2, 3, …, n does not appear on the main diagonal.
Call the missing number r.
Let k be What
the number times r appears
is theof negation of the above the main diagonal.
theorem?
Since the Latin square is symmetric, there are also k copies of r
below thesymmetric
Every main diagonal. And
Latin because
square of rodd
doesn’t
size appear on the
n × n has
main
eachdiagonal, that accounts
of the numbers 1, 2,for
…,alln copies
on its of r, sodiagonal.
main there are
exactly 2k copies of r.
that roption:
Independently, we know One appears n times in the Latin
square, once for each of its n rows.
There isthese
Combining a symmetric Latin
results, we square
see that n =of
2kodd size
. This n ×that
means n n
that does
is even, not havethe
contradicting one ofthat
fact the nnumbers 1, 2,reached
is odd. We’ve …, n ona
contradiction, so our its main diagonal.
assumption was wrong. Therefore, all
symmetric Latin squares of odd size n × n have each of the
numbers 1, 2, …, and n on their main diagonals. ■
Theorem: Every symmetric Latin square of odd size n × n has each
of the numbers 1, 2, …, n on its main diagonal.
Proof: Assume for the sake of contradiction that there is a
symmetric Latin square of odd size n × n that does not have one
of the numbers 1, 2, 3, …, n on its main diagonal. Call the
missing number r.
Let k be the number of times r appears above the main diagonal.
Since the Latin square is symmetric, there are also k copies of r
below the main diagonal. And because r doesn’t appear on the
Notice that we're announcing
main diagonal, that accounts for all copies of r, so there are
exactly 2k copies of r.
1. that this is a proof by contradiction, and
Independently, we know
2. what, that r appears
specifically, n times in the Latin
we're assuming.
square, once for each of its n rows.
Combining
This these
helps results, we see
the reader that n =where
understand 2k. This means that n
we're
is even,going.
contradicting
Remember the– fact n ismeant
thatare
proofs odd. We’ve
to be reached a
contradiction, so our assumption was wrong. Therefore, all
read by other people!
symmetric Latin squares of odd size n × n have each of the
numbers 1, 2, …, and n on their main diagonals. ■
Theorem: Every symmetric Latin square of odd size n × n has each
of the numbers 1, 2, …, n on its main diagonal.
Proof: Assume for the sake of contradiction that there is a
symmetric Latin square of odd size n × n that does not have one
of the numbers 1, 2, 3, …, n on its main diagonal. Call the
missing number r.
Let k be the number of times r appears above the main diagonal.
Since the Latin square is symmetric, there are also k copies of r
below the main diagonal. And because r doesn’t appear on the
main diagonal, that accounts for all copies of r, so there are
exactly 2k copies of r.
Independently, we know that r appears n times in the Latin
square, once for each of its n rows.
Combining these results, we see that n = 2k. This means that n
is even, contradicting the fact that n is odd. We’ve reached a
contradiction, so our assumption was wrong. Therefore, all
symmetric Latin squares of odd size n × n have each of the
numbers 1, 2, …, and n on their main diagonals. ■
Theorem: Every symmetric Latin square of odd size n × n has each
of the numbers 1, 2, …, n on its main diagonal.
Proof: Assume for the sake of contradiction that there is a
symmetric Latin square of odd size n × n that does not have one
of the numbers 1, 2, 3, …, n on its main diagonal. Call the
missing number r.
Let k be the number of times r appears above the main diagonal.
The three key pieces:
Since the Latin square is symmetric, there are also k copies of r
1. Say that the proof is by contradiction.
below
2. Say the
whatmain diagonal.
you are assumingAndis thebecause r doesn’t
negation of appear
the statement on the
to prove.
main diagonal,
3. Say that accounts
you have reached for alland
a contradiction copies of rcontradiction
what the , so there are
means.
exactly 2kIncopies of r.
CS103, please include all these steps in your proofs!
Independently, we know that r appears n times in the Latin
square, once for each of its n rows.
Combining these results, we see that n = 2k. This means that n
is even, contradicting the fact that n is odd. We’ve reached a
contradiction, so our assumption was wrong. Therefore, all
symmetric Latin squares of odd size n × n have each of the
numbers 1, 2, …, and n on their main diagonals. ■
(Intermission)
Back to CS103!
P ¬P ?
Logical Negation Proof by Contradiction
P Q
Q ¬Q ¬P
Logical Implication
If n is an even integer, then n2 is an even integer.
in code.
🚫 🚫 contract is not violated ✅
🚫 ✅
is false is when contract
P is true andviolated
is not ✅
Q is false.
What Implications Mean
“If there's a rainbow in the sky,
then it's raining somewhere.”
●
In mathematics, implication is directional.
●
The above statement doesn't mean that if it's raining
somewhere, there has to be a rainbow.
●
In mathematics, implications only say something
about the consequent when the antecedent is true.
●
If there's no rainbow, it doesn't mean there's no rain.
●
In mathematics, implication says nothing about
causality.
●
Rainbows do not cause rain. 😃
What Implications Mean
●
In mathematics, a statement of the form
For any x, if P(x) is true, then Q(x) is true
means that any time you find an object x
where P(x) is true, you will see that Q(x) is
also true (for that same x).
●
There is no discussion of causation here. It
simply means that if you find that P(x) is
true, you'll find that Q(x) is also true.
Implication, Diagrammatically
Any time P is
true, Q is
true as well.
🐕 ❤ 🐕❤ 🐕 ❤
How to Negate Universal Statements:
“For all x, P(x) is true”
becomes
“There is an x where P(x) is false.”
P Q
Q ¬Q ¬P
Proof by Contrapositive
Anything inside this Anything outside this
inner bubble is also outer bubble is
inside the outer outside the inner
bubble. bubble.
n2 = 2(2k2 + 2k) + 1.
From this, we see that there is an integer m
(namely, 2k2 + 2k) such that n2 = 2m + 1. That
means that n2 is odd, which is what we needed
to show. ■
Theorem: For any n ∈ ℤ, if n2 is even, then n is even.
Proof: We will prove the contrapositive of this
statement, that if n is odd, then n2 is odd. So let
n be an arbitrary odd integer; we’ll show that
n2 is odd as well.
What is the contrapositive of this statement?
We know that n is odd, which means there is an
integer k such
if n2that n =then
is even, 2k +n1.
is This
even.in turn tells
us that
n2 = (2k + 1)2
nIf
2
= 4kodd,
n is
2
k+1
+ 4then n2 is odd.
n2 = 2(2k2 + 2k) + 1.
From this, we see that there is an integer m
(namely, 2k2 + 2k) such that n2 = 2m + 1. That
means that n2 is odd, which is what we needed
to show. ■
Theorem: For any n ∈ ℤ, if n2 is even, then n is even.
Proof: We will prove the contrapositive of this
statement, that if n is odd, then n2 is odd. So let
n be an arbitrary odd integer; we’ll show that
n2 is odd as well.
Here, we're explicitly writing out the
contrapositive.
We know that This tells
n is odd, which the reader
means there is an
what that
integer k such we'rengoing
= 2kto+ prove.
1. ThisItinalso
turn tells
us that acts as a sanity check by forcing us
to write out 2what we think the
n = (2k + 1)
2
contrapositive is.
n = 4k + 4k + 1
2 2
n2 = 2(2k2 + 2k) + 1.
From this, we see that there is an integer m
(namely, 2k2 + 2k) such that n2 = 2m + 1. That
means that n2 is odd, which is what we needed
to show. ■
Theorem: For any n ∈ ℤ, if n2 is even, then n is even.
Proof: We will prove the contrapositive of this
statement, that if n is odd, then n2 is odd. So let
n be an arbitrary odd integer; we’ll show that
n2 is odd as well.
We know that n is odd, which means there is an
integer k such that n = 2k + 1. This in turn tells
us that
n2 = (2k + 1)2
n2 = 4k2 + 4k + 1
n2 = 2(2k2 + 2k) + 1.
From this, we see that there is an integer m
(namely, 2k2 + 2k) such that n2 = 2m + 1. That
means that n2 is odd, which is what we needed
to show. ■
Theorem: For any n ∈ ℤ, if n2 is even, then n is even.
Proof: We will prove the contrapositive of this
statement, that if n is odd, then n2 is odd. So let
n be an arbitrary odd integer; we’ll show that
n2 is odd as well.
The general pattern here is the following:
n2 = 4k2 + 4k + 1
2. Explicitly state the contrapositive of what
n2 = 2(2k2 + 2k) + 1.
we want to prove.
From this, we see that there is an integer m
(namely, 2k2 + 2 k ) such that n 2
= 2m + 1. That
3. Go prove the contrapositive.
means that n2 is odd, which is what we needed
to show. ■
Biconditionals
●
The previous theorem, combined with what we saw on
Wednesday, tells us the following:
For any integer n, if n is even, then n2 is even.
For any integer n, if n2 is even, then n is even.
●
These are two different implications, each going the
other way.
●
We use the phrase if and only if to indicate that two
statements imply one another.
●
For example, we might combine the two above
statements to say
for any integer n: n is even if and only if n2 is even.
Proving Biconditionals
●
To prove a theorem of the form
P if and only if Q,
you need to prove two separate statements.
●
First, that if P is true, then Q is true.
●
Second, that if Q is true, then P is true.
●
You can use any proof techniques you'd like
to show each of these statements.
●
In our case, we used a direct proof for one and
a proof by contrapositive for the other.
What We Learned
●
How do you negate formulas?
●
It depends on the formula. There are nice rules for how to
negate universal and existential statements and implications.
●
What's a proof by contradiction?
●
It's a proof of a statement P that works by showing that P
cannot be false.
●
What's an implication?
●
It's statement of the form “if P, then Q,” and states that if P is
true, then Q is true.
●
What is a proof by contrapositive?
●
It's a proof of an implication that instead proves its
contrapositive.
●
(The contrapositive of “if P, then Q” is “if not Q, then not P.”)
Your Action Items
●
Read “Guide to Office Hours,” the
“Proofwriting Checklist,” and the “Guide
to LaTeX.”
●
There’s a lot of useful information there. In
particular, be sure to read the Proofwriting
Checklist, as we’ll be working through this
checklist when grading your proofs!
●
Start working on PS1.
●
At a bare minimum, read over it to see what’s
being asked. That’ll give you time to turn things
over in your mind this weekend.
Next Time
●
Mathematical Logic
●
How do we formalize the reasoning from our
proofs?
●
Propositional Logic
●
Reasoning about simple statements.
●
Propositional Equivalences
●
Simplifying complex statements.
Appendix: Proving Implications by
Contradiction
Proving Implications
●
Suppose we want to prove this implication:
If P is true, then Q is true.
●
We have three options available to us:
●
Direct Proof:
Assume P is true, then prove Q is true.
●
Proof by Contrapositive.
Assume Q is false, then prove that P is false.
●
Proof by Contradiction.
… what does this look like?
Theorem: For any integer n, if n2 is even, then n is even.
Proof: Assume for the sake of contradiction that n is an
integer and that n2 is even, but that n is odd.
Since n is odd we know that there is an integer k such
that
n = 2k + 1 (1)
Squaring both sides of equation (1) and simplifying
givesWhat
the following:
is the negation of our theorem?
n2 = (2k + 1)2
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1 (2)
Equation (2) tells us that n2 is odd, which is impossible;
by assumption, n2 is even.
We have reached a contradiction, so our assumption
must have been incorrect. Thus if n is an integer and
n2 is even, n is even as well. ■
Theorem: For any integer n, if n2 is even, then n is even.
Proof: Assume for the sake of contradiction that there is
an integer n where n2 is even, but n is odd.
Since n is odd we know that there is an integer k such
that
n = 2k + 1 (1)
Squaring both sides of equation (1) and simplifying
gives the following:
n2 = (2k + 1)2
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1 (2)
Equation (2) tells us that n2 is odd, which is impossible;
by assumption, n2 is even.
We have reached a contradiction, so our assumption
must have been incorrect. Thus if n is an integer and
n2 is even, n is even as well. ■
Theorem: For any integer n, if n2 is even, then n is even.
Proof: Assume for the sake of contradiction that there is
an integer n where n2 is even, but n is odd.
Since n is odd we know that there is an integer k such
that
n = 2k + 1. (1)
Squaring both sides of equation (1) and simplifying
gives the following:
n2 = (2k + 1)2
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1. (2)
Equation (2) tells us that n2 is odd, which is impossible;
by assumption, n2 is even.
We have reached a contradiction, so our assumption
must have been incorrect. Thus if n is an integer and
n2 is even, n is even as well. ■
Theorem: For any integer n, if n2 is even, then n is even.
Proof: Assume for the sake of contradiction that there is
an integer n where n2 is even, but n is odd.
Since n is odd we know that there is an integer k such
that The three key pieces:
n = 2is
1. Say that the proof k+by1contradiction. (1)
2. Say what the negation of the original statement is.
Squaring both sides of equation (1) and simplifying
3. Saythe
gives you have reached a contradiction and what the
following:
contradiction entails.
n = (2k + 1)2
2