- 81 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Discrete Math' - sidney

**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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Functions

- Let A and B be nonempty sets. A function from A to B is an assignment of exactly one element of B to each element of A.
- We write f(a) = b if b is the unique element of B assigned by the function f to the element a of A.
- If f is a function from A to B we write

f : A → B

- Functions may also be called mappings or transformations

Example: not a function

- y=x ∓ 3 x ∈ A, y ∈ B
- B= {-4, -3, -2, 2, 3, 4} A= {-1, 0, 1}

x ∈ A y ∈ B

1 3 More than one element of

0 4 B is assigned to one element

2 in A. This occurs for one or

-1 -3 more elements in A

-2

-4

Example: a function

- f(x) = x3 + 2 = y x ∈ A, y ∈ B
- A= {1,2,3,4} B= {3, 10, 29, 66, 100}

x ∈ A y ∈ B

1 3

2 29

100

3 66

4 10

Relation

- We should notice that a function f: A→B is a relation between two sets A and B。 A relation is a subset of the set AxB
- Each ordered pair in AxB has as its first element a value a ∈ A, and as its second element b ∈ B where b=f(a).
- For a relation that is also a function, the subset of AxB contains 1 ordered pair containing, as its first element, each element of A

Example: a function / relation

- f(x) = x3 + 2 = y x ∈ A, y ∈ B
- A= {1,2,3,4} B= {3, 10, 29, 66, 100}
- Relation is a subset of AxB
- f(x) as a relation
- {(1,3), (2,10), (3,29), (4,66) } ⊆ AxB
- Note that there can be at least as many different functions (relations) between classes A and B as there are subsets of AxB

Example: a function / relation

- f(x, y) = x2 + y = z x ∈ A, y ∈ B z ∈ C
- A= {1,2,3} B= { 1, 2 }
- C= {2, 3, 5, 6, 10, 11, 100}
- Relation is a subset of AxBxC
- {(1,1,2),(1,2,3),(2,1,5),(2,2,6),(3,1,10),(3,1,11) } ⊆ AxBxC
- Note that there can be at least as many different functions (relations) between classes A B and C as there are subsets of AxBxC

Example: a function / relation

- f(x) = x3 + 2 = y x ∈Z, y ∈ Z
- Relation is a subset of ZxZ
- {…, (-1,3),(0,2),(1,3), (2,10), (3,29), (4,66), … } ⊆ZxZ
- Note that there can be an infinite number of relations between class Z and itself (Z) as there are an infinite number of subsets of ZxZ

Domain and Codomain

- When we consider any function f from set A to set B we say
- The domain is the set A
- The codomain is the set B
- When we write f as f(a) = b we say
- b is the image of a
- a is the preimage of b

Equal functions

- Two functions are equal when
- the domain of both functions is the same set
- the codomain of both functions is the same set
- The mapping from the domain to the codomain maps the same element of the domain to the same element of the codomain
- Note that two equal functions describe the same relation

Range

- The range of a function f from set A to set B, f: A → B, is the subset of B containing images of all elements in set A
- The range may be written f(A)

f(A) = { b | b = f(a), a ∈ A }

- The range is a subset of the codomain

Onto functions

- A function f is onto when the range of the function is the same set as the domain of the function. A function f from set A to set B is onto iff ∀b ∈ B ∃a ∈ A with f(a)=b
- When a function is onto every possible image is a member of B
- When a function is onto every member of B is an image of a member of A
- An onto function may also be called a surjective function

Example: onto

- Every element of B is an image of at least one element in A, Every element in A has an image in B

1 3

2 29

3 66

4 10

Example: onto

- Every element of B is an image of at least one element in A, Every element in A has an image in B

1 3

2 29

5

3 66

4 10

Example: not onto

- Every element in A has an image in B
- Not onto, one of the elements of B is not an image of an element in A

1 3

2 29

55

3 66

4 10

One to one functions

- Let f be a function from set A to set C. f is one to one iff ∀a ∀b a ∈ A, b ∈ A,

f(a) = f(b) → a = b

- Each image can have only one preimage
- AND
- Each preimage can have only one image
- A one to one function is also called a injective function

Example: one to one

- Every element of B is the preimage of one element in A, Every element in A has one image in B f(a)=f(b) iff a=b

1 3

2 29

3 66

4 10

Example: one to one

- Every element in A has an image in B image in B has one preimage in A
- f(a) = f(b) iff a=b

1 3 Not every element

2 29 of B must be an

55 image of a element

3 66 in A

4 10

Example: not one to one

- One element of B is the image of two elements in A
- f(6)=f(1) but 6 ≠ 1

1 3

2 29

6

3 66

4 10

One to one correspondence

- A function f from set A to set B is said to be a one to one correspondence when the function f is both one to one and onto
- A function that is a one to one correspondence is also refered to as a bijection

Example

- Consider the function f(x) = 2*x-1 from Z to Z
- the domain of the function is Z
- The codomain of the function is Z
- The range is the subset of Z containing all integers that satisfy f(x) (all the images, no even integers)
- The range is a subset of the codomain
- The function is not onto range ≠ codomain
- The function is one to one
- The function is not both one to one and onto. Therefore, it is not a one to one correspondence

Example (cont)

- Consider the function f(x) = 2*x-1 from Z to Z
- Not every element in the codomain is in the range.
- Each unique element of the domain maps to a unique element in the range
- …

0 -1

0

1 1

2

2 3

4

…

Another Example

- Consider the function f(x) = 2*x-1= y from Z to F
- the domain of the function is Z
- The codomain of the function is F

F = { y | x ∈ Z, y = 2*x-1 }

- The range of f(x) is F
- The function is onto because

range = codomain

- The function is one to one
- The function is a one to one correspondence

Your turn

- Explain why the following are or are not functions. If they are functions, explain why they are or are not, onto functions, one to one functions, or one to one relationships
- Domain: Z Codomain Z
- y = x
- y = 12 - 2 * x
- y = |x|
- y =
- y = x2

Your turn: solution (1)

- Consider the function f(x) = x from Z to Z
- the domain of the function is Z
- The codomain of the function is Z
- Each unique element of the domain maps to the same unique element in the range: Range isZ.
- range = codomain function is onto
- Also, each element in the range is an image of a single element in the domain. The function is one to one
- The function is a one to one correspondence

Your turn: solution (2)

- Consider the function f(x) = 12 - 2 * x from Z to Z
- the domain and codomain of the function are Z
- Not every element in the codomain is in the range. For example 9, is in Z but not the range
- Each unique element of the domain maps to a unique element in the range
- range ≠ codomain function is not onto
- Also, each element in the range is an image of a single element in the domain.. The function is one to one
- The function is not a one to one correspondence because it is not onto

Your turn: solution (2+)

- Consider the function f(x) = 12 - 2 * x from Z to Z
- Not every element in the codomain is in the range.
- Each element (preimage) in the domain maps to a unique element (image) in the range. Each image is the image of one preimage.
- …

0 12

1 11

10

9

2 8

…

Your turn: solution (3)

- Consider the function f(x) = y = |x| from Z to Z
- Not every element in the codomain is in the range. For example -9, is in Z but not the range
- Each unique element of the domain maps to an element in the range, but both x and –x map to the same number (two images map to the same preimage)
- range ≠ codomain function is not onto
- Two elements (x and –x) map to a single element in the range. The function is not one to one
- The function is not a one to one correspondence because it is not onto and it is not one to one

Your turn: solution (3+)

- Consider the function f(x) = y = |x| from Z to Z
- Not every element in the codomain is in the range.
- Each unique element of the domain maps to a unique element in the range but both x and –x map to the same number
- …

-2 -2

-1 -1

0 0

1 1

2 2

…

Your turn: solution (4)

- Consider f(x) = from Z to Z
- Remember the definition of a function
- Let A and B be nonempty sets. A function from A to B is an assignment of exactly one element of B to each element of A.
- In this case there are two values of f(x) for each value of x. If x=4 f(x) = 2 or -2. So two elements in B correspond to the same element in A.
- Some values of x have more than one image. This is not a function (Also some have no image, )

Your turn: solution (4+)

- f(x) = This is not a function
- Two elements in B correspond to the same element in A.
- Some elements in A have no images in B
- …

-4 -2

-1 -1

0 0

1 1

4 2

…

Your turn: solution (5)

- Consider the function f(x) = y = x2from Z to Z
- Not every element in the codomain is in the range. For example -9, is in Z but not the range
- Each unique element of the domain maps to an element in the range, but both x and –x map to the same number
- range ≠ codomain function is not onto
- Two elements (x and –x) map to a single element in the range. The function is not one to one
- The function is not a one to one correspondence because it is not onto and it is not one to one nor onto

Increasing /decreasing functions

- A function whose domain and codomain are subsets of the set of real numbers, and for which x and y are elements of the domain and x<y
- is called increasing if f(x) ≤ f(y)
- is called strictly increasing if f(x) <f(y)
- is called decreasing if f(x) ≥ f(y)\
- is called strictly decreasing if f(x) > f(y)

Your turn

- Which of the following functions are increasing?
- Which of the following functions are decreasing?
- Which are strictly decreasing? Strictly increasing?
- Why or why not?
- Domain: Z+ Codomain Z+
- z = x
- z = 12 - 2 * x
- z = max(12, x)
- z = 23

Your turn

- Domain: Z+ Codomain Z+
- z = x
- Strictly increasing If x< y then f(x) < f(y)
- z = 12 - 2 * x
- Strictly decreasing if x<y then f(x) > f(y)
- z = max(12, x)
- Increasing If x< y then f(x) ≤ f(y)
- z = 23
- Decreasing (or increasing)
- This function type of function is called constant

Identity function

- The function that maps each member of a set A to itself. The identity function for a set A is written iA
- iA (x) = x iA : A → A
- The identity function is one to one and onto, it is a bijection

Inverse of a function

- Let f be a function that is a one to one correspondence from A to B. The inverse of function f is the function that assigns an element b belonging to B to the unique element a of A such that f(a)=b.
- The inverse function of f is denoted f-1
- f-1(b) = a

When does an inverse exist?

- A function can only have an inverse if it is both one to one and onto
- If the function is not one to one, the potential inverse will not be a function because two values of b ∈ B may map to the same a ∈ A.
- If the function is not onto, then there may be elements of B that are not images of elements in A. There will be no values for a potential inverse to assign to these elements.

Invertible functions

- A function is invertible when it is a one to one correspondence
- It is one to one
- It is onto
- Otherwise the function is not invertible since the inverse function does not exist

Example: inverse

- f(x) = x + 4
- Domain Z range Z f(x): Z→Z
- f(x) is onto, each value of x ∈Z has one image y ∈Z
- f(x) is one to one, each y ∈Z, alsohas one preimage x ∈Z
- f-1(y) = y - 4

Another example: inverse

- f(x) = x2
- Domain Z
- Range=Codomain A ={ y| x ∈ Z, y= x2}
- f(x) is onto, each value of x ∈Z has one image y ∈ A
- f(x) is one to one, each value of y ∈ A also has one preimage x in Z
- f-1(y) = the positive square root of y

Combining functions

- We can combine functions into more complicated functions using the following operations
- Addition f(x) = g(x) + h(x)
- Multiplication f(x) = g(x)h(x)
- Composition f(x) = g(x) ° h(x)

Addition and Multiplication

- Let g(x) and h(x) be functions from A to ℝ.
- Then f(x), the sum of g(x) and h(x), is also a function from A to ℝ defined by
- f(x) = (g+h)(x) = g(x) + h(x)
- Then f(x), the product of g(x) and h(x), is also a function from A to ℝ defined by
- f(x) = (gh)(x) = g(x) h(x)

Composition of functions

- Let g be a function from the set A to the set B. Let h be a function from set B to set C. The composition of the functions g and h, denoted g ° h, is defined by
- f(x) = (g ° h)(x) = g(h(x))
- The composition of a function with its inverse gives the identity function

Example: composition

- g(x) = 4x+4 g: A → B h(x) = x2 h: B → C
- d(x) = (g ° h)(x)

= g(x2)

= 4x2 + 2

- e(x) = ( h ° g )(x)

= h(4x+4)

= (4x+4)2

Another example: composition

- g(x) = 4x+4 g: A → B
- h(x) = (x/4 - 1) h: B → A
- d(x) = (g ° h)(x)

= g(4x+4) = (4x + 4)/4 – 1 = x

- d(x) = iA h(x) = g-1(x)
- e(x) = ( h ° g )(x)

= h(x/4 - 1) = 4(x/4 – 1) + 4 = x

- e(x) = iB g(x) = h-1(x)

Floor and Ceiling

- The floor function assigns to the real number x the largest integer that is less than or equal to x.
- The value of the floor function at x is denoted by
- The ceiling function assigns to the real number x the smallest integer that is greater than or equal to x.
- The value of the floor function at x is denoted by

Download Presentation

Connecting to Server..