Chapter 5: Functions

1 / 67

# Chapter 5: Functions - PowerPoint PPT Presentation

Chapter 5: Functions. Discrete Mathematical Structures: Theory and Applications. Learning Objectives. Learn about functions Explore various properties of functions Learn about sequences and strings Become familiar with the representation of strings in computer memory

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## Chapter 5: Functions

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

### Chapter 5: Functions

Discrete Mathematical Structures:

Theory and Applications

Learning Objectives
• Explore various properties of functions
• Learn about sequences and strings
• Become familiar with the representation of strings in computer memory

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Functions
• Every function is a relation
• Therefore, functions on finite sets can be described by arrow diagrams. In the case of functions, the arrow diagram may be drawn slightly differently.
• If f : A → B is a function from a finite set A into a finite set B, then in the arrow diagram, the elements of A are enclosed in ellipses rather than individual boxes.

Discrete Mathematical Structures: Theory and Applications

Functions
• To determine from its arrow diagram whether a relation f from a set A into a set B is a function, two things are checked:
• Check to see if there is an arrow from each element of A to an element of B
• This would ensure that the domain of f is the set A, i.e., D(f) = A
• Check to see that there is only one arrow from each element of A to an element of B
• This would ensure that f is well defined

Discrete Mathematical Structures: Theory and Applications

Functions
• Let A = {1,2,3,4} and B = {a, b, c , d} be sets
• The arrow diagram in Figure 5.6 represents the relation f from A into B
• Every element of A has some image in B
• An element of A is related to only one element of B; i.e., for each a ∈ A there exists a unique element b ∈ B such that f (a) = b

Discrete Mathematical Structures: Theory and Applications

Functions
• Therefore, f is a function from A into B
• The image of f is the set Im(f) = {a, b, d}
• There is an arrow originating from each element of A to an element of B
• D(f) = A
• There is only one arrow from each element of A to an element of B
• f is well defined

Discrete Mathematical Structures: Theory and Applications

Functions
• The arrow diagram in Figure 5.7 represents the relation g from A into B
• Every element of A has some image in B
• D(g ) = A
• For each a ∈ A, there exists a unique element b ∈ B such that g(a) = b
• g is a function from A into B

Discrete Mathematical Structures: Theory and Applications

Functions
• The image of g is Im(g) = {a, b, c , d} = B
• There is only one arrow from each element of A to an element of B
• g is well defined

Discrete Mathematical Structures: Theory and Applications

Functions
• Let h be the relation described by the arrow diagram in Figure 5.8
• Every element of A has some image in B; i.e., there is an arrow originating from each element of A to an element of B. Therefore,
• D(h) = A
• However,element 1 has two images in B; i.e., there are two arrows originating from 1, one going to a and another going to b, so h is not well defined. Thus, the first condition of Definition 5.1.1 is satisfied,but the second one is not.
• Therefore, h is not a function

Discrete Mathematical Structures: Theory and Applications

Functions
• The arrow diagram in Figure 5.9 represents a relation from A into B
• Not every element of A has an image in B. For example, the element 4 has no image in B. In other words, there is no arrow originating from 4
• Therefore, 4 D(k), so D(k)  A
• This implies that k is not a function from A into B

Discrete Mathematical Structures: Theory and Applications

Functions
• Numeric Functions
• If the domain and the range of a function are numbers, then the function is typically defined by means of an algebraic formula
• Such functions are called numeric functions
• Numeric functions can also be defined in such a way so that different expressions are used to find the image of an element

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Functions

Example 5.1.16

• Let A = {1,2,3,4} and B = {a, b, c , d}. Let f : A → B be a function such that the arrow diagram of f is as shown in Figure 5.10
• The arrows from a distinct element of A go to a distinct element of B. That is, every element of B has at most one arrow coming to it.
• If a1, a2∈ A and a1= a2, then f(a1) = f(a2). Hence, f is one-one.
• Each element of B has an arrow coming to it. That is, each element of B has a preimage.
• Im(f) = B. Hence, f is onto B. It also follows that f is a one-to-one correspondence.

Discrete Mathematical Structures: Theory and Applications

Functions

Example 5.1.18

• Let A = {1,2,3,4} and B = {a, b, c , d, e}
• f : 1 → a, 2 → a, 3 → a, 4 → a
• For this function the images of distinct elements of the domain are not distinct. For example 1  2, but f(1) = a = f(2).
• Im(f) = {a} B. Hence, f is neither one-one nor onto B.

Discrete Mathematical Structures: Theory and Applications

Functions
• Let A = {1,2,3,4} and B = {a, b, c , d, e}
• f : 1 → a, 2 → b, 3 → d, 4 → e
• For this function, the images of distinct elements of the domain are distinct. Thus, f is one-one. In this function, for the element c of B, the codomain, there is no element x in the domain such that f(x) = c ; i.e., c has no preimage. Hence, f is not onto B.

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Functions
• Let A = {1,2,3,4}, B = {a, b, c , d, e},and C = {7,8,9}. Consider the functions f : A → B, g : B → C as defined by the arrow diagrams in Figure 5.14.
• The arrow diagram in Figure 5.15 describes the function h = g ◦ f : A → C.

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Functions

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Special Functions and Cardinality of a Set

Discrete Mathematical Structures: Theory and Applications

Sequences and Strings

Discrete Mathematical Structures: Theory and Applications

m is the lower limit of the sum, n the upper limit of the sum, and ai the general term of the sum

Discrete Mathematical Structures: Theory and Applications

m is the lower limit of the sum, n the upper limit of the sum, and aithe general term of the product.

Discrete Mathematical Structures: Theory and Applications

Sequences and Strings
• Representing Strings into Computer Memory
• A convenient way of storing a string into computer memory is to use an array.
• Programming languages such as C++ and Java provide a data type to manipulate strings.
• This data type includes algorithms to implement operations such as concatenation, finding the length of a string,determining whether a string is a substring in another string, and finding a substring into another string.

Discrete Mathematical Structures: Theory and Applications

Binary Operations

Discrete Mathematical Structures: Theory and Applications

Binary Operations
• Let A be an alphabet. Let A+be the set of all nonempty strings on the alphabet A. If u, v ∈ A+,i.e., u and v are two nonempty strings on A,then the concatenation of u and v, uv ∈ A+. Thus, the concatenation of strings is a binary operation on A+. Also, by Theorem 5.3.23(ii), the concatenation operation is associative.
• Hence, A+becomes a semigroup with respect to the concatenation operation.
• Called a free semigroup generated by A.

Discrete Mathematical Structures: Theory and Applications

Binary Operations
• Let A*denote the set of all words including empty word λ. By Theorem 5.3.23(i), for all s ∈ A*, λs = s = sλ. Thus, A*becomes a monoid with identity 1 = λ.
• This monoid is called a free monoid generated by A.
• If A contains more than one element, then A*is a noncommutative monoid.

Discrete Mathematical Structures: Theory and Applications