html5-img
1 / 20

Functions

Functions. Functions. Definition : A function f from set A to set B , denoted f : A → B, is an assignment of each element of A to exactly one element of B . We write f ( a ) = b if b is the unique element of B assigned to the element a of A . .

jaeger
Télécharger la présentation

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

  2. Functions • Definition: A functionf from set A to set B, denoted f: A→B,is an assignment of each element of A to exactly one element of B. • We writef(a) = bif b is the unique element of B assigned to the element a of A. • Functions are also called mappings Students Grades A Carlota Rodriguez B Sandeep Patel C Jalen Williams D F Kathy Scott

  3. Functions Given a function f: A→ B • A is called the domain of f • B is called the codomain of f • f is a mapping from Ato B • If f(a) = b • then bis called the image of aunder f • a is called the preimage of b • The range (or image) of f is the set of all images of points in A. We denote it by f(A).

  4. Example A B • The domain of f is A • The codomain of f is B • The image of b is y • f(b) = y • The preimage of y is b • The preimageof z is {a,c,d} • The range/image of A is {y,z} • f(A) = {y,z} a x b y c z d

  5. Representing Functions • Functions may be specified in different ways: • An explicit statement of the assignment. • Students and grades example. • A formula. • f(x) = x+ 1 • A computer program. • A Java program that when given an integer n, produces the nth Fibonacci Number

  6. Injections B A • Definition: A function f is one-to-one, or injective, iffa ≠ b implies that f(a) ≠ f(b) for all a and b in the domain of f. x a v b y c z d w

  7. Surjections A B • Definition: A function f from A to B is called onto or surjective, iff for every element b ∈ B there exists an element a ∈A with f(a) = b x a b y c z d

  8. Bijections A B • Definition: A function f is a one-to-one correspondence, or a bijection, if it is both one-to-one and onto (surjective and injective) a x b y c z d w

  9. Showing that f is/is not injective or surjective • Consider a function f: A→ B • f is injectiveiff: ∀x,y∈ A ( x ≠ y → f(x) ≠ f(y) ) • f is not injective iff: ∃x,y∈ A( x ≠ y ∧ f(x) = f(y) ) • fis surjectiveiff: ∀y ∈ B ∃x ∈ A( f(x) = y ) • f is not surjectiveiff: ∃y ∈ B ∀x ∈ A (f(x) ≠ b)

  10. Inverse Functions • Definition: Let f be a bijection from A to B. Then the inverse of f, denoted f –1, is the function from B to Adefined as • No inverse exists unless f is a bijection.

  11. Inverse Functions • Example 1: • Let f be the function from {a,b,c} to {1,2,3} • f(a)=2, f(b)=3, f(c)=1. • Is f invertible and if so what is its inverse? • Solution: • fis invertible because it is a bijection • f –1reverses the correspondence given by f: • f –1(1)=c, f –1(2)=a, f –1(3)=b.

  12. Inverse Functions • Example 2: • Let f: R→Rbe such that f(x) = x2 • Is f invertible, and if so, what is its inverse? • Solution: • The function f is not invertible because it is not one-to-one

  13. Inverse Functions • Example 3: • Let f: Z  Zbe such that f(x) = x + 1 • Is f invertible and if so what is its inverse? • Solution: • The function f is invertible because it is a bijection • f –1reverses the correspondence: • f –1(y) = y – 1

  14. Composition • Definition: Let f: B→C, g: A→B. The composition of f with g, denoted f∘g is the function from A to C defined by

  15. Composition A g B f C A C v a h a b i h w c b i j x d c j y d

  16. Composition • Example: If and then and

  17. Graphs of Functions • Let f be a function from the set A to the set B. The graph of the function f is the set of ordered pairs {(a,b) | a ∈Aandf(a) = b} Graph of f(x) = x2 from Z to Z Graph of f(n) = 2n+1 from Z to Z

  18. Some Important Functions • The floor function, denoted is the largest integer less than or equal to x. • The ceilingfunction, denoted is the smallest integer greater than or equal to x • Examples:

  19. Some Important Functions Floor Function (≤x) Ceiling Function (≥x)

  20. Factorial Function • Definition: f: N → Z+, denoted by f(n) = n! is the product of the first n positive integers: f(n) = 1 ∙ 2 ∙∙∙ (n–1) ∙ nforn>0 f(0) = 0! = 1 • Examples: • f(1) = 1! = 1 • f(2) = 2! = 1 ∙ 2 = 2 • f(6) = 6! = 1 ∙ 2 ∙ 3 ∙ 4 ∙ 5 ∙ 6 = 720 • f(20) = 2,432,902,008,176,640,000

More Related