0% found this document useful (0 votes)
34 views104 pages

Lecture 2

Uploaded by

clkramer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views104 pages

Lecture 2

Uploaded by

clkramer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 104

Indirect Proofs

P ¬P ?
Logical Negation Proof by Contradiction

P Q

Q ¬Q ¬P

Logical Implication Proof by Contrapositive


Act I

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

is the existential statement

There is a P that is not a Q.


The negation of the universal statement

For all x, P(x) is true.

is the existential statement

There exists an x where P(x) is false.


“Some Friend Is Shorter Than Me”

Me
My Friends
The negation of the existential statement

There exists a P that is a Q

is the universal statement

Every P is not a Q.
The negation of the existential statement

There exists an x where P(x) is true

is the universal statement

For all x, P(x) is false.


Your Turn!

What’s the negation of the following
statement?
“Every brown dog
loves every orange cat.”

Answer:
“There is a brown dog
that doesn’t love
some orange cat”
P ¬P ?
Logical Negation Proof by Contradiction

P Q

Q ¬Q ¬P

Logical Implication Proof by Contrapositive


Act II

Proof by Contradiction
First, let’s reflect on the direct proof

technique we saw Wednesday.


Our First Proof! (from Wednesday)
Theorem: If n is an even integer, then n2 is even.
Proof: Assume n is an even integer. We want to
show that n² is even.
Since n is even, there is some integer k such
that n = 2k. This means that
n2 = (2k)2
= 4k2
= 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. ■
Our First Proof! (from Wednesday)
Theorem: If n is an even integer, then n2 is even.
Proof: Assume n is an even integer. We want to
show that n² is even.
Since n is even, there is some integer k such
that n = 2k. This means that
To prove
n = (2k)
2 2

= 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

is even, which is what we wanted to show. ■


Our First Proof! (from Wednesday)
Theorem: If n is an even integer, then n2 is even.
Proof: Assume n is an even integer. We want to
show that n² is even.
Since n is even, there is some integer k such
that n = 2k. This means that
n2 = (2k)2
If we apply sound logic (using
= 4k 2
definitions, 2algebra, etc.) all the
= 2(2k ).
statements that follow are also true.
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. ■
Our First Proof! (from Wednesday)
Theorem: If n is an even integer, then n2 is even.
Proof: Assume n isIfanweeven
applyinteger.
sound logic (usingto
We want
definitions, algebra, etc.) all the
show that n² is even.
statements that follow are also true.
Since n is even, there is some integer k such
that n = 2k. This means that
n2 = (2k)2
= 4k2
= 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. ■
Our First Proof! (from Wednesday)
Theorem: If n is an even integer, then n2 is even.
Proof: Assume n is an even integer. We want to
show that n² is even.
Since n is even, there is some integer k such
that n = 2k. This means that
If we apply sound logic (using
n2 =
definitions, algebra, (2k)all
etc.) 2
the
are4kalso true.
statements that follow =
2

= 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,

the process looks like this:


Direct Proof
We start with a statement (or statements)
we know (or assume) to be true.
Direct Proof
We start with a statement (or statements)
we know (or assume) to be true.

is e ven
n
Direct Proof

is e ven
n

Next, we apply sound logic and rational


argument to arrive at other true statements!
Direct Proof

n2 is even. ■ there is some k ∈ ℤ


such that n = 2k

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

Key Takeaway: When we apply sound logic


to true statements...
Direct Proof

Key Takeaway: When we apply sound logic


to true statements...

the process radiates truth with the power


and intensity of a thousand burning suns!
Okay, but…

what if we start with a proposition

whose truthiness is unknown to us?


s tr ue

?
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

??? bran muffins


are delicious
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

Our original assumption bran muffins


must be false! are delicious
This might radiate What does it mean
3 is even
SOME truth. if we start
generating
statements we
know are false?

i s tr ue P must
P
be false!

5 > 10 1=0

Our original assumption bran muffins


must be false! are delicious
This gives rise to a powerful proof

technique called proof by contradiction!


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

…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 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!

…and derive a statement


we know to be false.
Summary: Proof by Contradiction


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.

largest set. please include all these steps in your proofs!


In CS103,

We’ve reached a contradiction, so our


assumption must have been wrong. Therefore,
there is no largest set. ■
Another Example
Latin Squares

A Latin square is an n × n grid filled with the numbers
1, 2, …, n such that every number appears in each row
and each column exactly once.

The main diagonal of a Latin square runs from the
top-left corner to the bottom-right corner.

A Latin square is symmetric if the numbers are
symmetric across the 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
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)

Time-Out for Announcements!


Problem Set One

Problem Set One goes out today. It’s due
next Friday at 1:00PM.

Explore the language of set theory and
better intuit how it works.

Learn more about the structure of
mathematical proofs.

Write your first “freehand” proofs based on
your experiences.

As always, start early, and reach out if
you have any questions!
Office Hours

It is completely normal in this class to need to
get help from time to time.

Feel free to ask clarifying and conceptual
questions on EdStem.

Need more structured help? We have office hours!
Feel free to stop on by.

Check out the online “Guide to Office Hours” for more
information about how our office hours system works.

The OH calendar will soon be available on the course
website.

Office hours start this Sunday.
Vaccines!

It’s Vaccine Season! Yay! What a great way to protect
yourself and others. 😃

You can get a free flu shot through Vaden. Details are at
this link:
https://ehs.stanford.edu/flu/information

Stanford Health Care offers free bivalent COVID booster
vaccines. Use this link to create an account to sign up:
https://myhealth.stanfordhealthcare.org/

Santa Clara County (where Stanford is located) also
offers flu shots, COVID vaccines, and COVID boosters.
Details and appointments here:
https://vax.sccgov.org/
Readings for Today

On the course website we have some information
you should look over.

First is the Proofwriting Checklist. It contains
information about style expectations for proofs.
We’ll be using this when grading, so be sure to read
it over.

Next is the Guide to Office Hours, which talks
about how our office hours work and how to make
the most effective use of them.

Finally is the Guide to LaTeX, which explains how
to use LaTeX to typeset your problem sets in a way
that’s so beautiful it will bring tears to your eyes.
(the lights flash in the atrium)

Back to CS103!
P ¬P ?
Logical Negation Proof by Contradiction

P Q

Q ¬Q ¬P

Logical Implication Proof by Contrapositive


Act III

Logical Implication
If n is an even integer, then n2 is an even integer.

This part of the This part of the


implication is called implication is called
the antecedent. the consequent.

An implication is a statement of the form


“If P is true, then Q is true.”
If n is an even integer, then n2 is an even integer.

If m and n are odd integers, then m+n is even.

If you like the way you look that much,


then you should go and love yourself.

An implication is a statement of the form


“If P is true, then Q is true.”
If a flying pig bursts into the room and sings a
pitch-perfect version of the national anthem, then
Sean will throw cookies to the class.

Let’s explore the


definition and nature of
implication through this “If , then .”
example!

An implication is a statement of the form


“If P is true, then Q is true.”
What is the status of our
“if , then ” contract?

✅ ✅ contract is not violated ✅


✅ 🚫 contract is violated 😡

🚫 🚫 contract is not violated ✅

🚫 ✅ contract is not violated ✅


What is the status of our
“if , then ” contract?

This one often surprises people!


✅ ✅ contract is not violated
It’s part of our definition of

implication and diverges from
✅ 🚫 contractstatements
how conditional 😡
is violated work

in code.
🚫 🚫 contract is not violated ✅

🚫 ✅ contract is not violated ✅


What is the status of our
This one reveals how to “if , then ” contract?
negate an implication!

✅ ✅ contract is not violated ✅


✅ 🚫 contract is violated 😡

🚫 🚫 contract is not violated ✅


The only time “if P, then Q”

🚫 ✅
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.

Set of objects x where


P(x) is true.
If P isn't
true, Q may
Set of objects x where or may not be
Q(x) is true. true.
How do you negate an implication?

Consider once again the


“if , then ”
contract.

Question: What has to happen for this contract to be broken?

Answer: A flying pig sings the national anthem, but Sean


doesn’t throw cookies to the class.
What is the status of our
“if , then ” contract?

✅ ✅ contract is not violated ✅


✅ 🚫 contract is violated 😡

🚫 🚫 contract is not violated ✅

🚫 ✅ contract is not violated ✅


What is the status of our
“if , then ” contract?

✅ ✅ contract is not violated ✅


✅ 🚫 contract is violated 😡

🚫 🚫 contract is not violated ✅

🚫 ✅ contract is not violated ✅


Key take-away!

The negation of the statement


“For any x, if P(x) is true,
then Q(x) is true”
is the statement
“There is at least one x where
P(x) is true and Q(x) is false.”

The negation of an implication


is not an implication!
Key take-away!

The negation of the statement


“For any x, if P(x) is true,
then Q(x) is true”
is the statement
“There is at least one x where
P(x) is true and Q(x) is false.”

The negation of an implication


is not an implication!
If p is a puppy, It’s If p is a puppy,
then I do love p! complicated. then I don’t love p!

🐕 ❤ 🐕❤ 🐕 ❤
How to Negate Universal Statements:
“For all x, P(x) is true”
becomes
“There is an x where P(x) is false.”

How to Negate Existential Statements:


“There exists an x where P(x) is true”
becomes
“For all x, P(x) is false.”

How to Negate Implications:


“For every x, if P(x) is true, then Q(x) is true”
becomes
“There is an x where P(x) is true and Q(x) is false.”
P ¬P ?
Logical Negation Proof by Contradiction

P Q

Q ¬Q ¬P

Logical Implication Proof by Contrapositive


Act IV

Proof by Contrapositive
Anything inside this Anything outside this
inner bubble is also outer bubble is
inside the outer outside the inner
bubble. bubble.

Times where Times where


P is true Q is true

If P is true, then Q is true.


If Q is false, then P is false.
The Contrapositive

The contrapositive of the implication
If P is true, then Q is true
is the implication
If Q is false, then P is false.

The contrapositive of an implication means
exactly the same thing as the implication itself.

If it’s a puppy, then I love it.

If I don’t love it, then it’s not a puppy.


The Contrapositive

The contrapositive of the implication
If P is true, then Q is true
is the implication
If Q is false, then P is false.

The contrapositive of an implication means
exactly the same thing as the implication itself.

If I store cat food inside, then raccoons won’t steal it.

If raccoons stole the cat food, then I didn’t store it inside.


To prove the statement
“if P is true, then Q is true,”
you can choose to instead prove the
equivalent statement
“if Q is false, then P is false,”
if that seems easier.

This is called a proof by contrapositive.


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,This is a courtesy to the
which means there is an
reader
integer k such that n = 2k +and says “heads
1. This in turnup!
tells
us that we’re not going to do a
regular old-fashioned direct
n = (2k + 1)2
2
proof here.”
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.
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:

We know that n is odd, which means there is an


1. Start
integer k such bynannouncing
that = 2k + 1. that
Thiswe're going
in turn tellsto
us that use a proof by contrapositive so that the
reader knows what to expect.
n = (2k + 1)
2 2

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

In CS103, please include k2 +


= 4all 4k +steps
these 1 in your proofs!
= 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. ■
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.
Assume P is true and Q is false,
then derive a contradiction.

You might also like