Lecture 2.3: Set Theory, and Functions

Slides:



Advertisements
Similar presentations
1.6 Functions. Chapter 1, section 6 Functions notation: f: A B x in A, y in B, f(x) = y. concepts: –domain of f, –codomain of f, –range of f, –f maps.
Advertisements

Lecture 2.3: Set Theory, and Functions* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
Discrete Structures & Algorithms Functions & Asymptotic Complexity.
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
Functions.
Section 1.8: Functions A function is a mapping from one set to another that satisfies certain properties. We will first introduce the notion of a mapping.
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
2.1 Sets 2.2 Set Operations 2.3 Functions ‒Functions ‒ Injections, Surjections and Bijections ‒ Inverse Functions ‒Composition 2.4 Sequences and Summations.
9/8/2011Lecture Functions1 Lecture 2.4: Functions CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda.
Lecture 3.1: Mathematical Induction CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag.
Functions. Copyright © Peter Cappello2 Definition Let D and C be nonempty sets. A function f from D to C, for each element d  D, assigns exactly 1 element.
Discrete Mathematics CS 2610 September 12, Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates.
1 Discrete Structures – CNS 2300 Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 1 The Foundations: Logic, Sets,
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
Basic Structures: Functions Muhammad Arief download dari
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
Functions. L62 Agenda Section 1.8: Functions Domain, co-domain, range Image, pre-image One-to-one, onto, bijective, inverse Functional composition and.
Lecture 2.3: Set Theory, and Functions*
Lecture 2.2: Set Theory CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
CSC102 - Discrete Structures Functions
Functions.
1 Functions CS 202 Epp section ??? Aaron Bloomfield.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
Lecture 1.5: Proof Techniques CS 250, Discrete Structures, Fall 2012 Nitesh Saxena Adopted from previous lectures by Cinda Heeren 1.
9/27/2011 Lecture Mathematical Induction1 Lecture 3.1: Mathematical Induction* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from.
Lecture 3.4: Recursive Algorithms CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Zeph Grunschlag.
Functions Goals Introduce the concept of function
Lecture 1.5: Proof Techniques
Discrete Mathematical
Functions Section 2.3.
Lecture 4.1: Relations Basics
Lecture 1.5: Proof Techniques
Functions.
Chapter 2 Sets and Functions.
Lecture 4.3: Closures and Equivalence Relations
Discrete Math for Computer Science CSC 281
Lecture 3.2: Induction and Strong Induction (contd.)
Functions Section 2.3.
CS100: Discrete structures
Lecture 4.1: Relations Basics
Lecture 3.2: Induction, and Strong Induction
Functions.
Lecture 3.2: Induction and Strong Induction (contd.)
CS 250, Discrete Structures, Fall 2014
Lecture 3.2: Induction, and Strong Induction
CS 250, Discrete Structures, Fall 2014
CS 250, Discrete Structures, Fall 2013
CS 250, Discrete Structures, Fall 2015
CS 250, Discrete Structures, Fall 2015
Ch 5 Functions Chapter 5: Functions
Lecture 3.2: Induction, and Strong Induction
Lecture 1.6: Proof Techniques (contd)
CS 250, Discrete Structures, Fall 2015 Nitesh Saxena
Lecture 2.1: Sets and Set Operations*
CS 250, Discrete Structures, Fall 2013
Lecture 2.3: Set Theory, and Functions
CS 250, Discrete Structures, Fall 2013
Lecture 3.1: Mathematical Induction
Lecture 4.1: Relations Basics
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
Lecture 1.6: Proof Techniques (contd)
CS 250, Discrete Structures, Fall 2014 Nitesh Saxena
Lecture # 18 Types of Functions
Functions Section 2.3.
Copyright © Zeph Grunschlag,
Lecture 3.1: Mathematical Induction
CS 250, Discrete Structures, Fall 2015 Nitesh Saxena
CS 250, Discrete Structures, Fall 2015 Nitesh Saxena
CS 250, Discrete Structures, Fall 2012
Presentation transcript:

Lecture 2.3: Set Theory, and Functions CS 250, Discrete Structures, Fall 2013 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren

Lecture 2.3 -- Set Theory, and Functions Course Admin HW1 Provided the solution soon We have been grading Mid Term 1: Oct 8 (Tues) Review Oct 3 (Thu) Covers Chapter 1 and Chapter 2 HW2 coming out: early next week Due Oct 15 (Tues) 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Outline Sets: Inclusion/Exclusion Principle Functions 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

A Proof (direct and indirect) A  B =  Pv that if (A - B) U (B - A) = (A U B) then Suppose to the contrary, that A  B  , and that x  A  B. A U B =  A = B A  B =  A-B = B-A =  Then x cannot be in A-B and x cannot be in B-A. Then x is not in (A - B) U (B - A). But x is in A U B since (A  B)  (A U B). Thus, A  B = . 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

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 Wrong. What’s wrong? A B |A  B| = |A| + |B| - |A  B| 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

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? 125 173 217 - (157 + 145 - 98) = 13 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Set Theory – Generalized Inclusion/Exclusion Suppose we have: B A C Now let’s do it for 4 sets! And I want to know |A U B U C| kidding. |A U B U C| = |A| + |B| + |C| - |A  B| - |A  C| - |B  C| + |A  B  C| 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Set Theory – Generalized Inclusion/Exclusion * Image courtesy wikipedia

Lecture 2.3 -- Set Theory, and Functions Suppose we have: -50 -25 And I ask you to describe the yellow function. What’s a function? y = f(x) = -(1/2)x - 25 Notation: f: RR, f(x) = -(1/2)x - 25 co-domain domain 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

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 }. 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Function or not? A B B A 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions 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 ? 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions 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,…} 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions 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 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Functions - image set For any set S  A, image(S) = {f(a) : a  S} image(S) = f(S) For any set S  A, image(S) = {f(a) : a  S} So, image({Michael, Tito}) = {Katherine Scruse} image(A) = B - {Mother Teresa} Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa image(A) is also called range 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

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 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Every b  B has at most 1 preimage. 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 Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Functions - surjection Every b  B has at least 1 preimage. Functions - surjection A function f: A  B is onto (surjective, a surjection) if b  B, a  A, f(a) = b Not onto Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Functions - bijection A function f: A  B is bijective if it is one-to-one and onto. Every b  B has exactly 1 preimage. A B C D A- Alice Bob Tom Charles Eve Isaak Bri Lynette Aidan Evan Cinda Dee Deb Katrina Dawn An important implication of this characteristic: The preimage (f-1) is a function! 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Functions - examples Suppose f: R+  R+, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective? yes yes yes 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Functions - examples Suppose f: R  R+, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective? no yes no 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Functions - examples Suppose f: R  R, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective? no no no 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Functions - examples Q: Which of the following are 1-to-1, onto, a bijection? If f is invertible, what is its inverse? f : Z  R is given by f (x ) = x 2 f : Z  R is given by f (x ) = 2x f : R  R is given by f (x ) = x 3 f : Z  N is given by f (x ) = |x | f : {people}  {people} is given by f (x ) = the father of x. 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Functions - examples f : Z  R, f (x ) = x 2: none f : Z  Z, f (x ) = 2x : 1-1 f : R  R, f (x ) = x 3: 1-1, onto, bijection, inverse is f (x ) = x (1/3) f : Z  N, f (x ) = |x |: onto f (x ) = the father of x : none 9/6/2011 Lecture 2.3 -- Set Theory, and Functions

Lecture 2.3 -- Set Theory, and Functions Today’s Reading Rosen 2.3 and 2.4 9/6/2011 Lecture 2.3 -- Set Theory, and Functions