Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- 2.1 Sets by showslidedump 1722 views
- Set, Relations and Functions by suthi 310 views
- Bab 2 Aljabar Relasional by Ratzman III 6237 views
- Cbse Class 8 Solved Multiple Choice... by guest9c91b5 4318 views
- Pigeonhole Principle,Cardinality,Co... by Kiran Munir 7901 views
- Sets, functions and groups by Muhammad Adnan Ejaz 116 views

No Downloads

Total views

1,813

On SlideShare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

69

Comments

0

Likes

2

No embeds

No notes for slide

- 1. Discrete Structures Dr. S.S.Shehaby1
- 2. Sets DEF: A set is a collection of elements. This is another example where mathematics must start at the level of intuition. Sets are the basic data structure out of which most mathematical theories are built. For many years mathematicians hoped that sets could be defined directly from logic, thus giving a full- proof foundation to Mathematics, when compared to other sciences. Effort failed!2
- 3. Sets Curly braces ―{― and ―}‖ are used to denote sets. Java note: In Java curly braces denote arrays, a data-structure with inherent ordering. Mathematical sets are unordered so different from Java arrays. Java arrays require that all elements be of the same type. Mathematical sets don’t require this, however. EG: { 11, 12, 13 } { , , } { , , , 11, Leo }3
- 4. Sets A set is defined only by the elements which it contains. Thus repeating an element, or changing the ordering of elements in the description of the set, does not change the set itself: { 11, 11, 11, 12, 13 } = { 11, 12, 13 } { , , }={ , , }4
- 5. Standard Numerical Sets The natural numbers: N = { 0, 1, 2, 3, 4, … } The integers: Z = { … -3, -2, -1, 0, 1, 2, 3, … } The positive integers: Z+ = {1, 2, 3, 4, 5, … } The real numbers: R --contains any decimal number of arbitrary precision The rational numbers Q: these are numbers whose decimal expansion repeats; Q are numbers that can be represented in the form a/b where a Z and b Z+ Q: Give examples of numbers in R but not Q.5
- 6. Standard Numerical Sets A: 2 , π, e, or any irrational number6
- 7. -Notation The Greek letter ―‖ (epsilon) is used to denote that an object is an element of a set. When crossed out ―‖ denotes that the object is not an element.‖ EG: 3 S reads: ―3 is an element of the set S ‖. Q: Which of the following are true: 1. 3R 2. -3 N 3. -3 R 4. 0 Z+ 5. x xR x2=-57
- 8. -Notation A: 1, 3 and 4 1. 3 R. True: 3 is a real number. 2. -3 N. False: natural numbers don’t contain negatives. 3. -3 R. True: -3 is a real number. 4. 0 Z+. True: 0 isn’t positive. 5. x xR x2=-5 . False: square of a real number is non-neg., so can’t be -5.8
- 9. -Notation DEF: A set S is said to be a subset of the set T iff every element of S is also an element of T. This situation is denoted by ST A synonym of ―subset‖ is ―contained by‖. Definitions are often just a means of establishing a logical equivalence which aids in notation. The definition above says that: ST x (xS ) (xT ) We already had all the necessary concepts, but the ―‖ notation saves work.9
- 10. -Notation When ―‖ is used instead of ―‖, proper containment is meant. A subset S of T is said to be a proper subset if S is not equal to T. Notationally: ST S T x (x S xT ) Q: What algebraic symbol is reminiscent of?10
- 11. -Notation A: is to , as < is to .11
- 12. The Empty Set The empty set is the set containing no elements. This set is also called the null set and is denoted by: {} 12
- 13. Subset Examples Q: Which of the following are true: 1. NR 2. ZN 3. -3 R 4. {1,2} Z+ 5. 6. 13
- 14. Subset Examples A: 1, 4 and 5 1. N R. All natural numbers are real. 2. Z N. Negative numbers aren’t natural. 3. -3 R. Nonsensical. -3 is not a subset but an element! (This could have made sense if we viewed -3 as a set –which in principle is the case– in this case the proposition is false). 4. {1,2} Z+. This actually makes sense. The set {1,2} is an object in its own right, so could be an element of some set; however, {1,2} is not a number, therefore is not an element of Z. 5. . Any set contains itself.14 6. . No set can contain itself properly.
- 15. Cardinality The cardinality of a set is the number of distinct elements in the set. |S | denotes the cardinality of S. Q: Compute each cardinality. 1. |{1, -13, 4, -13, 1}| 2. |{3, {1,2,3,4}, }| 3. |{}| 4. |{ {}, {{}}, {{{}}} }|15
- 16. Cardinality Hint: After eliminating the redundancies just look at the number of top level commas and add 1 (except for the empty set). A: 1. |{1, -13, 4, -13, 1}| = |{1, -13, 4}| = 3 2. |{3, {1,2,3,4}, }| = 3. To see this, set S = {1,2,3,4}. Compute the cardinality of {3,S, } 3. |{}| = || = 0 4. |{ {}, {{}}, {{{}}} }| = |{ , {}, {{}}| = 316
- 17. Cardinality DEF: The set S is said to be finite if its cardinality is a nonnegative integer. Otherwise, S is said to be infinite. EG: N, Z, Z+, R, Q are each infinite. Note: We’ll see later that not all infinities are the same. In fact, R will end up having a bigger infinity-type than N, but surprisingly, N has same infinity-type as Z, Z+, and Q.17
- 18. Power Set DEF: The power set of S is the set of all subsets of S. Denote the power set by P (S ) or by 2s . The latter weird notation comes from the following. Lemma: | 2s | = 2|s|18
- 19. Power Set –Example To understand the previous fact consider S = {1,2,3} Enumerate all the subsets of S : 0-element sets: {} 1 1-element sets: {1}, {2}, {3} +3 2-element sets: {1,2}, {1,3}, {2,3} +3 3-element sets: {1,2,3} +1 Therefore: | 2s | = 8 = 23 = 2|s|19
- 20. Ordered n-tuples Notationally, n-tuples look like sets except that curly braces are replaced by parentheses: ( 11, 12 ) –a 2-tuple aka ordered pair ( , , ) –a 3-tuple ( , , , 11, Leo ) –a 5-tuple Java: n -tuples are similar to Java arrays ―{…}‖, except that type-mixing isn’t allowed in Java.20
- 21. Ordered n-tuples As opposed to sets, repetition and ordering do matter with n-tuples. (11, 11, 11, 12, 13) ( 11, 12, 13 ) ( , , )( , , )21
- 22. Cartesian Product The most famous example of 2-tuples are points in the Cartesian plane R2. Here ordered pairs (x,y) of elements of R describe the coordinates of each point. We can think of the first coordinate as the value on the x-axis and the second coordinate as the value on the y- axis. DEF: The Cartesian product of two sets A and B –denoted by A B– is the set of all ordered pairs (a, b) where aA and bB . Q: Describe R2 as the Cartesian product of two sets.22
- 23. Cartesian Product A: R2 = RR. I.e., the Cartesian plane is formed by taking the Cartesian product of the x-axis with the y-axis. One can generalize the Cartesian product to several sets simultaneously. Q: If A = {1,2}, B = {3,4}, C = {5,6,7} what is A B C ?23
- 24. Cartesian Product A: A = {1,2}, B = {3,4}, C = {5,6,7} A B C = { (1,3,5), (1,3,6), (1,3,7), (1,4,5), (1,4,6), (1,4,7), (2,3,5), (2,3,6), (2,3,7), (2,4,5), (2,4,6), (2,4,7) } Lemma: The cardinality of the Cartesian product is the product of the cardinalities: | A1 A2 … An | = |A1||A2| … |An| Q: What does S equal?24
- 25. Cartesian Product A: From the lemma: |S | = |||S | = 0|S | = 0 There is only one set with no elements – the empty set– therefore, S must be the empty set . One can also check this directly from the definition of the Cartesian product.25
- 26. Blackboard Exercise Prove the following: If A B and B C then A C .26
- 27. Set Operations
- 28. AgendaSet Operations Union and Disjoint union Intersection Difference “-” Complement “ ” Symmetric Difference
- 29. Universe of Reference When talking about a set, a universe of reference (universal set ) needs to be specified. Even though a set is defined by the elements which it contains, those elements cannot be arbitrary. If arbitrary elements are allowed paradoxes can result arising from self reference.29
- 30. Set Builder Notation Up to now sets have been defined using the curly brace notation ―{ … }‖ or descriptively ―the set of all natural numbers‖. The set builder notation allows for concise definition of new sets. For example { x | x is an even integer } { 2x | x is an integer } are equivalent ways of specifying the set of all even integers.35
- 31. Set Builder Notation In general, one specifies a set by writing { f (x ) | P (x ) } Where f (x ) is a function of x (okay we haven’t really gotten to functions yet…) and P (x ) is a propositional function of x. The notation is read as ―the set of all elements f (x ) such that P (x ) holds‖ Stuff between ―{― and ―|‖ specifies how elements look Stuff between the ―|‖ and ―}‖ gives properties elements satisfy Pipe symbol ―|‖ is short-hand for ―such that‖.36
- 32. Set Builder Notation. Shortcuts. To specify a subset of a pre-defined set, f (x ) takes the form xS. For example {x N | y (x = 2y ) } defines the set of all even natural numbers (assuming universe of reference Z). When universe of reference is understood, don’t need to specify propositional function EG: { x 3 | } or simply {x 3 } specifies the set of perfect cubes {0,1,8,27,64,125, …} assuming U is the set of natural numbers.37
- 33. Set Builder Notation. Examples. Q1: U = N. { x | y (y x ) } = ? Q2: U = Z. { x | y (y x ) } = ? Q3: U = Z. { x | y (y R y 2 = x )} = ? Q4: U = Z. { x | y (y R y 3 = x )} = ? Q5: U = R. { |x | | x Z } = ? Q6: U = R. { |x | } = ?38
- 34. Set Builder Notation. Examples. A1: U = N. { x | y (y x ) } = { 0 } A2: U = Z. { x | y (y x ) } = { } A3: U = Z. { x | y (y R y 2 = x )} = { 0, 1, 2, 3, 4, … } = N A4: U = Z. { x | y (y R y 3 = x )} = Z A5: U = R. { |x | | x Z } = N A6: U = R. { |x | } = non-negative reals.39
- 35. Set Theoretic Operations Set theoretic operations allow us to build new sets out of old, just as the logical connectives allowed us to create compound propositions from simpler propositions. Given sets A and B, the set theoretic operators are: Union () Intersection () Difference (-) Complement (―—‖) Symmetric Difference () give us new sets AB, AB, A-B, AB, andA .40
- 36. Venn Diagrams Venn diagrams are useful in representing sets and set operations. Various sets are represented by circles inside a big rectangle representing the universe of reference.41
- 37. Union Elements in at least one of the two sets: AB = { x | x A x B } U AB A B42
- 38. Intersection Elements in exactly one of the two sets: AB = { x | x A x B } U A A B B43
- 39. Disjoint Sets DEF: If A and B have no common elements, they are said to be disjoint, i.e. A B = . U A B44
- 40. Disjoint Union When A and B are disjoint, the disjoint union operation is well defined. The circle above the union symbol indicates disjointedness. U A B A B45
- 41. Disjoint Union FACT: In a disjoint union of finite sets, cardinality of the union is the sum of the cardinalities. I.e. A B A B46
- 42. Set Difference Elements in first set but not second: A- B = { x | x A x B } U A- B B A47
- 43. Symmetric Difference Elements in exactly one of the two sets: AB = { x | x A x B } A B U A B48
- 44. Complement Elements not in the set (unary operator): A = { x | x A } U A A49
- 45. Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (AB )C = A(B C )50
- 46. Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (AB )C = A(B C ) Proof : (AB )C = {x | x A B x C } (by def.)51
- 47. Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (AB )C = A(B C ) Proof : (AB )C = {x | x A B x C } (by def.) = {x | (x A x B ) x C } (by def.)52
- 48. Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (AB )C = A(B C ) Proof : (AB )C = {x | x A B x C } (by def.) = {x | (x A x B ) x C } (by def.) = {x | x A ( x B x C ) } (logical assoc.)53
- 49. Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (AB )C = A(B C ) Proof : (AB )C = {x | x A B x C } (by def.) = {x | (x A x B ) x C } (by def.) = {x | x A ( x B x C ) } (logical assoc.) = {x | x A x B C ) } (by def.)54
- 50. Set Identities In fact, the logical identities create the set identities by applying the definitions of the various set operations. For example: LEMMA: (Associativity of Unions) (AB )C = A(B C ) Proof : (AB )C = {x | x A B x C } (by def.) = {x | (x A x B ) x C } (by def.) = {x | x A ( x B x C ) } (logical assoc.) = {x | x A (x B C ) } (by def.) = A(B C ) (by def.) Other identities are derived similarly.55
- 51. Set Identities via Venn It’s often simpler to understand an identity by drawing a Venn Diagram. For example DeMorgan’s first law A B A B can be visualized as follows.56
- 52. Visual DeMorgan A: B:57
- 53. Visual DeMorgan A: B: A B:58
- 54. Visual DeMorgan A: B: A B: A B :59
- 55. Visual DeMorgan A: B:60
- 56. Visual DeMorgan A: B: A: B:61
- 57. Visual DeMorgan A: B: A: B: A B :62
- 58. Visual DeMorgan A B = A B 63
- 59. Sets as Bit-Strings If we order the elements of our universe, we can represent sets by bit-strings. For example, consider the universe U = {ant, beetle, cicada, dragonfly} Order the elements alphabetically. Subsets of U are represented by bit-strings of length 4. Each bit in turn, tells us whether the corresponding element is contained in the set. EG: {ant, dragonfly} is represented by the bit-string 1001. Q: What set is represented by 0111 ?64
- 60. Sets as Bit-Strings A: 0111 represents {beetle, cicada, dragonfly} Conveniently, under this representation the various set theoretic operations become the logical bit-string operators that we saw before. For example, the symmetric difference of {beetle} with {ant, beetle, dragonfly} is represented by: 0100 1101 1001 = {ant, dragonfly}65
- 61. Relations In mathematics, a binary relation on a set A is a collection of ordered pairs of elements of A. It is a subset of the Cartesian product A2 = A × A. More generally, a binary relation between two sets A and B is a subset of A × B. The terms dyadic relation and 2-place relation are synonyms for binary relations. A binary relation is the special case n = 2 of an n-ary relation R ⊆ A1 × … × An, that is, a set of n-tuples where the jth component of each n-tuple is taken from the jth domain Aj of the relation.66
- 62. Relations A binary relation R is usually defined as an ordered triple <X, Y, G)> where X and Y are arbitrary sets (or classes), and G is a subset of the Cartesian product X × Y. The sets X and Y are called the domain (or the set of departure) and codomain (or the set of destination), respectively, of the relation, and G is called its graph. The statement (x,y) ∈ R is read "x is R-related to y", and is denoted by xRy or R(x,y). The latter notation corresponds to viewing R as the characteristic function on "X" x "Y" for the set of pairs of G. The order of the elements in each pair of G is important: if a ≠ b, then aRb and bRa can be true or false, independently of each other.67
- 63. Relations According to the definition above, two relations with the same graph may be different, if they differ in the sets X and Y. For example, if G = {(1,2),(1,3),(2,7)}, then (Z,Z, G), (R, N, G), and (N, R, G) are three distinct relations. Suppose there are four objects {ball, car, doll, gun} and four persons {John, Mary, Ian, Venus}. Suppose that John owns the ball, Mary owns the doll, and Venus owns the car. The binary relation "is owned by" is given as R=<{ball, car, doll, gun}, {John, Mary, Ian, Venus}, {(ball, John), (doll, Mary), (car, Venus)}>68
- 64. Relations Uniqueness: injective (left-unique): for all x and z in X and y in Y it holds that if xRy and zRy then x = z. functional (right-unique, right-definite): for all x in X, and y and z in Y it holds that if xRy and xRz then y = z; such a binary relation is called a partial function. one-to-one (1-to-1): injective and functional. Totality: left-total: for all x in X there exists a y in Y such that xRy. surjective (right-total): for all y in Y there exists an x in X such that xRy. A correspondence: a binary relation that is both left-total and surjective. Uniqueness and totality properties: A function: a relation that is functional and left-total. A bijection: a one-to-one correspondence; such a relation is a function and is said to be bijective.69
- 65. Relations reflexive: for all x in X it holds that xRx. For example, "greater than or equal to" is a reflexive relation but "greater than" is not. irreflexive (or strict): for all x in X it holds that not xRx. "Greater than" is an example of an irreflexive relation. coreflexive: for all x and y in X it holds that if xRy then x = y. "Equal to" is an example of a coreflexive relation. symmetric: for all x and y in X it holds that if xRy then yRx. "Is a blood relative of” antisymmetric: for all distinct x and y in X, if xRy then not yRx. asymmetric: for all x and y in X, if xRy then not yRx. (So asymmetricity is stronger than anti-symmetry. In fact, asymmetry is equivalent to anti-symmetry plus irreflexivity.) transitive: for all x, y and z in X it holds that if xRy and yRz then xRz. (Note that, under the assumption of transitivity, irreflexivity and asymmetry are equivalent.) total: for all x and y in X it holds that xRy or yRx (or both). "Is greater than or equal to" is an example of a total relation.70
- 66. Relations Binary relations by property reflexive symmetric transitive symbol example undirected graph No Yes dependency Yes Yes weak order Yes ≤ preorder Yes Yes ≤ preference partial order Yes No Yes ≤ subset partial equivalence Yes Yes equivalence relation Yes Yes Yes ∼, ≅, ≈, ≡ equality proper strict partial order No No Yes < subset71
- 67. Functions;Sequences, Sums, Countability
- 68. Agenda Functions Domain, co-domain, range Image, pre-image One-to-one, onto, bijective, inverse Functional composition and exponentiation Ceiling “ ” and floor “ ” Sequences and Sums Sequences ai Summations ai i 0 Countable 0 and uncountable sets73
- 69. Functions In high-school, functions are often identified with the formulas that define them. EG: f (x ) = x 2 This point of view does not suffice in Discrete Math. In discrete math, functions are not necessarily defined over the real numbers. EG: f (x ) = 1 if x is odd, and 0 if x is even. So in addition to specifying the formula one needs to define the set of elements which are acceptable as inputs, and the set of elements into which the function outputs.74
- 70. Functions. Basic-Terms. DEF: A function f : A B is given by a domain set A, a codomain set B, and a rule which for every element a of A, specifies a unique element f (a) in B. f (a) is called the image of a, while a is called the pre-image of f (a). The range (or image) of f is defined by f (A) = {f (a) | a A }.75
- 71. Functions. Basic-Terms. EG: Let f : Z R be given by f (x ) = x 2 Q1: What are the domain and co-domain? Q2: What’s the image of -3 ? Q3: What are the pre-images of 3, 4? Q4: What is the range f (Z) ?76
- 72. Functions. Basic-Terms. f : Z R is given by f (x ) = x 2 A1: domain is Z, co-domain is R A2: image of -3 = f (-3) = 9 A3: pre-images of 3: none as 3 isn’t an integer! pre-images of 4: -2 and 2 A4: range is the set of perfect squares f (Z) = {0,1,4,9,16,25,…}77
- 73. One-to-One, Onto, Bijection. Intuitively. Represent functions using “node and arrow” notation: One-to-One means that no clashes occur. BAD: a clash occurred, not 1-to-1 GOOD: no clashes, is 1-to-1 Onto means that every possible output is hit BAD: 3rd output missed, not onto GOOD: everything hit, onto83
- 74. One-to-One, Onto, Bijection. Intuitively. Bijection means that when arrows reversed, a function results. Equivalently, that both one- to-one’ness and onto’ness occur. BAD: not 1-to-1. Reverse over-determined: BAD: not onto. Reverse under-determined: GOOD: Bijection. Reverse is a function:84
- 75. One-to-One, Onto, Bijection. Formal Definition. DEF: A function f : A B is: one-to-one (or injective) if different elements of A always result in different images in B. onto (or surjective) if every element in B is hit by f. I.e., f (A ) = B. a one-to-one correspondence (or a bijection, or invertible) if f is both one-to-one as well as onto. If f is invertible, its inverse f -1 : B A is well defined by taking the unique element in the pre-image of b, for each b B.85
- 76. One-to-One, Onto, Bijection. Examples. Q: Which of the following are 1-to-1, onto, a bijection? If f is invertible, what is its inverse? 1. f : Z R is given by f (x ) = x 2 2. f : Z R is given by f (x ) = 2x 3. f : R R is given by f (x ) = x 3 4. f : Z N is given by f (x ) = |x | 5. f : {people} {people} is given by f (x ) = the father of x.86
- 77. One-to-One, Onto, Bijection. Examples. 1. f : Z R, f (x ) = x 2: none 2. f : Z Z, f (x ) = 2x : 1-1 3. f : R R, f (x ) = x 3: 1-1, onto, bijection, inverse is f (x ) = x (1/3) 4. f : Z N, f (x ) = |x |: onto 5. f (x ) = the father of x : none87
- 78. Composition When a function f spits out elements of the same kind that another function g eats, f and g may be composed by letting g immediately eat each output of f. DEF: Suppose that g : A B and f : B C are functions. Then the composite f g : A C is defined by setting f g (a) = f ( g (a) )88
- 79. Composition. Examples. Q: Compute g f where 1. f : Z R, f (x ) = x 2 and g : R R, g (x ) = x 3 2. f : Z Z, f (x ) = x + 1 and g = f -1 so g (x ) = x – 1 3. f : {people} {people}, f (x ) = the father of x, and g = f89
- 80. Composition. Examples. 1. f : Z R, f (x ) = x 2 and g : R R, g (x ) = x 3 f g : Z R , f g (x ) = x 6 2. f : Z Z, f (x ) = x + 1 and g = f -1 f g (x ) = x (true for any function composed with its inverse) 3. f : {people} {people}, f (x ) = g(x ) = the father of x f g (x ) = grandfather of x from father’s side90
- 81. Repeated Composition When the domain and codomain are equal, a function may be self composed. The composition may be repeated as much as desired resulting in functional exponentiation. The whole process is denoted by n f n (x ) = f f f f … f (x ) where f appears n –times on the right side. Q1: Given f : Z Z, f (x ) = x 2 find f 4 Q2: Given g : Z Z, g (x ) = x + 1 find g n Q3: Given h(x ) = the father of x, find hn91
- 82. Repeated Composition A1: f : Z Z, f (x ) = x 2. f 4(x ) = x (2*2*2*2) = x 16 A2: g : Z Z, g (x ) = x + 1 gn (x ) = x + n A3: h (x ) = the father of x, hn (x ) = x ’s n’th patrilineal ancestor92
- 83. Ceiling and Floor This being a course on discrete math, it is often useful to discretize numbers, sets and functions. For this purpose the ceiling and floor functions come in handy. DEF: Given a real number x : The floor of x is the biggest integer which is smaller or equal to x The ceiling of x is the smallest integer greater or equal to x. NOTATION: floor(x) = x , ceiling(x) = x Q: Compute 1.7, -1.7, 1.7, -1.7.93
- 84. Ceiling and Floor A: 1.7 = 1, -1.7 = -2, 1.7 = 2, -1.7 = -1 Q: What’s the difference between the floor function and the (int) casting function in Java?94
- 85. Ceiling and Floor A: Casting to int in Java always truncates towards 0. Ceiling and floor are not symmetric in this way. EG: (int)(-1.7) == -1 -1.7 = -295
- 86. Example for section 1.6 Consider the function f : R2 R2 defined by the formula f (x,y ) = ( ax+by, cx+dy ) where a,b,c,d are constants. Give a condition on the constants which guarantees that f is one-to-one. More detailed example96
- 87. Sequences Sequences are a way of ordering lists of objects. Java arrays are a type of sequence of finite size. Usually, mathematical sequences are infinite. To give an ordering to arbitrary elements, one has to start with a basic model of order. The basic model to start with is the set N = {0, 1, 2, 3, …} of natural numbers. For finite sets, the basic model of size n is: n = {1, 2, 3, 4, …, n-1, n }97
- 88. Sequences DEF: Given a set S, an (infinite) sequence in S is a function N S. A finite sequence in S is a function n S. Symbolically, a sequence is represented using the subscript notation ai . This gives a way of specifying formulaically Note: Other sets can be taken as ordering models. The book often uses the positive numbers Z+ so counting starts at 1 instead of 0. I’ll usually assume the ordering model N. Q: Give the first 5 terms of the sequence defined by the formula π ai cos( i )98 2
- 89. Sequence Examples A: Plug in for i in sequence 0, 1, 2, 3, 4: a0 1, a1 0, a2 -1, a3 0, a4 1 Formulas for sequences often represent patterns in the sequence. Q: Provide a simple formula for each sequence: a) 3,6,11,18,27,38,51, … b) 0,2,8,26,80,242,728,… c) 1,1,2,3,5,8,13,21,34,…99
- 90. Sequence Examples A: Try to find the patterns between numbers. a) 3,6,11,18,27,38,51, … a1=6=3+3, a2=11=6+5, a3=18=11+7, … and in general ai +1 = ai +(2i +3). This is actually a good enough formula. Later we’ll learn techniques that show how to get the more explicit formula: ai = 6 + 4(i –1) + (i –1)2 b) 0,2,8,26,80,242,728,… If you add 1 you’ll see the pattern more clearly. ai = 3i –1 c) 1,1,2,3,5,8,13,21,34,… This is the famous Fibonacci sequence given by ai +1 = ai + ai-1100
- 91. Bit Strings Bit strings are finite sequences of 0’s and 1’s. Often there is enough pattern in the bit-string to describe its bits by a formula. EG: The bit-string 1111111 is described by the formula ai =1, where we think of the string of being represented by the finite sequence a1a2a3a4a5a6a7 Q: What sequence is defined by a1 =1, a2 =1 ai+2 = ai ai+1101
- 92. Bit Strings A: a0 =1, a1 =1 ai+2 = ai ai+1: 1,1,0,1,1,0,1,1,0,1,…102
- 93. Summations The symbol “S” takes a sequence of numbers and turns it into a sum. Symbolically: n a i 0 i a0 a1 a2 ... an This is read as “the sum from i =0 to i =n of ai” Note how “S” converts commas into plus signs. One can also take sums over a set of numbers: x xS 2103
- 94. Summations EG: Consider the identity sequence ai = i Or listing elements: 0, 1, 2, 3, 4, 5,… The sum of the first n numbers is given by: n ai 1 2 3 ... n i 1 (The first term 0 is dropped)104
- 95. Summation Formulas – Arithmetic There is an explicit formula for the previous: n n(n 1) i 2 i 1 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.105
- 96. Summation Formulas – Geometric 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?106
- 97. Summation Formulas 2, 6, 18, 54, 162, … A: r = 3. In general, the terms of a geometric sequence have the form ai = a r i where a is the 1st 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 1 n ar - a ar a ar ar ... ar r - 1 i 0 i 2 n107
- 98. Summation Examples 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. 103 5(i - 3) i 20 13 2. 2i i 0108
- 99. Summation Examples A: 1. Use the arithmetic sum formula and additivity of summation: 103 103 103 103 5(i - 3) 5 (i - 3) 5 i - 5 3 i 20 i 20 i 20 i 20 (103 20) 5 84 - 5 3 84 24570 2109
- 100. Summation Examples A: 2. Apply the geometric sum formula directly by setting a = 1 and r = 2: 13 214 - 1 14 i 0 2i 2 -1 2 - 1 16383110
- 101. Cardinality and Countability 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”.111
- 102. Cardinality and Countability For finite sets, can just count the elements to get cardinality. Infinite sets are harder. First Idea: Can 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?112
- 103. Cardinality and Countability 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 one-to-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?113
- 104. Cardinality and Countability – Finite Sets DEF: Two sets A and B have the same cardinality if there’s a bijection f:AB For finite sets this is the same as the old definition: {,} { , }114
- 105. Cardinality and Countability – Infinite Sets 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!115
- 106. Countability – Examples Q: Why are the following sets countable? 1. {0,2,4,6,8,…} 2. {1,3,5,7,9,…} 100 100100 100 3. {1,3,5,7, 100 } 4. Z116
- 107. Countability – Examples 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 ) = 2n100 1 + 100100 3. {1,3,5,7, 100100 } has cardinality 5 so is therefore countable 4. Z: This one is more interesting. Continue on next page:117
- 108. Countability of the Integers 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: i i 1 ai -(-1) 2 118
- 109. Demonstrating Countability. Useful Facts Because 0 is the smallest kind of infinity, it turns out that to show that a set is countable one can either demonstrate an injection into N or a surjection from N. THM: Suppose A is a set. If there is an one-to- one function f : A N, or there is an onto function g : N A then A is countable. The proof requires the principle of mathematical induction, which we’ll get to at a later date.119
- 110. Uncountable Sets But R is uncountable (“not countable”) Q: Why not ?120
- 111. Uncountability of R 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.121
- 112. Uncountability of R 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? r1 , r2 , r3 , r4 , r5 , r6 , r7, …122
- 113. Uncountability of R Cantor’s Diabolical Diagonal So we have this list r1 , r2 , r3 , r4 , r5 , r6 , r7, … 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.123
- 114. Cantors Diagonalization Argument Decimal expansions of ri r1 0. r2 0. r3 0. r4 0. r5 0. r6 0. r7 0. :revil 0.
- 115. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. r3 0. r4 0. r5 0. r6 0. r7 0. :revil 0.
- 116. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 1 1 1 1 1 1 r3 0. r4 0. r5 0. r6 0. r7 0. :revil 0.
- 117. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 1 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. r5 0. r6 0. r7 0. :revil 0.
- 118. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 1 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. r6 0. r7 0. :revil 0.
- 119. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. r7 0. :revil 0.
- 120. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. 5 5 5 5 5 5 5 r7 0. :revil 0.
- 121. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. 5 5 5 5 5 5 5 r7 0. 7 6 7 9 5 4 4 :revil 0.
- 122. Cantors Diagonalization Argument Decimal expansions of ri r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. 5 5 5 5 5 5 5 r7 0. 7 6 7 9 5 4 4 :revil 0. 5 4 5 5 5 4 5
- 123. Uncountability of R Cantor’s Diabolical Diagonal GENERALIZE: To construct a number not on the list “revil”, let ri,j be the j ’th decimal digit in the fractional part of ri. Define the digits of revil by the following rule: The j ’th digit of revil is 5 if ri,j 5. Otherwise the j’ ’th digit is set to be 4. This guarantees that revil 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 revil. //QED133
- 124. Impossible Computations 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.d1d2d3d4d5d6d7… 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….134
- 125. Impossible Computations 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!135
- 126. Blackboard Exercises Evaluate the double summation: 2 3 ij i 0 j 1 Show that if A is uncountable and B is countable then A-B is uncountable.136

No public clipboards found for this slide

Be the first to comment