220 likes | 541 Vues
CS 173: Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Rm 2213 Siebel Center Office Hours: M 11a-12p CS 173 Announcements Homework 3 returned in section this week. Homework 4 available. Due 09/24, 8a. f(x) = -(1/2)x - 25 domain co-domain CS 173 Functions
E N D
CS 173:Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Rm 2213 Siebel Center Office Hours: M 11a-12p
CS 173 Announcements • Homework 3 returned in section this week. • Homework 4 available. Due 09/24, 8a. Cs173 - Spring 2004
f(x) = -(1/2)x - 25 domain co-domain CS 173 Functions Suppose we have: And I ask you to describe the yellow function. What’s a function? Notation: f: RR, f(x) = -(1/2)x - 25 Cs173 - Spring 2004
CS 173 Functions Definition: a function f : A B is a subset of AxB where a A, ! b B and <a,b> f. Cs173 - Spring 2004
B A A point! A collection of points! CS 173 Functions Definition: a function f : A B is a subset of AxB where a A, ! b B and <a,b> f. B A Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa CS 173 Functions A = {Michael, Tito, Janet, Cindy, Bobby} B = {Katherine Scruse, Carol Brady, Mother Teresa} Let f: A B be defined as f(a) = mother(a). Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa What about the range? Some say it means codomain, others say, image. Since it’s ambiguous, we don’t use it at all. f(S) = image(S) CS 173 Functions - image & preimage For any set S A, image(S) = {b : a S, f(a) = b} So, image({Michael, Tito}) = {Katherine Scruse} image(A) = B - {Mother Teresa} Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa preimage(S) = f-1(S) CS 173 Functions - image & preimage For any S B, preimage(S) = {a: b S, f(a) = b} So, preimage({Carol Brady}) = {Cindy, Bobby} preimage(B) = A Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa S CS 173 Functions - image & preimage What is image(preimage(S))? • S • { } • subset of S • superset of S • who knows? Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa Suppose S is {Janet, Cindy} preimage(image(S)) = A CS 173 Functions - image & preimage What is preimage(image(S))? Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa CS 173 Functions - misc. properties • f() = • f({a}) = {f(a)} (this is a definition, actually) • f(A U B) = f(A) U f(B) • f(A B) f(A) f(B) Cs173 - Spring 2004
CS 173 Functions - misc. properties f(A B) f(A) f(B)? Choose an arbitrary c f(A B), and show that it must also be an element of f(A) f(B). f(A B) = {x : a (A B), f(a) = x} So, a (A B) such that f(a) = c. Since a A, f(a) = c f(A). Since a B, f(a) = c f(B). c f(A), and c f(B), so c f(A) f(B). Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa CS 173 Functions - misc. properties • f-1() = • f-1(A U B) = f-1(A) U f-1(B) • f-1(A B) = f-1(A) f-1(B) Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa Not one-to-one Every b B has at most 1 preimage. CS 173 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 Cs173 - Spring 2004
Michael Tito Janet Cindy Bobby Katherine Scruse Carol Brady Mother Teresa Not onto Every b B has at least 1 preimage. CS 173 Functions - surjection A function f: A B is onto (surjective, a surjection) if b B, a A f(a) = b Cs173 - Spring 2004
Isaak Bri Lynette Aidan Evan Isaak Bri Lynette Aidan Evan Cinda Dee Deb Katrina Dawn 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! CS 173 Functions - bijection A function f: A B is bijective if it is one-to-one and onto. Cs173 - Spring 2004
yes yes yes CS 173 Functions - examples Suppose f: R+ R+, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective? Cs173 - Spring 2004
no yes no CS 173 Functions - examples Suppose f: R R+, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective? Cs173 - Spring 2004
no no no CS 173 Functions - examples Suppose f: R R, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective? Cs173 - Spring 2004
CS 173 Functions - composition Let f:AB, and g:BC be functions. Then the composition of f and g is: (g o f)(x) = g(f(x)) Cs173 - Spring 2004
CS 173 Functions - a little problem Let f:AB, and g:BC be functions. Prove that if f and g are one to one, then g o f :AC is one to one. Recall defn of one to one: f:A->B is 1to1 if f(a)=b and f(c)=b --> a=c. Suppose g(f(x)) = y and g(f(w)) = y. Show that x=w. f(x) = f(w) since g is 1 to 1. Then x = w since f is 1 to 1. Cs173 - Spring 2004
CS 173 Functions - another Let f:AB, and g:BC be functions. Prove that if f and g are onto, then g o f :AC is onto. Cs173 - Spring 2004