Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CmSc 180 – Discrete mathematics Problems on Functions 1. Give an example of a function that is one-to-one but not onto 2. Give an example of a function that is onto but not one-to-one. 3. Give an example of a function that is neither one-to-one nor onto 4. Give an example of a function that is both one-to-one and onto 5. How many functions are there from A = {1,2} to B = {a, b}? Write them as sets of ordered pairs. Which are one-to-one? Which are onto? 6. Let X = {1, 2, 3, 4}, Y = {a, b, c, d}. For each of the following subsets of X x Y determine whether it is a function or not. If it is a function, determine whether it is one-to-one, onto, or both. If it is a bijection, determine its inverse function as a set of ordered pairs. A1 = {(1,a), (2,a), (3,c), (4, b)} A2 = {(1, c), (2, a), (3, b), (4, c), (2, d)} A3 = {(1, c), (2, d), (3, a), (4, b)} A4 = {(1, d), (2, d), (4, a)} A5 = {(1, b), (2, b), (3, b), (4, b)} 7. Do the following sets define functions? If so, give their domain and range: F1 = {(1, (2,3)), (2, (3,4)), (3, (1,4)), (4, (2,4))} F2 = {((1,2), 3), ((2,3), 4), ((3,3), 2)} F3 = {(1, (2,3)), (2, (3,4)), (1, (2,4))} F4 = {(1, (2,3)), (2, (2,3)), (3, (2,3))} 8. Let N be the set of all non-negative integers. Determine which of the following functions are one-to-one, which are onto, and which are one-to-one and onto: a. f: N N f(n) = n2 + 2 b. f: N N f(n) = n(mod 3) c. f: N N f(n) = 1 if n is odd, 0 if n is even d. f: N {0, 1} f(n) = 1 if n is odd, 0 if n is even 9. Let X and Y be finite sets. Find a necessary condition for the existence of one-toone mappings from X to Y. Show that if the condition is not present, there are no one-to-one mappings from X to Y. 10. Let A be a finite set. Show that any function from A to A that is one-to-one must also be onto and conversely. 11. Show that there exists a one-to-one function from A x B to B x A. Is it also onto? 12. Let g = {(1, a), (2, c), (3, a)} be a function from X = {1, 2, 3} to Y = {a, b, c, d}, and f = {(a, x), (b, x), (c, z), (d, w)} be a function from Y to Z = {w, x, y, z}. Write g f as a set of ordered pairs. 13. Let f and g be functions from N to N defined by the equations: f(n) = 2n + 1, g(n) = 3n -1 Find the compositions f f , g g, g f , and f g Hint: f g = g(f(x)) 1 14. Let f and g be functions from N to N defined by the equations: f(n) = n2 , g(n) = 2n Find the compositions f f , g g, g f , and f g Hint: f g = g(f(x)) 15. Represent each function below as a composition of simpler functions Example: Let f(x) = 2sin(x + 1) Consider the functions: g(x) = x + 1 h(x) = sin(x) k(x) = 2x f(x) is the composition (g h) k = k(h(g(x)) a. f(x) = log 2 (x2 + 2) b. f(x) = sin(2x) c. f(x) = (3 + sin (x) ) 4 d. f(x) = 2sin(x) e. f(x) = 1 / (cos(x))3 16. Let f = {(a, b), (b, a), (c, b)} be a function from X = {a, b, c} to X. Write f f and ff f 17. Let f = {(1, c), (2, a), (3, b), (4, c)}, g = {(a,2), (b,1), (c,4)}, and h = {(1,A), (2,B), (3, D), (4,D)}. Find g f, 18. Let f be a function from X to Y, and g be a function from Y to Z. consider f g – the function from X to Z (f g = g(f(x)). Prove or disprove the following statements: a. If f is one-to-one then f g is one-to-one Not true Disprove by counterexample: Let X = {1,2,3}, Y = {a,b,c}, Z = {A,B,C} f = {(1,a), (2,b), (3,c)} g = {(a,A), (b,A), (c,A)} f g = {(1,A), (2,A), (3,A)} not one-to-one b. If g is one-to-one then f g is one-to-one Not true Disprove by counterexample: Let X = {1,2,3,4}, Y = {a,b,c}, Z = {A,B,C} f = {(1,a), (2,b), (3,c), (4,c)} g = {(a,A), (b,B), (c,C)} 2 f g = {(1,A), (2,B), (3,C), (4,C)} not one-to-one c. If f and g are one-to-one then f g is one-to-one True: Proof by contradiction: Assume that f g is not one-to-one. Then there exist x1 and x2 in X, x1 x2, such that g(f(x1)) = g(f(x2)) f is one-to-one, therefore f(x1) f(x2) g is one-to-one. Therefore for any y1,y2, y1 y2, g(y1) g(y2). Therefore g(f(x1)) g(f(x2)) This contradicts the assumption that g(f(x1)) = g(f(x2)) d. If f is not one-to-one then f g is not one-to-one True Proof by contradiction Assume f g is one to one. Then g(f(x1)) g(f(x2)) for all x1 and x2, such that x1 x2 However, f is not one-to one. Hence there is at least one pair x1 and x2, x1 x2, such that f(x1) = f(x2) Therefore g(f(x1)) = g(f(x2) (because g is a function) This contradicts the assumption that g(f(x1)) g(f(x2)) e. If g is not one-to-one then f g is not one-to-one Not True Disproof by counterexample : Let X = {1,2,3}, Y = {a,b,c,d}, Z = {A,B,C} f = {(1,a), (2,b), (3,c)} g = {(a,A), (b,B), (c,C), (d,C)} f g = {(1,A), (2,B), (3,C)} one-to-one 3 f. If f g is one-to-one then f is one-to-one True Proof by contradiction. g. h. i. j. k. l. m. n. If f g is one-to-one then g is one-to-one If f and g are onto then f g is onto If f is onto then f g is onto If g is onto then f g is onto If f g is onto then f is onto If f g is onto then g is onto If f g is not onto then f is not onto If f g is not onto then g is not onto Fill your findings in a table: f g one-toonto one-toonto one one Y Y Y Y Y N Y Y N Y Y Y N N Y Y Y Y Y N Y N Y N N Y Y N N N Y N Y Y N Y Y N N Y N Y N Y N N N Y Y Y N N Y N N N N Y N N N N N N f g one-toonto one 4