Download presentation
Presentation is loading. Please wait.
Published byGinger Nichols Modified over 9 years ago
1
Lecture 2.3: Set Theory, and Functions* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren
2
9/6/2011 Lecture 2.3 -- Set Theory, and Functions2 Course Admin Slides from previous lectures all posted HW1 Posted Due at 11am 09/09/11 Please follow all instructions Recall: late submissions will not be accepted Word Equation editor; Open Office; Alt-Codes Please pick up your competency exams, if you haven’t done so
3
9/6/2011 Lecture 2.3 -- Set Theory, and Functions3 Outline Sets: Inclusion/Exclusion Principle Functions
4
9/6/2011 Lecture 2.3 -- Set Theory, and Functions4 Suppose to the contrary, that A B , and that x A B. A Proof (direct and indirect) Pv that if (A - B) U (B - A) = (A U B) then Then x cannot be in A-B and x cannot be in B-A. But x is in A U B since (A B) (A U B). A B = Thus, A B = . a)A U B = b)A = B c)A B = d)A-B = B-A = Then x is not in (A - B) U (B - A).
5
9/6/2011 Lecture 2.3 -- Set Theory, and Functions5 Set Theory - Inclusion/Exclusion Example: How many people are wearing a watch? a How many people are wearing sneakers? b How many people are wearing a watch OR sneakers? a + b What’s wrong? A B Wrong. |A B| = |A| + |B| - |A B|
6
9/6/2011 Lecture 2.3 -- Set Theory, and Functions6 Set Theory - Inclusion/Exclusion Example: There are 217 cs majors. 157 are taking cs125. 145 are taking cs173. 98 are taking both. How many are taking neither? 217 - (157 + 145 - 98) = 13 125 173
7
9/6/2011 Lecture 2.3 -- Set Theory, and Functions7 Set Theory – Generalized Inclusion/Exclusion Suppose we have: And I want to know |A U B U C| A B C |A U B U C| = |A| + |B| + |C| + |A B C| - |A B| - |A C| - |B C| Now let’s do it for 4 sets! kidding.
8
9/6/2011 Lecture 2.3 -- Set Theory, and Functions8 Set Theory - Generalized Inclusion/Exclusion For sets A 1, A 2,…A n we have:
9
9/6/2011 Lecture 2.3 -- Set Theory, and Functions9 Functions Suppose we have: And I ask you to describe the yellow function. Notation: f: R R, f(x) = -(1/2)x - 25 What’s a function? y = f(x) = -(1/2)x - 25domain co-domain -50 -25
10
9/6/2011 Lecture 2.3 -- Set Theory, and Functions10 Functions: Definitions 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 }.
11
9/6/2011 Lecture 2.3 -- Set Theory, and Functions11 Function or not? A B A B
12
9/6/2011 Lecture 2.3 -- Set Theory, and Functions12 Functions: examples Ex: 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 ?
13
9/6/2011 Lecture 2.3 -- Set Theory, and Functions13 Functions: examples 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 = {0,1,4,9,16,25,…}
14
9/6/2011 Lecture 2.3 -- Set Theory, and Functions14 Functions: examples A = {Michael, Tito, Janet, Cindy, Bobby} B = {Katherine Scruse, Carol Brady, Mother Teresa} Let f: A B be defined as f(a) = mother(a). Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
15
9/6/2011 Lecture 2.3 -- Set Theory, and Functions15 Functions - image set For any set S A, image(S) = {f(a) : a S} So, image({Michael, Tito}) = {Katherine Scruse} image(A) = B - {Mother Teresa} image(A) is also called range image(S) = f(S) Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
16
9/6/2011 Lecture 2.3 -- Set Theory, and Functions16 Functions – preimage set For any S B, preimage(S) = {a A: f(a) S} So, preimage({Carol Brady}) = {Cindy, Bobby} preimage(B) = A preimage(S) = f -1 (S) Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
17
9/6/2011 Lecture 2.3 -- Set Theory, and Functions17 Functions - image & preimage sets What is image(preimage(S))? a) S b) { } c) subset of S d) superset of S e) who knows? S Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
18
9/6/2011 Lecture 2.3 -- Set Theory, and Functions18 Functions - image & preimage sets What is preimage(image(S))? Suppose S is {Janet, Cindy} preimage(image(S)) = A Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
19
9/6/2011 Lecture 2.3 -- Set Theory, and Functions19 Functions: images and preimages Ex: f : Z R with f (x ) = x 2 Q1: Calculate f –1 (3) Q2: Calculate f –1 (4) Q3: Calculate f ( {-9,-5,-3,0,1,2,3,4} ) Q4: Calculate f –1 ({-9,-5,-3,0,0.25,1,2,2.25,3,4})
20
9/6/2011 Lecture 2.3 -- Set Theory, and Functions20 Functions: images and preimages Ex: f : Z R with f (x ) = x 2 A1: f –1 (3) = A2: f –1 (4) = {-2, 2} A3: f ( {-9,-5,-3,0,1,2,3,4} ) = {81,25,9,0,1,4,16} A4:f –1 ({-9,-5,-3,0,0.25,1,2,2.25,3,4}) = {0,-1,1,-2,2 }
21
9/6/2011 Lecture 2.3 -- Set Theory, and Functions21 Functions - injection A function f: A B is one-to-one (injective, an injection) if a,b,c, (f(a) = b f(c) = b) a = c Not one-to-one Every b B has at most 1 preimage. Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
22
9/6/2011 Lecture 2.3 -- Set Theory, and Functions22 Functions - surjection A function f: A B is onto (surjective, a surjection) if b B, a A, f(a) = b Not onto Every b B has at least 1 preimage. Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa
23
9/6/2011 Lecture 2.3 -- Set Theory, and Functions23 Functions - bijection A function f: A B is bijective if it is one-to-one and onto. Isaak Bri Lynette Aidan Evan Cinda Dee Deb Katrina Dawn Every b B has exactly 1 preimage. An important implication of this characteristic: The preimage (f -1 ) is a function! Alice Bob Tom Charles Eve A B C D A-
24
9/6/2011 Lecture 2.3 -- Set Theory, and Functions24 Functions - examples Suppose f: R + R +, f(x) = x 2. Is f one-to-one? Is f onto? Is f bijective? yes
25
9/6/2011 Lecture 2.3 -- Set Theory, and Functions25 Functions - examples Suppose f: R R +, f(x) = x 2. Is f one-to-one? Is f onto? Is f bijective? noyesno
26
9/6/2011 Lecture 2.3 -- Set Theory, and Functions26 Functions - examples Suppose f: R R, f(x) = x 2. Is f one-to-one? Is f onto? Is f bijective? no
27
9/6/2011 Lecture 2.3 -- Set Theory, and Functions27 Functions - 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.
28
9/6/2011 Lecture 2.3 -- Set Theory, and Functions28 Functions - 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 : none
29
9/6/2011 Lecture 2.3 -- Set Theory, and Functions29 Today’s Reading Rosen 2.3 and 2.4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.