0% found this document useful (0 votes)
73 views

Exercises - Functions and Relations - With Answers

The document contains information about functions, relations, and operations on relations. It includes examples of functions with their domains, codomains, and ranges. Relations are defined between sets and operations like selection, projection, intersection, union, difference, cross join, and natural join are performed on the relations. The document provides examples and tables to illustrate the concepts of functions and relations.

Uploaded by

069443909
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Exercises - Functions and Relations - With Answers

The document contains information about functions, relations, and operations on relations. It includes examples of functions with their domains, codomains, and ranges. Relations are defined between sets and operations like selection, projection, intersection, union, difference, cross join, and natural join are performed on the relations. The document provides examples and tables to illustrate the concepts of functions and relations.

Uploaded by

069443909
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Errors might occur.

Please notify the teacher if you find one 

Functions
1) Consider the diagrams ( ), ( ) and ( ) below.

 Which of the diagrams represent functions?


Answer: Only the diagram in (c) represents a function.
 Identify the domain, codomain and range for those that represent functions.
Answer: The domain of the function in (c) is { , , }, the codomain is { , , , } and
the range is { , }.

2) The diagram below show the composition of the two functions and : ∘

Use the diagram to determine


a) The domain of ∘ Answer: { , , }
b) The codomain of ∘ Answer: { , , , , }
c) The range of ∘ Answer: { , , , }
d) ( ∘ )( ) Answer: ( ∘ )( ) =
e) What do the range of and the domain of have to fulfill in order for the composite function
∘ to make sense? Answer: The range of has to be a subset of the domain of .
3) For each of the functions below, determine whether the depicted function is injective, surjective
and/or bijective.

Answer:
: Not injectiive, not surjective, not bijective.
: Surjective, not injective, not bijective.
: Injective, not surjective, not bijective.
: Not injective, not surjective, not bijective.
: Injective, surjective and bijective.

4) Which of the functions depicted in exercise 3) have inverse functions? For each of the functions
which has an inverse, draw a diagram of the inverse function.
Answer: Only the function has an inverse function:
Consider the function : {−2, −1, 0, 1, 2} → ℤ defined by ( ) = | |.
a. Draw a graph of the function.

Answer:

b. Draw a table over the function.

Answer:
Relations
5) Consider the binary relation between the sets = {1, 2, 3} and = { , , , } given by =
{(1, ), (1, ), (3, ), (3, )}.
a. Draw an arrow diagram of .
b. Draw a table over

Answer:

6) Consider the binary relation from the set = {1,2,3,4} to the set = {0,3,5,8} defined by
( , ) ∈ for ( , ) ∈ × iff ≤ .
a. Draw an arrow diagram of the relation
b. Write as a subset of ×
Answer: = {( , ), ( , ), ( , ), ( , ), ( , ), ( , ), ( , ), ( , ), ( , ), ( , ), ( , ), }
c. Draw a table over the relation
Anwer (a and c):
7) Consider the relations Actors, Directors and Movies given below.

Name Title Title Year Rating


Name Title

Pacino Godfather Godfather 1972 9.2


Coppola Godfather

Pacino Godfather II Godfather II 1974 9.0


Coppola Godfather II

Bale Dark Knight Dark Knight 2008 9.0


Nolan Dark Knight

Travolta Pulp Fiction 12 Angry Men 1957 8.9


Tarantino Pulp Fiction

Tarantino Pulp Fiction

Carry out the following operations (hint: if you do not want to write big tables by hand, you can copy and
modify the tables from this document instead) :
a) Selection: Title Pulp Fiction (Actors)
Answer:

Name Title

Travolta Pulp Fiction

Tarantino Pulp Fiction

b) Projection: Π , (Movies)

Answer:

Title Year

Godfather 1972

Godfather II 1974

Dark Knight 2008

12 Angry Men 1957

c) Intersection: Directors ∩ Actors (if possible)

Answer:

Name Title

Tarantino Pulp Fiction

d) Union: Actors ∪ Movies (if possible)


Not possible!
e) Difference: Directors − Actors (if possible)

Answer:

Name Title

Coppola Godfather

Coppola Godfather II

Nolan Dark Knight

f) The cross join: Actors × Movies

Answer:

Actors.Name Actors.Title Movies.Title Movies.Year Movies.Rating


Pacino Godfather Godfather 1972 9.2
Pacino Godfather Godfather II 1974 9.0
Pacino Godfather Dark Knight 2008 9.0
Pacino Godfather 12 Angry Men 1957 8.9
Pacino Godfather II Godfather 1972 9.2
Pacino Godfather II Godfather II 1974 9.0
Pacino Godfather II Dark Knight 2008 9.0
Pacino Godfather II 12 Angry Men 1957 8.9
Bale Dark Knight Godfather 1972 9.2
Bale Dark Knight Godfather II 1974 9.0
Bale Dark Knight Dark Knight 2008 9.0
Bale Dark Knight 12 Angry Men 1957 8.9
Travolta Pulp Fiction Godfather 1972 9.2
Travolta Pulp Fiction Godfather II 1974 9.0
Travolta Pulp Fiction Dark Knight 2008 9.0
Travolta Pulp Fiction 12 Angry Men 1957 8.9
Tarantino Pulp Fiction Godfather 1972 9.2
Tarantino Pulp Fiction Godfather II 1974 9.0
Tarantino Pulp Fiction Dark Knight 2008 9.0
Tarantino Pulp Fiction 12 Angry Men 1957 8.9
g) Natural join: Actors ⋈ Movies
Answer:

Name Title Year Rating


Pacino Godfather 1972 9.2
Pacino Godfather II 1974 9.0
Bale Dark Knight 2008 9.0

You might also like