Discrete Structures for Computer Science Presented By: Andrew F. Conn Adapted from: Adam J. Lee Lecture #9: Functions and Sequences September 28th, 2016
Announcements Homework 2 is due next class.
Today’s Topics Sequences and Summations Cardinality of Infinite Sets Important Sequences and Summations Closed form of summations. Cardinality of Infinite Sets Countable Sets Uncountable Sets
Important sequences Geometric progressions are sequences of the form 𝑎𝑟𝑛 where 𝑎 and 𝑟 are real numbers Examples: 1, 1 2 , 1 4 , 1 8 , 1 16 , … 2,−2, 2, −2, 2, −2, … Arithmetic progressions are sequences of the form 𝑎 + 𝑛𝑑 where 𝑎 and 𝑑 are real numbers. 2, 4, 6, 8, 10, … −10, −15, −20, −25, … 𝑎=1, 𝑟=½ 𝑎=2, 𝑟=−1 𝑎=2, 𝑑=2 𝑎=−10, 𝑑=−5
Important sequences Recurrence Relations are sequences of the form 𝑓 𝑛 =𝑓( 𝑓 𝑛−1 , 𝑓 𝑛−2 ,…) Examples: 1,2,6,24,120,720,… 1,1,2,3,5,8,13,21… 𝑓 𝑛 =𝑛∗ 𝑓 𝑛−1 𝑓 𝑛 = 𝑓 𝑛−1 + 𝑓 𝑛−2
Important Sums and their Closed Forms 𝑘=0 𝑛 𝑎 𝑟 𝑘 , 𝑟≠0 𝑎 𝑟 𝑛+1 −𝑎 𝑟−1 , 𝑟≠1 𝑘=1 𝑛 𝑘 𝑛 𝑛+1 2 𝑘=1 𝑛 𝑘 2 𝑛 𝑛+1 2𝑛+1 6 𝑘=1 𝑛 𝑘 3 𝑛 2 𝑛+1 2 4 𝑘=1 ∞ 𝑥 𝑘 , 𝑥 <1 1 1−𝑥 𝑘=1 ∞ 𝑘 𝑥 𝑘−1 , 𝑥 <1 1 1−𝑥 2 `
Infinite Cardinality Problem: It is easy to reason about the cardinality of finite sets by just counting the elements. It is more difficult to reason about the cardinality of infinite sets. Intuition: If we can compare two sets to one another we can determine something about their respective cardinalities. One set that is very useful for comparison to is the Natural Numbers (ℕ).
Injective, Surjective, Bijective … 𝐴 ≤ 𝐵 iff there exists an injection 𝑓:𝐴→𝐵. Intuitively, if all the values from 𝐴 can be mapped to 𝐵 by 𝑓, then 𝐵 must be at least as large as 𝐴. 𝐴 ≥ 𝐵 iff there exists a surjection 𝑓:𝐴→𝐵 Intuitively, every element of 𝐵 is mapped by at least one element of 𝐴 by 𝑓. 𝐴 = 𝐵 iff there exists a bijection 𝑓:𝐴→𝐵. Intuitively, if all the values from 𝐵 can be uniquely mapped to from all the values in 𝐴, then the sets are the same size. 𝐴 < 𝐵 iff there exists an injection, but not a bijection, 𝑓:𝐴→𝐵 Intuitively, if there exists an element in 𝐵 that is not mapped to from 𝐴 by 𝑓, then 𝐵 is strictly larger than 𝐴.
Countable Definitions Definition: We say that a set 𝐴 is countable iff there exists a injection 𝑓:𝐴→ℕ Definition: We say that a set 𝐴 is countably infinite iff there exists a bijection 𝑓:𝐴→ℕ
Show that the set of even natural numbers is countable Proof #1: We have the following injective correspondence between ℕ and the even natural numbers: So, the even natural numbers are countable. ❏ Proof #2: We can define 𝑓:ℕ→2ℕ as 𝑓 𝑛 =2𝑛. 𝑓 is a bijection, thus 2ℕ =|ℕ| and the even positive integers are countably infinite. ❏ 1 2 3 4 5 6 7 8 9 10 … 2 4 6 8 10 12 14 16 18 20 …
Show that ℤ is countably infinite. Proof: We have the following bijective correspondence between ℕ and ℤ: So, ℤ is countably infinite. ❏ 1 2 3 4 5 6 7 8 9 10 … -1 -2 -3 -4
Is the set ℚ + countable? Perhaps surprisingly, yes! 1 2 3 4 0 1 1 1 2 1 3 1 4 1 0 2 1 2 2 2 3 2 4 2 0 3 1 3 2 3 3 3 4 3 0 4 1 4 2 4 3 4 4 4 List p+q = 1 first, then p+q = 2, p+q =3, … This yields the sequence 0 1 , 1 1 , 0 2 , 0 3 , 1 2 , 2 1 , … If we remove the duplicates, we can define a function, 𝑓: ℚ + →ℕ using this method. Since 𝑓 is a bijection, ℚ + is countable. ❏
Is ℝ countable? No, it is not. We can prove this using a proof method called diagonalization, invented by Georg Cantor. Proof: Assume that the set of real numbers is countable. Then the subset of real numbers between 0 and 1 is also countable, by definition. This implies that the real numbers can be listed in some order, say, 𝑟 1 , 𝑟 2 , 𝑟 3 ,…. Let the decimal representation these numbers be: 𝑟 1 =0.𝑑11𝑑12𝑑13𝑑14… 𝑟 2 =0.𝑑21𝑑22𝑑23𝑑24… 𝑟 3 =0.𝑑31𝑑32𝑑33𝑑34… ⋮ = ⋮. ⋮ ⋮ ⋮ ⋮ ⋱ Where 𝑑𝑖𝑗∈ 0,1,2,3,4,5,6,7,8,9 ∀𝑖,𝑗
Proof (continued) Now, form a new decimal number 𝑟=0. 𝑑 1 𝑑 2 𝑑3… where 𝑑𝑖= 0, if 𝑑 𝑖,𝑖 =9 1, if 𝑑 𝑖,𝑖 =0 ⋮ Example: 𝑟1 = 0.123456… 𝑟2 = 0.234524… 𝑟3 = 0.631234… … 𝑟 = 0.242… 𝑟 is different from all of the 𝑟 𝑖 ’s in the list, namely in the 𝑖th decimal place. We assumed that there was a listing and found an element missing from the listing, thus no such element exists. Therefore the assumption that ℝ is countably infinite is false. ❏
Final thoughts Sets are the basis of functions, which are used throughout computer science and mathematics Sequences allow us to represent (potentially infinite) ordered lists of elements Functions allow us to compare sets and their relative sizes. Infinity is crazy! Next time: Integers and division (Section 4.1)