1 / 30

Functions

Functions. Reading: Chapter 6 (94 – 107) from the text book. What is a function?. A function is an input/output rule defined on some set. Example : the rule that takes as input a student in this class, and produces as output that student’s age.

Download Presentation

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. Functions Reading: Chapter 6 (94 – 107) from the text book

  2. What is a function? • A function is an input/output rule defined on some set. • Example : the rule that takes as input a student in this class, and produces as output that student’s age. • Intuitively: a function from A to B is a way to transform each element of A into an element of B

  3. What is a function? • Two conditions must be satisfied: 1- Each input must produce some output. 2- A single input will always produce not more thanoneoutput.

  4. Relations and functions A function can be thought of as a special kind of relation – we get this relation by simply taking the set of all pairs: (input, output) for every possible input. • Formally: a function from A to B is a relation on A × Bsuch that for allx ∈ A there exists exactly one element y of B such that (x, y) is in the relation

  5. Functions as lists of pairs Let A = {1, 2, 3} and B = {a, b, c, d, e}.Consider the relation g ⊆ A × B : g = {(1, d), (2, c), (3, c)} This is a function – each element of A is paired with a single element of B (both 2 and 3 are paired with c but that’s allowed).

  6. Functions as lists of pairs By contrast h = {(1, a), (3, c), (1, d)} is not a function, because 1 is paired with two things, and 2 isn’t paired with anything. Exercise :Which of the following relations on {a, b, c} × {1, 2, 3} are functions: R1 = {(a, 1), (a, 2), (b, 3), (c, 2)} R2 = {(a, 1), (b, 2), (c, 1)} R3 = {(a, 1), (c, 2)}

  7. Function notation When we have a function such as g defined previously, we often write it in the following way: g : A⟶B (g from A to B) g(1) = d g(2) = c g(3) = d Read “gof1is equal to d” and so on. This notation is only used for functions and not for more general relations.

  8. Arrow diagram • Arrow diagrams are used to depict functions for which input sets are finite. • Example : Let A={1, 2, 3} and B={1, 2, 3, 4}.Let f : A B, f(1)=3, f(2)=2, f(3)=2. Draw an arrow diagram for this function. A B 1 1 2 2 3 3 4

  9. Functions and formulas • It is actually rare to specify a function as a list of pairs. • More usually, we give a rule or formula that makes it possible to work out the value (output) of a function on any given element of its domain(input). • For instance, we can define a function f ⊆R×Rby the formula: f(x) = x2 + 3

  10. Functions and formulas • To work out the value of the function we just substitute in the formula: f(4) = 42 + 3 = 16 + 3 = 19 • or in another way of writing the same thing (4, 19)  f.We could also write: f = {(x, x2 + 3)  x R}

  11. Domain, codomain and range • The domain of a function is the set of its allowed inputs. • The co-domain of a function is the set in which we guarantee its outputs lie. • The range of a function is the actual set of its outputs.

  12. Domain, codomain and range • To see the difference between the last two concepts consider f : R →Rdefined by f(x) = x2 • Its co-domain is R but its range is the set of non-negative real numbers.

  13. Terminology • Let f be a function from A to B. Let x ∈ A • The image of x under f, denoted by f(x), is the only element of B such that (x, f(x)) ∈ f • Intuitively, ftransformsx into f(x) • The domain of f is A • the codomain of f is B • The range of f is {f(x) : x ∈ A}

  14. Identity and constant functions • If the output of a function is always the same, no matter what the input is, then the function is called a constant function. • Examplef : R→Rdefined by f(x) = 42 for all x. • Also, given any set A, there is a special function called the identity function on A, and usually denoted iA, which has no effect on its input. That is: iA(x) = x for all x  A.

  15. Equality of functions • If f and g are functions from A to B then f = g if, for every a  A, f(a) = g(a). • For example: f, g : R→R f(x) = (x + 1)2 - 2x g(x) = x2 + 1 • These are equal functions because for any real number x: f(x) = (x + 1)2 - 2x = x2 + 2x + 1 - 2x= x2 + 1= g(x)

  16. One to One functions • A function, f, is called one to oneor one-one if, whenever a  b, then f(a)  f(b). • That is, for any two distinctinputs of the function, the outputs are also distinct. • Put another way, if f(a) = f(b), then necessarily a=b.

  17. One to One functions Exercise For each of the following functions from {a, b, c, d} to {1, 2, 3, 4},decide whether it is one to one or not: R1 = {(a, 1), (d, 3), (b, 2), (c, 4)} R2 = {(a, 1), (b, 2), (c, 3), (d, 2)} Example The function g : R→Rdefined by g(x) = 3x + 1 is one-one.

  18. One to One functions • In fact, it is one to one because If g(a) = g(b) then 3a + 1 = 3b + 1, and so 3a = 3b, and finally a = b. • On the other hand, the function f : R→Rdefined by f(x) = x2+x+2 is not one to one because f(0) =2 = f(-1) but 0  -1.

  19. Onto functions • A function, g : A → B, is called onto or if, for every b  B there is at least one a  A such that g(a) = b. Exercise For each of the following functions from {a, b, c, d} to {1, 2, 3, 4},decide whether it is onto or not: R1 = {(a, 1), (d, 3), (b, 2), (c, 4)} R2 = {(a, 1), (b, 2), (c, 3), (d, 2)}

  20. Onto functions • A function is onto, if it’s range is equal to its co-domain. Example • The function h : R→Rdefined by h(x) = 5x -2 is onto because, for given b R we can take a =(b + 2)/5 and then: h(a) = 5a - 2= 5(b + 2)/5 - 2= b + 2 - 2 = b • However, f : R →Rdefined by f(x) = x2is not onto because, there is noa R such that f(a)=-1

  21. One-One correspondences • A function that is both one to one and onto is called a one-one correspondence • If f : A → B is a one-one correspondence then, for every b  B there is exactly one a  A such that f(a) = b. • The identity function on any set A is always one-one correspondence.

  22. One to One, Onto, One-One correspondence • Let f be a function from A to B • f is one to oneiff for all x, y ∈ A, if x y, then f(x) f(y) • f is ontoiff for all y ∈ B, there exists x ∈ A such that f(x) = y • f is one-one correspondenceifff is both one to one and onto

  23. Composition of functions • Suppose that f : A → B and g : B → C are functions (the domain of g matches the co-domain of f ) • We can string them together, using the output of one rule as input to the next. • This operation is known as composition of functions

  24. Composition of functions • Then, given a  A we can take b = f(a) and then c = g(b). • This association: a ↦ b ↦ c i.e. a ↦ f(a) ↦ g(f(a)) defines a function h : A → C called the composite or composition of f and g. We write h = g ⃘f. Very important: the function that is applied second is written first.

  25. Examples of composition • Let f, g : R→Rbe given by f(x) = 3x - 1 and g(x) = x2 + 1. Then: (g ⃘f)(x)= (3x - 1)2 + 1 • The composite of g and f is really obtained by substituting the value of f for the argument of g. • Note in this case, we could form the “other” composite: (f ⃘g)(x) = f(g(x)) = f(x2 + 1)= 3(x2 + 1) - 1 And that this is not equal to g ⃘f.

  26. Rules of composition • Let f : A → B, g : B → C and h : C → D be functions. Then: f ⃘iA = f = iB ⃘f h ⃘(g ⃘f) = (h ⃘g) ⃘f • Also, if bothf and g are one-one then so is g⃘f. Likewise, if both are onto so is g⃘f.

  27. Inverse of a function • Remember that we can think of a function f : A → B as a relation, that is, as a subset of A × B. Specifically: f = {(a, f(a))  a  A} • For a general relation, we can define the notion of its inverse obtained by “flipping” all the ordered pairs belonging to it: f-1 = {(f(a), a)  a  A}

  28. Exercise For each of the following functions from {a, b, c, d} to {1, 2, 3, 4},find the inverse relation and decide whether it is a function or not: R1 = {(a, 1), (d, 3), (b, 2), (c, 4)} R2 = {(a, 1), (b, 2), (c, 3), (d, 2)} For the function from {a, b, c} to {1, 2, 3, 4}, R3 = {(a, 1), (b, 2), (c, 3)},find the inverse relation and decide whether it is a function or not.

  29. Inverse of a function • It seems natural to ask: What conditions, if any, do we need to impose on f in order to ensure that f-1 is a function?. TheoremLet f : A → B be a function. The inverse relation f-1 : B → A is a function if and only if f is a one-to-one correspondence. • Note that, if f-1 is a function, then : for all a  A, f-1(f(a)) = a, and for all b  B, f(f-1(b)) = b.

  30. Inverse relations and invertible functions • Let R be a relation on A × B • The inverse of R, denoted by R−1, is defined as follows: R−1 = {(y, x) : x, y ∈ R} • Let f be a function from A to B • As f is a relation, we can form the inverse relation f−1 • If f−1 is also a function, we say that f is invertible and call f−1 the inverse function

More Related