Discrete Mathematics Lecture 4 Alexander Bukharovich New York University.

Slides:



Advertisements
Similar presentations
Sequences and Mathematical Induction
Advertisements

Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Week 5 - Friday.  What did we talk about last time?  Sequences  Summation and production notation  Proof by induction.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Induction and recursion
Discrete Mathematics Lecture 4: Sequences and Mathematical Induction
Discrete Structures Chapter 2 Part A Sequences Nurul Amelina Nasharuddin Multimedia Department.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Chapter 4 Mathematical Induction Used to verify a property of a sequence 2,4,6,8,… for i >= 1 a i = 2i –infinite sequence with infinite distinct values.
© Love Ekenberg The Algorithm Concept, Big O Notation, and Program Verification Love Ekenberg.
Discrete Structures Chapter 2 Part B Mathematical Induction
CMSC 250 Discrete Structures Summation: Sequences and Mathematical Induction.
Inductive Proofs Must Have Base Case (value): –where you prove it is true about the base case Inductive Hypothesis (value): –where you state what will.
1 Sequences and Mathematical Induction An important task of mathematics is to discover and characterize regular patterns, such as those associated with.
Chapter 5: Sequences, Mathematical Induction and Recursion
Lecture 4 Discrete Mathematics Harper Langston. Algorithms Algorithm is step-by-step method for performing some action Cost of statements execution –Simple.
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
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.
Induction and recursion
Geometric Sequences and Series
Copyright © Cengage Learning. All rights reserved. CHAPTER 11 ANALYSIS OF ALGORITHM EFFICIENCY ANALYSIS OF ALGORITHM EFFICIENCY.
Mathematical Maxims and Minims, 1988
1 © 2010 Pearson Education, Inc. All rights reserved 10.1 DEFINITION OF A SEQUENCE An infinite sequence is a function whose domain is the set of positive.
Sequences Informally, a sequence is a set of elements written in a row. – This concept is represented in CS using one- dimensional arrays The goal of mathematics.
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Discrete Mathematics, 1st Edition Kevin Ferland
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
Week 5 - Wednesday.  What did we talk about last time?  Exam 1!
4.7 Define & Use Sequences & Series. Vocabulary  A sequence is a function whose domain is a set of consecutive integers. If not specified, the domain.
Application: Correctness of Algorithms Lecture 22 Section 4.5 Fri, Mar 3, 2006.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.5 Application: Correctness of Algorithms 1 [P]rogramming reliability – must be an activity.
Chapter 11 Sequences, Induction, and Probability Copyright © 2014, 2010, 2007 Pearson Education, Inc Sequences and Summation Notation.
Application: Correctness of Algorithms Lecture 22 Section 4.5 Fri, Feb 18, 2005.
Section 3.3: Mathematical Induction Mathematical induction is a proof technique that can be used to prove theorems of the form:  n  Z +,P(n) We have.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
(CSC 102) Lecture 23 Discrete Structures. Previous Lecture Summery  Sequences  Alternating Sequence  Summation Notation  Product Notation  Properties.
1, Mustafa Jarrar Lecture Notes on Sequences & Mathematical Induction. Birzeit University, Palestine, 2015 mjarrar©2015 Sequences & Mathematical Induction.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Mathematical Induction 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.
1 CMSC 250 Chapter 4, Summations and Products. 2 CMSC 250 Induction l Induction is a proof technique used to verify a property of a sequence –2,4,6,8,…
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5. 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.
1 Computer Algorithms Tutorial 2 Mathematical Induction Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Lecture # 20 Sequence & Series
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
3.3 Mathematical Induction 1 Follow me for a walk through...
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
CS151: Mathematical Foundations of Computing Mathematical Induction.
Arithmetic Sequences and Series
Discrete Mathematics Lecture 6
Discrete Mathematics Lecture 7
The sum of the infinite and finite geometric sequence
Advanced Algorithms Analysis and Design
Induction and recursion
Sect.R10 Geometric Sequences and Series
Mathematical Induction Recursion
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
CS201: Data Structures and Discrete Mathematics I
Exercise Use mathematical induction to prove the following formula.
Applied Discrete Mathematics Week 9: Integer Properties
Advanced Analysis of Algorithms
Copyright © Cengage Learning. All rights reserved.
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Recursion.
Presentation transcript:

Discrete Mathematics Lecture 4 Alexander Bukharovich New York University

Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2, …, a n, … Each individual element a k is called a term, where k is called an index Sequences can be computed using an explicit formula: a k = k * (k + 1) for k > 1 Alternate sign sequences Finding an explicit formula given initial terms of the sequence: 1, -1/4, 1/9, -1/16, 1/25, -1/36, … Sequence is (most often) represented in a computer program as a single-dimensional array

Sequence Operations Summation: , expanded form, limits (lower, upper) of summation, dummy index Telescoping summation:  1/(k * (k + 1)) Change of index inside summation Product: , expanded form, limits (lower, upper) of product, dummy index Factorial: n!, n! = n * (n – 1)!

Exercises Consider the sequence defined by a n = (2n + (-1) n – 1) / 4 Find an alternative formula for a n that uses floor notation Show that n! + k is divisible by k for all integers k no greater than n. Given any integer m greater than 1, is it possible to find a sequence of m – 1 consecutive positive integers none of which is prime?

Mathematical Induction Can we represent any amount greater than 3 cents as a combination of 2 and 5 cents? Principle of Mathematical Induction: Let P(n) be a predicate that is defined for integers n and let a be some integer. If the following two premises are true: P(a) is a true  k  a, P(k)  P(k + 1) then the following conclusion is true as well P(n) is true for all n  a

Applications of Mathematical Induction Show that … + n = n * (n + 1) / 2 Sum of geometric series: r 0 + r 1 + … + r n = (r n+1 – 1) / (r – 1)

Exercises I Show that  i(i!) = (n + 1)! – 1 Show that sinx + sin3x + … + sin(2n – 1)x = (1 – cos2nx)/2sinx Find sum of an algebraic series

Exercises II Show that 2 2n – 1 is divisible by 3 Show that 2n + 1 < 2 n Show that x n – y n is divisible by x – y Show that n 3 – n is divisible by 6 On the outside rim of a circular disk the integers from 1 to 30 are painted in random. Show that there must be three successive integers whose sum is at least 45 John and Sarah gave a party that was attended by n married couples. As guests arrived, some shook hands with host, hostess and other guests (but not themselves and their spouses). It turned out that all guests (except John) shook hands with a different number of people. How many hands did Sarah shake?

Strong Mathematical Induction and Well-Ordering Principle Utilization of predicates P(a), P(a + 1), …, P(n) to show P(n + 1). Any integer greater than 1 is divisible by a prime Existence and Uniqueness of binary integer representation Well-ordering principle for integers: a set of integers that are bounded from below contains the least element Existence of quotient-remainder representation of an integer n against integer d

Exercises Show that for any integers a and b there exist two integer u and v so that gcd(a, b) = ua + vb Show that every integer greater than 1 is divisible by a prime number

Correctness of Algorithms Assertions –Pre-condition is a predicate describing initial state before an algorithm is executed –Post-condition is a predicate describing final state after an algorithm is executed Loop guard Loop is defined as correct with respect to its pre- and post- conditions, if whenever the algorithm variables satisfy the pre-conditions and the loop is executed, then the algorithm satisfies the post- conditions as well

Loop Invariant Theorem Let a while loop with guard G be given together with its pre- and post- conditions. Let predicate I(n) describing loop invariant be given. If the following 4 properties hold, then the loop is correct: –Basis Property: I(0) is true before the first iteration of the loop –Inductive Property: If G and I(k) is true, then I(k + 1) is true –Eventual Falsity of the Guard: After finite number of iterations, G becomes false –Correctness of the Post-condition: If N is the least number of iterations after which G becomes false and I(N) is true, then post- conditions are true as well

Correctness of Some Algorithms Product Algorithm: pre-conditions: m  0, i = 0, product = 0 while (i < m) { product += x; i++; } post-condition: product = m * x

Correctness of Some Algorithms Division Algorithm pre-conditions: a  0, d > 0, r = a, q = 0 while (r  d) { r -= d; q++; } post-conditions: a = q * d + r, 0  r < d

Correctness of Some Algorithms Euclidean Algorithm pre-conditions: a > b  0, r = b while (b > 0) { r = a mod b; a = b; b = r; } post-condition: a = gcd(a, b)