CSE373: Data Structures and Algorithms Lecture 2b: Proof by Induction and Powers of Two Nicki Dell Spring 2014.

Slides:



Advertisements
Similar presentations
Mathematical Induction (cont.)
Advertisements

1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis Tyler Robison Summer
CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis Dan Grossman Spring 2010.
Self-Reference - Induction Cmput Lecture 7 Department of Computing Science University of Alberta ©Duane Szafron 1999 Some code in this lecture is.
1 Intro to Induction Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Discrete Structures Chapter 5: Sequences, Mathematical Induction, and Recursion 5.2 Mathematical Induction I [Mathematical induction is] the standard proof.
Lecture 4 Discrete Mathematics Harper Langston. Algorithms Algorithm is step-by-step method for performing some action Cost of statements execution –Simple.
1 Strong Mathematical Induction. Principle of Strong Mathematical Induction Let P(n) be a predicate defined for integers n; a and b be fixed integers.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Mathematical Maxims and Minims, 1988
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Chapter 6 Mathematical Induction
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
CSNB143 – Discrete Structure Topic 5 – Induction Part I.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction & Algorithm Analysis Lauren Milne Summer 2015.
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
9.4 Mathematical Induction
Lecture 4,5 Mathematical Induction and Fibonacci Sequences.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Nicki Dell Spring 2014.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
Methods of Proof Dr. Yasir Ali. Proof A (logical) proof of a statement is a finite sequence of statements (called the steps of the proof) leading from.
October 3, 2001CSE 373, Autumn Mathematical Background Exponents X A X B = X A+B X A / X B = X A-B (X A ) B = X AB X N +X N = 2X N 2 N +2 N = 2 N+1.
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction Linda Shapiro Winter 2015.
Mathematical Induction
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Section 2.3 Mathematical Induction. First Example Investigate the sum of the first n positive odd integers. 1= ____ 1 + 3= ____ = ____
Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach a particular.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
INDUCTION David Kauchak CS52 – Spring to-1 multiplexer control control_negate and_out1 input0 input1 and_out2 output.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Winter 2015.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Mathematical Induction EECS 203: Discrete Mathematics Lecture 11 Spring
Mathematical Induction I Lecture 19 Section 4.2 Mon, Feb 14, 2005.
Mathematical Induction. The Principle of Mathematical Induction Let S n be a statement involving the positive integer n. If 1.S 1 is true, and 2.the truth.
CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis Kevin Quinn Fall 2015.
Instructor: Lilian de Greef Quarter: Summer 2017
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015.
CSE 311 Foundations of Computing I
Induction and recursion
CSE 311: Foundations of Computing
Methods of Proof A mathematical theorem is usually of the form pq
Proofs, Recursion and Analysis of Algorithms
Instructor: Lilian de Greef Quarter: Summer 2017
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction
CSE373: Data Structures and Algorithms Lecture 2: Proof by Induction
CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis Dan Grossman Fall 2013.
Notes 9.5 – Mathematical Induction
CSE 311: Foundations of Computing
Exercise Use mathematical induction to prove the following formula.
Follow me for a walk through...
CSE 373 Data Structures and Algorithms
Lesson 11 – Proof by induction
Mathematical Induction I
CSE 373: Data Structures & Algorithms
Mathematical Induction
Sullivan Algebra and Trigonometry: Section 13.4
Follow me for a walk through...
Induction Chapter
Advanced Analysis of Algorithms
Mathematical Induction
Mathematical Induction
Mathematical Induction
Follow me for a walk through...
Copyright © Cengage Learning. All rights reserved.
11.4 Mathematical Induction
Chapter 1 Automata CE year IV.
Presentation transcript:

CSE373: Data Structures and Algorithms Lecture 2b: Proof by Induction and Powers of Two Nicki Dell Spring 2014

Mathematical induction Suppose P(n) is some statement (mentioning integer n) Example: n ≥ n/2 + 1 We can use induction to prove P(n) for all integers n ≥ n 0. We need to 1.Prove the “base case” i.e. P(n 0 ). For us n 0 is usually 1. 2.Assume the statement holds for P(k). 3.Prove the “inductive case” i.e. if P(k) is true, then P(k+1) is true. Why we will care: To show an algorithm is correct or has a certain running time no matter how big a data structure or input value is (Our “n” will be the data structure or input size.) Spring CSE373: Data Structures & Algorithms

Example P(n) = “the sum of the first n powers of 2 (starting at 0) is 2 n -1” Theorem: P(n) holds for all n ≥ 1 Proof: By induction on n Base case: n=1. Sum of first 1 power of 2 is 2 0, which equals 1. And for n=1, 2 n -1 equals 1. Inductive case: – Assume the sum of the first k powers of 2 is 2 k -1 – Show the sum of the first (k+1) powers of 2 is 2 k+1 -1 Using assumption, sum of the first (k+1) powers of 2 is (2 k -1) + 2 (k+1)-1 = (2 k -1) + 2 k = 2 k+1 -1 Spring CSE373: Data Structures & Algorithms

Example n1234 sum of first n powers of = = = = 15 P(n) = 1 Spring CSE373: Data Structures & Algorithms

Example n1234 sum of first n powers of = = = = 15 P(n) = = 3 Spring CSE373: Data Structures & Algorithms

Example n1234 sum of first n powers of = = = = 15 P(n) = = = 7 Spring CSE373: Data Structures & Algorithms

Example n1234 … sum of first n powers of = = = = 15 P(n) = = = = 15 Spring CSE373: Data Structures & Algorithms

Powers of 2 A bit is 0 or 1 (just two different “letters” or “symbols”) A sequence of n bits can represent 2 n distinct things – For example, the numbers 0 through 2 n is 1024 (“about a thousand”, kilo in CSE speak) 2 20 is “about a million”, mega in CSE speak 2 30 is “about a billion”, giga in CSE speak Java: an int is 32 bits and signed, so “max int” is “about 2 billion” a long is 64 bits and signed, so “max long” is Spring CSE373: Data Structures & Algorithms

Therefore… Could give a unique id to… Every person in the U.S. with 29 bits Every person in the world with 33 bits Every person to have ever lived with 38 bits (estimate) Every atom in the universe with bits So if a password is 128 bits long and randomly generated, do you think you could guess it? Spring CSE373: Data Structures & Algorithms