1 / 17

Sets and Functions

f ( ) =. A. B. Sets and Functions. Lecture 4: Sep 12. (based on slides in MIT 6.042). Sets. Informally : A set is a collection of mathematical objects, with the collection treated as a single mathematical object. Examples:. real numbers,  complex numbers, C

ulric
Télécharger la présentation

Sets and Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. f( ) = A B Sets and Functions Lecture 4: Sep 12 (based on slides in MIT 6.042)

  2. Sets Informally: A setis a collection of mathematical objects, with the collection treated as a single mathematical object. Examples: • real numbers,  • complex numbers, C • integers,  • empty set,  • set of all subsets of integers , pow() the power set

  3. Membership {7, “Albert”, /2, T} order doesn’t matter x is an element of A x is inA Examples: /2 {7, “Albert”,/2, T} /3 {7, “Albert”,/2, T} 14/2 {7, “Albert”,/2, T}   pow() 7 2/3   An element is in or not in a set: {7, /2, 7} is same as {7, /2} (No notion of being in the set more than once)

  4. Containment A is a subset of B A is contained inB Every element of A is also an element of B. Examples: , C, {3}{5,7,3}  every set, A  A

  5. Defining Sets The set of elements, x, in Asuch thatP(x) is true. The set of even integers: The set of prime numbers:

  6. New Sets from Old union: intersection: difference: complement: power set: More about set operations in tutorial.

  7. Russell’s Paradox so Let S be W and reach a contradiction: The fallacy: W is not a set! No set is a member of itself, so W = the collection of all sets, which isnot a set! NOT every mathematically well-defined collection of elements is actually a set.

  8. Functions function, f, from set A to set B associates an element , with an element The domain of f is A. The codomain of f is B. Example: f is the string-length function: f(“aabd”) = 4. Domain is the set of strings, codomain is nonnegative integers. More examples: student ID, gender, etc.

  9. f( ) = A B Total Functions is total iff every element of A is assigned a B-value by f exactly 1 arrow out

  10. f( ) = Surjections is asurjectioniff every element of B is f of something 1 arrow in A B |A| ≥|B|

  11. f( ) = A B Injections is an injection iff every element of B is f of at most 1 thing ≤ 1 arrow in total |A| ≤|B|

  12. f( ) = A B Bijections is a bijection iff it is total, surjection, injection. exactly one arrow in exactly one arrow out |A| =|B|

  13. Integers vs Positive Integers Now we can use functions to compare different sets. Question: Is the set of integers larger than the set of positive integers? Define a bijection between the positive integers and all integers 1 2 3 4 5 6 7 8 . . . 0 1 −1 2 −2 3 −3 4 . . . n/2, if n is even; −(n − 1)/2, if n is odd. f(n) = So, these two sets have the same cardinality! A set is countable if there is a surjection from natural numbers to it.

  14. Rational Numbers vs Positive Integers Question: Is the set of rational number countable? The set of “pair of integers” (a,b) is not smaller than the set of rational number. We want to show that the set of “pair of integers” is countable, by defining a surjection from natural numbers. This would then imply the set of rational is countable.

  15. Rational Numbers vs Positive Integers (0, 0), (0, 1), (0,−1), (0, 2), (0,−2), (0, 3), (0,−3), . . . (1, 0), (1, 1), (1,−1), (1, 2), (1,−2), (1, 3), (1,−3), . . . (−1, 0),(−1, 1),(−1,−1),(−1, 2),(−1,−2),(−1, 3), (−1,−3), . . . (2, 0), (2, 1), (2,−1), (2, 2), (2,−2), (2, 3), (2,−3), . . . (−2, 0),(−2, 1),(−2,−1),(−2, 2),(−2,−2), (−2, 3),(−2,−3), . . . If you map the set of positive integers to the top row first, then you will not be able to reach the second row. The trick is to visit the rational numbers diagonal by diagonal. Each diagonal is finite, so eventually every pair will be visited. Therefore, there is a surjection from the set of positive integers, to the set of pair of integers, and so we are done.

  16. Binary Strings vs Positive Integers Question: Is the set of binary strings countable? Theorem: No surjection mapping positive integers to binary strings. The string map to the first natural number The string map to the fifth natural number It can not be in any row i because its i-th bit is different, and so this string is not mapped! The opposite of the diagonal

  17. Diagonal Argument Similarly, real numbers and power sets can be shown to be uncountable. This argument is called Cantor’s diagonal argument. http://en.wikipedia.org/wiki/Cantor's_diagonal_argument This has been used in many places; for example the Russell’s paradox. Relations are more general than functions, will be discussed in tutorial.

More Related