Mathematical Proofs And how they are applied to Computer Olympiads.

Slides:



Advertisements
Similar presentations
PROOF BY CONTRADICTION
Advertisements

Greedy Algorithms.
Introduction to Algorithms Greedy Algorithms
The Greedy Method1. 2 Outline and Reading The Greedy Method Technique (§5.1) Fractional Knapsack Problem (§5.1.1) Task Scheduling (§5.1.2) Minimum Spanning.
Chapter 5 Fundamental Algorithm Design Techniques.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Minimum Spanning Trees
Basic properties of the integers
Induction Lecture 5: Sep 21 (chapter of the book and chapter of the notes)
Greedy Algorithms Basic idea Connection to dynamic programming Proof Techniques.
More Number Theory Proofs Rosen 1.5, 3.1. Prove or Disprove If m and n are even integers, then mn is divisible by 4. The sum of two odd integers is odd.
1 Greedy Algorithms. 2 2 A short list of categories Algorithm types we will consider include: Simple recursive algorithms Backtracking algorithms Divide.
CSE115/ENGR160 Discrete Mathematics 03/03/11 Ming-Hsuan Yang UC Merced 1.
1 Intro to Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
Methods of Proof Lecture 4: Sep 16 (chapter 3 of the book)
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
ELEMENTARY NUMBER THEORY AND METHODS OF PROOF
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Lecture 23. Greedy Algorithms
Introduction to Proofs
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
Advance Data Structure and Algorithm COSC600 Dr. Yanggon Kim Chapter 1.
1 Methods of Proof CS/APMA 202 Epp, chapter 3 Aaron Bloomfield.
Ch 1.5: Basic Proof Methods II Proof by Contraposition of P => Q Suppose ~Q …proof details here…. Therefore, ~P (via a direct proof) Thus, ~Q => ~P. Therefore,
Methods of Proof. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical theorems. Direct.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Sets.
CSC201 Analysis and Design of Algorithms Asst.Proof.Dr.Surasak Mungsing Oct-151 Lecture 2: Definition of algorithm and Mathematical.
Methods of Proofs PREDICATE LOGIC The “Quantifiers” and are known as predicate quantifiers. " means for all and means there exists. Example 1: If we.
Discrete Mathematics Tutorial 11 Chin
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
Chapter 5 Existence and Proof by contradiction
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
Theorems and conjectures
CSCI 256 Data Structures and Algorithm Analysis Lecture 6 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Week 4 - Monday.  What did we talk about last time?  Divisibility  Quotient-remainder theorem  Proof by cases.
Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.
Dynamic Programming.  Decomposes a problem into a series of sub- problems  Builds up correct solutions to larger and larger sub- problems  Examples.
Inverse, Contrapositive & indirect proofs Sections 6.2/6.3.
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
Copyright © Cengage Learning. All rights reserved. Sequences and Series.
Introduction to Proofs
EMIS 8374 Shortest Path Trees Updated 11 February 2008 Slide 1.
5.1 Indirect Proof Objective: After studying this section, you will be able to write indirect proofs.
Week 4 - Wednesday.  What did we talk about last time?  Divisibility  Proof by cases.
Mathematical Induction I Lecture 5: Sep 20 (chapter of the textbook and chapter of the course notes)
Section 1.7. Definitions A theorem is a statement that can be shown to be true using: definitions other theorems axioms (statements which are given as.
5-5 Indirect Proof. Indirect Reasoning: all possibilities are considered and then all but one are proved false. The remaining possibility must be true.
Activity 1-12 : Multiple-free sets
EXAMPLE 3 Write an indirect proof Write an indirect proof that an odd number is not divisible by 4. GIVEN : x is an odd number. PROVE : x is not divisible.
Methods of Proof Lecture 4: Sep 20 (chapter 3 of the book, except 3.5 and 3.8)
Identities, Contradictions and Conditional Equations.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Greedy Algorithms.
Greedy Algorithms Alexandra Stefan.
Indirect Argument: Two Classical Theorems
Advanced Algorithms Analysis and Design
Predicate Calculus Validity
Presented by Po-Chuan & Chen-Chen 2016/03/08
Lecture 9 Greedy Strategy
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept 24, 25.
Greedy Algorithms Alexandra Stefan.
Elementary Number Theory & Proofs
Richard Anderson Lecture 10 Minimum Spanning Trees
Induction Chapter
Advanced Analysis of Algorithms
Induction Rosen 5 Lecture 8: Oct 29, 30.
Chapter 5 Parallel Lines and Related Figures
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept, 2019.
Presentation transcript:

Mathematical Proofs And how they are applied to Computer Olympiads

Counter Example Can ONLY be used to DISPROVE a proposition, NEVER to PROVE it, by not being able to find one! You have to prove there is no counter example, for it to prove the proposition.

Proof by contradiction Assume that the given proposition is untrue. Based on that assumption reach a statement that is impossible. Thus the assumption is false. Hence the proposition must be true. Basic idea: You want to prove a proposition true.

Example 1 Prove there is no largest prime, i.e. there are an infinite amount of them. Proof by contradiction: Assume there are not infinitely many primes Call them: p 1, p 2, p 3, p 4 …p n Consider the number x = p 1 *p 2 *p 3 *p 4 …*p n + 1 x is clearly not prime because since it does not equal p 1, p 2, p 3, p 4 …p n Known Fact: Any number has a prime devisor

Thus x has a prime devisor p k But we have that p 1, p 2, p 3, p 4 …p n do not divide x Thus we have another prime p k not equal to p 1, p 2, p 3, p 4 …p n But we assumed p 1, p 2, p 3, p 4 …p n are all the primes Thus a contradiction and we have proved there are infinitely many primes and hence no largest prime.

Example 2 Grand Central Taxi Rank (2008 Camp 2 day 2) You are given a weighted spanning tree. Find the node that minimises the maximum distance to any other node.

Example 3 Making Change (Online Camp 2008) You are given a coin system: c 1, c 2, c 3, c 4 …c n There is a “Greedy” method to make any amount. Find if greedy algorithm is optimal i.e. do you use the minimal amount of coins. If not, give the smallest amount for witch it is not optimal. Small Example: coins 1, 2, 4, 5 and you want to make 8 Greedy: = 8 Optimal: = 8 Thus greedy is not optimal

Solution to Making Change We need to find the smallest value for which the greedy solution is not optimal or prove that the greedy solution is always optimal. Thus test all amounts up to a certain point x.

Greedy method: For any given amount A, take the largest coin, C, that is smaller than that amount. Repeat for A = A-C until A=0. This method is guaranteed to work if you have a coin with value 1.

DP Method: for i from 1 to x://x is the point where we stop testing num[i] = 0 for i from 1 to x: for j from 0 to n-1://m is amount of coins if coin[j] > i: break num[i] = min(num[i], num[i – coins[j]] + 1)

Suppose we have a coin system where a greedy solution is not optimal. The smallest value for this coin system for which the greedy method is non optimal is x. Assume x > 2m, where m is the biggest coin.

minCoin[x] = k and greed[x] = g where k < g. We use a certain coin, call it d, in the optimal method to make x Consider amount x-d, we have minCoin[x-d] = k-1 Since x > 2m we have x-d > m. Since x-d < x the greedy method for x-d is optimal. The greedy method to make value x-d will use coin m Since we obtain value x from (x-d) +d we have the optimal solution for x contains coin m Thus we use coin m in the optimal strategy to make x-d and we will use m in the optimal strategy to make value x.

Proof by contradiction continued Thus minCoin[x-m] = k-1 The greedy solution for x also contains m. Thus greed[x-m] = g -1 Then we have k-1 = g-1 Thus contradiction Thus x <= 2m