Docsity

Mathematical Proofs - Lecture Notes | CECS 328, Exams of Discrete Structures and Graph Theory

Toggle sidebar
bg1
Lecture 3: Mathematical Proofs
As a computer scientist it is not enough to dream up an algorithm and verify that it works
for your favorite test cases. Mathematical proof is what converts today’s intellectual gossip,
speculation, and heresy into tomorrow’s textbook subject. In short, “you have not shown me
anything until you’ve proved it.” For this class, proofs come in handy for three important
reasons:
•algorithm correctness: proving that an algorithm does what one claims.
•algorithm complexity: assuming that an algorithm is correct, one must then prove
that it runs efficiently to be of any practical use.
•applications: when applying an algorithm to a specific problem, one must prove that
the algorithm is appropriate for that problem. This may involve some analysis, and
hence proof.
Proof strategies:
Name of Strategy Goal Strategy
Direct proof prove p→qassume p, show q
Indirect proof prove p→qassume ¬q, show ¬p
Proof by contradiction prove p→qassume ¬q, p, show a contradiction
Proof by cases prove p1∨ · · · ∨ pn→q∀i∈ {1, . . . , n}prove pi→q
Counterexample prove p→qshow by example that qis false
1
pf3
pf4
pf5

Partial preview of the text

Download Mathematical Proofs - Lecture Notes | CECS 328 and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

Lecture 3: Mathematical Proofs

As a computer scientist it is not enough to dream up an algorithm and verify that it works for your favorite test cases. Mathematical proof is what converts today’s intellectual gossip, speculation, and heresy into tomorrow’s textbook subject. In short, “you have not shown me anything until you’ve proved it.” For this class, proofs come in handy for three important reasons:

  • algorithm correctness: proving that an algorithm does what one claims.
  • algorithm complexity: assuming that an algorithm is correct, one must then prove that it runs efficiently to be of any practical use.
  • applications: when applying an algorithm to a specific problem, one must prove that the algorithm is appropriate for that problem. This may involve some analysis, and hence proof.

Proof strategies:

Name of Strategy Goal Strategy Direct proof prove p → q assume p, show q Indirect proof prove p → q assume ¬q, show ¬p Proof by contradiction prove p → q assume ¬q, p, show a contradiction Proof by cases prove p 1 ∨ · · · ∨ pn → q ∀i ∈ { 1 ,... , n} prove pi → q Counterexample prove p → q show by example that q is false

Example 1. Recall the linear-search algorithm from Example 1 of Lecture 2. By examining the code, give both a direct and indirect proof of the following statement: “If x is a member of array a[], then the algorithm returns “true”.

Example 2. Prove by cases that the linear-search algorithm from Example 1 of Lecture 2 is correct.

Mathematical Induction

  • Goal: prove that statement P (n) is true ∀n ∈ N
  • Basis Step: prove that P (0) is true.
  • Induction Step: assume there exists an n such that P (n) is true. Show that P (n + 1) is true.

A proof by induction is analogous to knocking over a row of dominoes by pushing over the fist dominoe in the row.

Example 5. Use mathematical induction to prove that

1 + 2 + · · · + n =

n(n + 1) 2

Example 6. Use mathematical induction to prove that n! > 2 n^ for n ≥ 4

Example 7. Determine which amounts of postage can be formed using just 5-cent and 6-cent stamps. Prove your answer using math induction.

Example 8. For nonnegative integers x and y with x < y, prove that

x ≤

x + y 3

≤ y.