Algorithms: Lecture 2

Similar documents
One-to-one functions and onto functions

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality

Discrete Structures for Computer Science

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

CITS2211 Discrete Structures (2017) Cardinality and Countability

Sequences are ordered lists of elements

CSE 20 DISCRETE MATH. Fall

Discrete Mathematics 2007: Lecture 5 Infinite sets


Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 20. To Infinity And Beyond: Countability and Computability

The Two Faces of Infinity Dr. Bob Gardner Great Ideas in Science (BIOL 3018)

Chapter 20. Countability The rationals and the reals. This chapter covers infinite sets and countability.

Countability. 1 Motivation. 2 Counting

Announcements. CS243: Discrete Structures. Sequences, Summations, and Cardinality of Infinite Sets. More on Midterm. Midterm.

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

CHAPTER 8: EXPLORING R

Finite and Infinite Sets

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets

MAT335H1F Lec0101 Burbulla

Mathematics 220 Workshop Cardinality. Some harder problems on cardinality.

Countable and uncountable sets. Matrices.

MATH31011/MATH41011/MATH61011: FOURIER ANALYSIS AND LEBESGUE INTEGRATION. Chapter 2: Countability and Cantor Sets

Countable and uncountable sets. Matrices.

Section 7.5: Cardinality

Mathematics-I Prof. S.K. Ray Department of Mathematics and Statistics Indian Institute of Technology, Kanpur. Lecture 1 Real Numbers

INFINITY: CARDINAL NUMBERS

What is proof? Lesson 1

CSCI3390-Lecture 6: An Undecidable Problem

A Short Review of Cardinality

Section 0. Sets and Relations

Math 105A HW 1 Solutions

1 Partitions and Equivalence Relations

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Chapter 2 - Basics Structures

Solutions to Homework Assignment 2

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

1.4 Cardinality. Tom Lewis. Fall Term Tom Lewis () 1.4 Cardinality Fall Term / 9

Math.3336: Discrete Mathematics. Cardinality of Sets

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

The cardinal comparison of sets

Lecture 3: Sizes of Infinity

Extended Essay - Mathematics

Chapter One. The Real Number System

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

LECTURE 22: COUNTABLE AND UNCOUNTABLE SETS

Math 300: Foundations of Higher Mathematics Northwestern University, Lecture Notes

SETS AND FUNCTIONS JOSHUA BALLEW

MAT115A-21 COMPLETE LECTURE NOTES

CHAPTER 3. Sequences. 1. Basic Properties

Solutions to Tutorial for Week 4

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

Some. AWESOME Great Theoretical Ideas in Computer Science about Generating Functions Probability

Cardinality of Sets. P. Danziger

We are going to discuss what it means for a sequence to converge in three stages: First, we define what it means for a sequence to converge to zero

MATH 3300 Test 1. Name: Student Id:

14 Uncountable Sets(Denial of Self Recursion)

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Math 4603: Advanced Calculus I, Summer 2016 University of Minnesota Notes on Cardinality of Sets

0 Logical Background. 0.1 Sets

Math 300: Final Exam Practice Solutions

2. Prime and Maximal Ideals

Sequences and infinite series

Proving languages to be nonregular

CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 3: Diagonalization & Halting Problem Due: One week after shown in slides

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Functions. Definition 1 Let A and B be sets. A relation between A and B is any subset of A B.

Diskrete Mathematik Solution 6

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM

Cantor and Infinite Sets

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

Great Theoretical Ideas in Computer Science. Lecture 5: Cantor s Legacy

CSE 311: Foundations of Computing. Lecture 26: Cardinality

the time it takes until a radioactive substance undergoes a decay

Notes on counting. James Aspnes. December 13, 2010

S15 MA 274: Exam 3 Study Questions

LECTURE 10: REVIEW OF POWER SERIES. 1. Motivation

Cardinality and ordinal numbers

CSE 311: Foundations of Computing. Lecture 26: Cardinality, Uncomputability

Chapter 3. Introducing Groups

Computational Theory

CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3

CSE 311: Foundations of Computing. Lecture 26: More on Limits of FSMs, Cardinality

1.1.1 Algebraic Operations

CSE 311: Foundations of Computing. Lecture 27: Undecidability

To Infinity and Beyond

Discrete Mathematics: Lectures 6 and 7 Sets, Relations, Functions and Counting Instructor: Arijit Bishnu Date: August 4 and 6, 2009

Propositional Logic, Predicates, and Equivalence

2 Exercises 1. The following represent graphs of functions from the real numbers R to R. Decide which are one-to-one, which are onto, which are neithe

Lecture Notes: The Halting Problem; Reductions

Numbers 1. 1 Overview. 2 The Integers, Z. John Nachbar Washington University in St. Louis September 22, 2017

Reed-Solomon code. P(n + 2k)

Some Basic Notations Of Set Theory

Mathematical Background

The Different Sizes of Infinity

Topology Math Conrad Plaut

Transcription:

1 Algorithms: Lecture 2 Basic Structures: Sets, Functions, Sequences, and Sums Jinwoo Kim jwkim@jjay.cuny.edu 2.1 Sets 2 1

2.1 Sets 3 2.1 Sets 4 2

2.1 Sets 5 2.1 Sets 6 3

2.1 Sets 7 2.2 Set Operations 8 4

2.2 Set Operations 9 2.2 Set Operations 10 5

2.2 Set Operations 11 2.2 Set Operations 12 6

2.3 Functions 13 2.3 Functions 14 7

2.3 Functions 15 2.3 Functions 16 8

2.3 Functions 17 2.3 Functions 18 9

2.4 Sequences and Summations 19 2.4 Sequences and Summations 20 10

2.4 Sequences and Summations 21 Bit Strings 22 Bit strings are finite sequences of 0 s and 1 s. Often there is enough pattern in the bitstring to describe its bits by a formula. EG: The bit-string 1111111 is described by the formula a i =1, where we think of the string of being represented by the finite sequence a 1 a 2 a 3 a 4 a 5 a 6 a 7 Q: What sequence is defined by a 1 =1, a 2 =1 a i+2 = a i a i+1 22 11

Bit Strings 23 A: a 0 =1, a 1 =1 a i+2 = a i a i+1 : 1,1,0,1,1,0,1,1,0,1, 23 Summations 24 The symbol takes a sequence of numbers and turns it into a sum. Symbolically: n i0 a i a a a... a This is read as the sum from i =0 to i =n of a i Note how converts commas into plus signs. One can also take sums over a set of numbers: 0 x 2 xs 1 2 n 24 12

Summations 25 EG: Consider the identity sequence a i = i Or listing elements: 0, 1, 2, 3, 4, 5, The sum of the first n numbers is given by: n i1 a 1 2 3... n (The first term 0 is dropped) i 25 Summation Formulas Arithmetic 26 There is an explicit formula for the previous: n n( n 1) i i1 2 Intuitive reason: The smallest term is 1, the biggest term is n so the avg. term is (n+1)/2. There are n terms. To obtain the formula simply multiply the average by the number of terms. 26 13

Summation Formulas Geometric 27 Geometric sequences are number sequences with a fixed constant of proportionality r between consecutive terms. For example: 2, 6, 18, 54, 162, Q: What is r in this case? 27 Summation Formulas 28 2, 6, 18, 54, 162, A: r = 3. In general, the terms of a geometric sequence have the form a i = a r i where a is the 1 st term when i starts at 0. A geometric sum is a sum of a portion of a geometric sequence and has the following explicit formula: n n1 i 2 n ar a ar a ar ar... ar r 1 i0 28 14

Summation Examples 29 If you are curious about how one could prove such formulas, your curiosity will soon be satisfied as you will become adept at proving such formulas a few lectures from now! Q: Use the previous formulas to evaluate each of the following 1. 2. 103 i20 13 i0 5( i 3) 2 i 29 Summation Examples 30 A: 1. Use the arithmetic sum formula and additivity of summation: 103 i20 5( i 3) 5 103 i20 ( i 3) 5 103 i20 i 5 103 i20 (103 20) 584 5384 24570 2 3 15

Summation Examples 31 A: 2. Apply the geometric sum formula directly by setting a = 1 and r = 2: 13 i0 2 i 14 2 1 2 2 1 14 1 16383 Cardinality and Countability 32 Up to now cardinality has been the number of elements in a finite sets. Really, cardinality is a much deeper concept. Cardinality allows us to generalize the notion of number to infinite collections and it turns out that many type of infinities exist. EG: {,} {, } {Ø, {Ø,{Ø,{Ø}}} } These all share 2-ness. 16

Cardinality and Countability 33 For finite sets, you can just count the elements to get cardinality. Infinite sets are harder. First Idea: Can you tell which set is bigger by seeing if one contains the other? {1, 2, 4} N {0, 2, 4, 6, 8, 10, 12, } N So set of even numbers ought to be smaller than the set of natural number because of strict containment. Q: Any problems with this? Cardinality and Countability 34 A: Set of even numbers is obtained from N by multiplication by 2. I.e. {even numbers} = 2 N For finite sets, since multiplication by 2 is a oneto-one function, the size doesn t change. EG: {1,7,11} 2 {2,14,22} Another problem: set of even numbers is disjoint from set of odd numbers. Which one is bigger? 34 17

Cardinality and Countability Finite Sets 35 DEF: Two sets A and B have the same cardinality if there s a bijection f : A B For finite sets this is the same as the old definition: {,} {, } 35 Cardinality and Countability Infinite Sets 36 But for infinite sets there are surprises. DEF: If S is finite or has the same cardinality as N, S is called countable. Notation, the Hebrew letter Aleph is often used to denote infinite cardinalities. Countable sets are said to have cardinality 0. Intuitively, countable sets can be counted in the sense that if you allocate 1 second to count each member, eventually any particular member will be counted after a finite time period. Paradoxically, you won t be able to count the whole set in a finite time period! 18

Countability Examples 37 Q: Why are the following sets countable? 1. {0,2,4,6,8, } 2. {1,3,5,7,9, } 100 100 100 100 100 3. {1,3,5,7, } 4. Z Countability Examples L6 1. {0,2,4,6,8, }: Just set up the bijection f (n ) = 2n 2. {1,3,5,7,9, } : Because of the bijection f (n ) = 2n + 1 100 100 100 3. 100 {1,3,5,7, 100 } has cardinality 5 so is therefore countable 4. Z: This one is more interesting. Continue on next page: 19

Countability of the Integers 39 Let s try to set up a bijection between N and Z. One way is to just write a sequence down whose pattern shows that every element is hit (onto) and none is hit twice (one-to-one). The most common way is to alternate back and forth between the positives and negatives. I.e.: 0,1,-1,2,-2,3,-3, It s possible to write an explicit formula down for this sequence which makes it easier to check for bijectivity: a i ( 1) i 2 i 1 Uncountable Sets 40 But R is uncountable ( not countable ) Q: Why not? 20

Uncountability of R 41 A: This is not a trivial matter. Here are some typical reasonings: 1. R strictly contains N so has bigger cardinality. What s wrong with this argument? 2. R contains infinitely many numbers between any two numbers. Surprisingly, this is not a valid argument. Q has the same property, yet is countable. 3. Many numbers in R are infinitely complex in that they have infinite decimal expansions. An infinite set with infinitely complex numbers should be bigger than N. Uncountability of R 42 Last argument is the closest. Here s the real reason: Suppose that R were countable. In particular, any subset of R, being smaller, would be countable also. So the interval [0,1] would be countable. Thus it would be possible to find a bijection from Z + to [0,1] and hence list all the elements of [0,1] in a sequence. What would this list look like? r 1, r 2, r 3, r 4, r 5, r 6, r 7, 21

Uncountability of R Cantor s Diabolical Diagonal 43 So we have this list r 1, r 2, r 3, r 4, r 5, r 6, r 7, supposedly containing every real number between 0 and 1. Cantor s diabolical diagonalization argument will take this supposed list, and create a number between 0 and 1 which is not on the list. This will contradict the countability assumption hence proving that R is not countable. Cantor's Diagonalization Argument 44 r 1 0. r 2 0. r 3 0. r 4 0. r 5 0. r 6 0. r 7 0. : r evil 0. Decimal expansions of r i 22

Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. r 3 0. r 4 0. r 5 0. r 6 0. r 7 0. : L6 r evil 0. Decimal expansions of r i 45 Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 1 1 1 1 1 1 r 3 0. r 4 0. r 5 0. r 6 0. r 7 0. : L6 r evil 0. Decimal expansions of r i 46 23

Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 1 1 1 1 1 1 r 3 0. 2 5 4 2 0 9 0 r 4 0. r 5 0. r 6 0. r 7 0. : L6 r evil 0. Decimal expansions of r i 47 Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 1 1 1 1 1 1 r 3 0. 2 5 4 2 0 9 0 r 4 0. 7 8 9 0 6 2 3 r 5 0. r 6 0. r 7 0. : L6 r evil 0. Decimal expansions of r i 48 24

Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 5 1 1 1 1 1 r 3 0. 2 5 4 2 0 9 0 r 4 0. 7 8 9 0 6 2 3 r 5 0. 0 1 1 0 1 0 1 r 6 0. r 7 0. : L6 r evil 0. Decimal expansions of r i 49 Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 5 1 1 1 1 1 r 3 0. 2 5 4 2 0 9 0 r 4 0. 7 8 9 0 6 2 3 r 5 0. 0 1 1 0 1 0 1 r 6 0. 5 5 5 5 5 5 5 r 7 0. : L6 r evil 0. Decimal expansions of r i 50 25

Cantor's Diagonalization Argument r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 5 1 1 1 1 1 r 3 0. 2 5 4 2 0 9 0 r 4 0. 7 8 9 0 6 2 3 r 5 0. 0 1 1 0 1 0 1 r 6 0. 5 5 5 5 5 5 5 r 7 0. 7 6 7 9 5 4 4 : L6 r evil 0. Decimal expansions of r i 51 Cantor's Diagonalization Argument Decimal expansions of r i r 1 0. 1 2 3 4 5 6 7 r 2 0. 1 5 1 1 1 1 1 r 3 0. 2 5 4 2 0 9 0 r 4 0. 7 8 9 0 6 2 3 r 5 0. 0 1 1 0 1 0 1 r 6 0. 5 5 5 5 5 5 5 r 7 0. 7 6 7 9 5 4 4 : L6 r evil 0. 5 4 5 5 5 4 5 52 26

Uncountability of R Cantor s Diabolical Diagonal 53 GENERALIZE: To construct a number not on the list r evil, let r i,j be the j th decimal digit in the fractional part of r i. Define the digits of r evil by the following rule: The j th digit of r evil is 5 if r i,j 5. Otherwise the j th digit is set to be 4. This guarantees that r evil is an anti-diagonal. I.e., it does not share any elements on the diagonal. But every number on the list contains a diagonal element. This proves that it cannot be on the list and contradicts our assumption that R was countable so the list must contain r evil. //QED Impossible Computations 54 Notice that the set of all bit strings is countable. Here s how the list looks: 0,1,00,01,10,11,000,001,010,011,100,101,110,111,0000, DEF: A decimal number 0.d 1 d 2 d 3 d 4 d 5 d 6 d 7 Is said to be computable if there is a computer program that outputs a particular digit upon request. EG: 1. 0.11111111 2. 0.12345678901234567890 3. 0.10110111011110. 27

Impossible Computations 55 CLAIM: There are numbers which cannot be computed by any computer. Proof : It is well known that every computer program may be represented by a bit-string (after all, this is how it s stored inside). Thus a computer program can be thought of as a bit-string. As there are 0 bit-strings yet R is uncountable, there can be no onto function from computer programs to decimal numbers. In particular, most numbers do not correspond to any computer program so are incomputable! Summary 56 28

Summary 57 Summary 58 29

Summary 59 Summary 60 30

Summary 61 Summary 62 31

Summary 63 32