Discrete Mathematics Lecture 4. Harper Langston New York University

Similar documents
CSC Discrete Math I, Spring Sets

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

CSE 215: Foundations of Computer Science Recitation Exercises Set #9 Stony Brook University. Name: ID#: Section #: Score: / 4

Chapter 3. Set Theory. 3.1 What is a Set?

Summary of Course Coverage

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

DISCRETE MATHEMATICS

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Integers and Mathematical Induction

Math Introduction to Advanced Mathematics

1 Elementary number theory

Introduction to Sets and Logic (MATH 1190)

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Winter


Review of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

2.1 Sets 2.2 Set Operations

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

CSE 20 DISCRETE MATH WINTER

2 Review of Set Theory

COMP Logic for Computer Scientists. Lecture 17

r=1 The Binomial Theorem. 4 MA095/98G Revision

9.5 Equivalence Relations

1.1 - Introduction to Sets

Discrete Mathematics

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

Lectures on Order and Topology

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

CS100: DISCRETE STRUCTURES

Interpretations and Models. Chapter Axiomatic Systems and Incidence Geometry

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Fall

1 Elementary number theory

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Sets. Mukulika Ghosh. Fall Based on slides by Dr. Hyunyoung Lee

Relational Database: The Relational Data Model; Operations on Database Relations

11 Sets II Operations

Today s Topics. What is a set?

Scan Scheduling Specification and Analysis

c) the set of students at your school who either are sophomores or are taking discrete mathematics

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

Mathematical Induction

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

Logic and Discrete Mathematics. Section 2.5 Equivalence relations and partitions

Introduction II. Sets. Terminology III. Definition. Definition. Definition. Example

A Survey of Mathematics with Applications 8 th Edition, 2009

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Lecture 1. 1 Notation

Ch 3.4 The Integers and Division

Section 6.3: Further Rules for Counting Sets

CSC 501 Semantics of Programming Languages

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Introduction to Programming in C Department of Computer Science and Engineering\ Lecture No. #02 Introduction: GCD

SETS. Sets are of two sorts: finite infinite A system of sets is a set, whose elements are again sets.

THEORY OF COMPUTATION

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

Set and Set Operations

Mathematically Rigorous Software Design Review of mathematical prerequisites

Characterization of Boolean Topological Logics

Discrete Mathematics SECOND EDITION OXFORD UNIVERSITY PRESS. Norman L. Biggs. Professor of Mathematics London School of Economics University of London

Solutions to the Second Midterm Exam

On the packing chromatic number of some lattices

About the Author. Dependency Chart. Chapter 1: Logic and Sets 1. Chapter 2: Relations and Functions, Boolean Algebra, and Circuit Design

(d) If the moon shares nothing and the sun does not share our works, then the earth is alive with creeping men.

Final Test in MAT 410: Introduction to Topology Answers to the Test Questions

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

CMSC Honors Discrete Mathematics

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Sets and set operations

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Discrete Mathematics

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

UNIT-II NUMBER THEORY

Introductory logic and sets for Computer scientists

Lecture 6,

Sets. {1, 2, 3, Calvin}.

1 Sets, Fields, and Events

A.1 Numbers, Sets and Arithmetic

Discrete mathematics , Fall Instructor: prof. János Pach

LATIN SQUARES AND TRANSVERSAL DESIGNS

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Content Development for Distance Education in Advanced University Mathematics Using Mizar

Lecture 15: The subspace topology, Closed sets

Assertions & Verification & Example Loop Invariants Example Exam Questions

Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube

1. [5 points each] True or False. If the question is currently open, write O or Open.

MA651 Topology. Lecture 4. Topological spaces 2

Topology notes. Basic Definitions and Properties.

Sets. Margaret M. Fleck. 15 September 2010

3. According to universal addressing, what is the address of vertex d? 4. According to universal addressing, what is the address of vertex f?

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

Cantor s Diagonal Argument for Different Levels of Infinity

Transcription:

Discrete Mathematics Lecture 4 Harper Langston 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 Change of index inside summation Product: Π, expanded form, limits (lower, upper) of product, dummy index Factorial: n!, n! = n * (n 1)!

Review Mathematical Induction 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 1 + 2 + + n = n * (n + 1) / 2 (Prove on board) Sum of geometric series: r 0 + r 1 + + r n = (r n+1 1) / (r 1) (Prove on board)

Examples that Can be Proved with Mathematical Induction Show that 2 2n 1 is divisible by 3 (in book) Show (on board) that for n > 2: 2n + 1 < 2 n Show that x n y n is divisible by x y Show that n 3 n is divisible by 6 (similar to book problem)

Strong Mathematical Induction Utilization of predicates P(a), P(a + 1),, P(n) to show P(n + 1). Variation of normal M.I., but basis may contain several proofs and in assumption, truth assumed for all values through from base to k. Examples: Any integer greater than 1 is divisible by a prime Existence and Uniqueness of binary integer representation (Read in book)

Well-Ordering Principle Well-ordering principle for integers: a set of integers that are bounded from below (all elements are greater than a fixed integer) contains a least element Example: Existence of quotient-remainder representation of an integer n against integer d

Stepping back: Algorithms Last lecture we talked about some elementary number theory such as the Quotient Remainder Theorem (pg 157) Algorithm is step-by-step method for performing some action (such as finding remainder in Q.R.) Cost of statements execution Simple statements Conditional statements Iterative statements

Example: Division Algorithm Input: integers a and d Output: quotient q and remainder r Body: r = a; q = 0; while (r >= d) r = r d; q = q + 1; end while

Greatest Common Divisor The greatest common divisor of two integers a and b is another integer d with the following two properties: d a and d b if c a and c b, then c d Lemma 1: gcd(r, 0) = r Lemma 2: if a = b * q + r, then gcd(a, b) = gcd(b, r)

Euclidean Algorithm Input: integers a and b (a>b>=0) Output: greatest common divisor gcd Body: r = b; while (b > 0) r = a mod b; a = b; b = r; end while gcd = a;

Exercise Least common multiple: lcm Prove that for all positive integers a and b, gcd(a, b) = lcm(a, b) iff a = b

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 preand 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 Division Algorithm Algorithms 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 Euclidean Algorithm Algorithms pre-conditions: a > b 0, r = b while (b > 0) { } r = a mod b; a = b; b = r; post-condition: a = gcd(a, b)

Basics of Set Theory Set and element are undefined notions in the set theory and are taken for granted Set notation: {1, 2, 3}, {{1, 2}, {3}, {1, 2, 3}}, {1, 2, 3, },, {x R -3 < x < 6} Set A is called a subset of set B, written as A B, when x, x A x B. What is negation? A is a proper subset of B, when A is a subset of B and x B and x A Visual representation of the sets Distinction between and

Set Operations Set a equals set B, iff every element of set A is in set B and vice versa. (A = B A B /\ B A) Proof technique for showing sets equality (example) Union of two sets is a set of all elements that belong to at least one of the sets (notation on board) Intersection of two sets is a set of all elements that belong to both sets (notation on board) Difference of two sets is a set of elements in one set, but not the other (notation on board) Complement of a set is a difference between universal set and a given set (notation on board) Examples

Empty Set S = {x R, x 2 = -1} X = {1, 3}, Y = {2, 4}, C = X Y (X and Y are disjoint) Empty set has no elements Empty set is a subset of any set There is exactly one empty set Properties of empty set: A = A, A = A A c =, A A c = U U c =, c = U

Set Partitioning Two sets are called disjoint if they have no elements in common Theorem: A B and B are disjoint A collection of sets A 1, A 2,, A n is called mutually disjoint when any pair of sets from this collection is disjoint A collection of non-empty sets {A 1, A 2,, A n } is called a partition of a set A when the union of these sets is A and this collection consists of mutually disjoint sets

Power Set Power set of A is the set of all subsets of A Example on board Theorem: if A B, then P(A) P(B) Theorem: If set X has n elements, then P(X) has 2 n elements (proof in Section 5.3 will show if have time)

Cartesian Products Ordered n-tuple is a set of ordered n elements. Equality of n-tuples Cartesian product of n sets is a set of n- tuples, where each element in the n-tuple belongs to the respective set participating in the product

Set Properties Inclusion of Intersection: A B A and A B B Inclusion in Union: A A B and B A B Transitivity of Inclusion: (A B B C) A C Set Definitions: x X Y x X y Y x X Y x X y Y x X Y x X y Y x X c x X (x, y) X Y x X y Y

Set Identities Commutative Laws: A B = A B and A B = B A Associative Laws: (A B) C = A (B C) and (A B) C = A (B C) Distributive Laws: A (B C) = (A B) (A C) and A (B C) = (A B) (A C) Intersection and Union with universal set: A U = A and A U = U Double Complement Law: (A c ) c = A Idempotent Laws: A A = A and A A = A De Morgan s Laws: (A B) c = A c B c and (A B) c = A c B c Absorption Laws: A (A B) = A and A (A B) = A Alternate Representation for Difference: A B = A B c Intersection and Union with a subset: if A B, then A B = A and A B = B

Proving Equality First show that one set is a subset of another (what we did with examples before) To show this, choose an arbitrary particular element as with direct proofs (call it x), and show that if x is in A then x is in B to show that A is a subset of B Example (step through all cases)

Disproofs, Counterexamples and Algebraic Proofs Is is true that (A B) (B C) = A C? (No via counterexample) Show that (A B) C = (A C) (B C) (Can do with an algebraic proof, slightly different)

Boolean Algebra A Boolean Algebra is a set of elements together with two operations denoted as + and * and satisfying the following properties: Commutative: a + b = b + a, a * b = b * a Associative: (a + b) + c = a + (b + c), (a * b) *c = a * (b * c) Distributive: a + (b * c) = (a + b) * (a + c), a * (b + c) = (a * b) + (a * c) Identity: a + 0 = a, a * 1 = a for some distinct unique 0 and 1 Complement: a + ã = 1, a * ã = 0

Russell s Paradox Set of all integers, set of all abstract ideas Consider S = {A, A is a set and A A} Is S an element of S? Barber puzzle: a male barber shaves all those men who do not shave themselves. Does the barber shave himself? Consider S = {A U, A A}. Is S S? Godel: No way to rigorously prove that mathematics is free of contradictions. ( This statement is not provable is true but not provable) (consistency of an axiomatic system is not provable within that system)

Halting Problem There is no computer algorithm that will accept any algorithm X and data set D as input and then will output halts or loops forever to indicate whether X terminates in a finite number of steps when X is run with data set D. Proof is by contradiction