Skip to content

DA2. Exercises on Functions

Question 1

Make sure you use a two-lined representation of a function using the sets A and B of your choice and include the following items in your discussion:

let A = {1, 2, 3} and B = {4, 5, 6, 7} asd f: A -> B such that f={(1, 4), (2, 5), (3, 6)}

  1. How did you determine that it is indeed a function?

According to the definition of function provided in (Doerr, 2022, chapter 7.1), a function is a relation between two sets A and B such that each element in A is related to exactly one element in B. In other words, for each element in A, there is an image in B, and no element in A is related to more than one element in B.

In the example above, according to the definition of function f the elements of A (called the domain), 1, 2, 3 has 4, 5, 6 of B (called the codomain) as their images. Also, no element in A has more than one image in B. Therefore, f is a function.

Note that there is an element in the codomain that is not an image of any element in the domain. This is not a problem, and it is not a requirement by the function definition.

  1. Share your opinion on whether it is one-one and onto explain, why?

According to (Doerr, 2022, chapter 7.2), a function is one-one or injective, if every element in the domain has a unique image in the codomain, that is, no two elements in the domain have the same image in the codomain. which is achieved in our function f above as f={(1, 4), (2, 5), (3, 6)} we see that 1,2,3 have unique images 4,5,6 respectively.

Also according to (Doerr, 2022, chapter 7.2), a function is onto or surjective, if every element in the codomain is an image of at least one element in the domain, that is, no element in the codomain is left without an image. which is NOT achieved in our function f above as f={(1, 4), (2, 5), (3, 6)} we see that element 7 in the codomain has no image in the domain.

So our function f is one-one but NOT onto, that is, injective but not surjective.

  1. Does it have an inverse? Justify your choice with the above representation.

According to (Doerr, 2022, chapter 7.3), a function has an inverse if it is bijective, that is, it is both injective and surjective. In our function f above, we have shown that it is injective but not surjective, therefore it does not have an inverse.

  1. Discuss the images of each element in the function you defined.

We discussed the images in the previous questions. The images of each element in the function are:

f(1) = 4, f(2) = 5, f(3) = 6


Question 2

Explain the concepts of function, injective function, surjective function, and bijective function, and provide examples and counterexamples for each.

Function is a relationship between two sets, called the domain and the codomain, such that each element in the domain is related to exactly one element in the codomain. In other words, for each element in the domain, there is an image in the codomain, and no element in the domain is related to more than one element in the codomain (Levin, 2021, chapter 0.4). An example of a function is the function f defined as f={(1, 4), (2, 5), (3, 6)} where the domain is A = {1, 2, 3} and the codomain is B = {4, 5, 6, 7} (see question 1 above) while a counter example would be g={(1,4), (1,5)} of the same domain and codomain (A and B respectively).

Injective function is a function that is one-one, that is, every element in the domain has a unique image in the codomain, that is, no two elements in the domain have the same image in the codomain (Doerr, 2022, chapter 7.2). An example of an injective function is the function f defined as f={(1, 4), (2, 5), (3, 6)} where the domain is A = {1, 2, 3} and the codomain is B = {4, 5, 6, 7} (see question 1 above) while a counter example would be g={(1,4), (2,4)} of the same domain and codomain (A and B respectively).

Surjective function is a function that is onto, that is, every element in the codomain is an image of at least one element in the domain, that is, no element in the codomain is left without an image (Doerr, 2022, chapter 7.2). An example of a surjective function is the function f defined as f={(1, 4), (2, 5), (3, 6)} where the domain is A = {1, 2, 3} and the codomain is B = {4, 5, 6} (note that we deleted the 7 from B), and a counter example would be the same function used in the first question.

Bijective function is a function that is both injective and surjective, that is, it is one-one and onto (Doerr, 2022, chapter 7.3). An example of a bijective function is the function f defined as f={(1, 4), (2, 5), (3, 6)} where the domain is A = {1, 2, 3} and the codomain is B = {4, 5, 6} (note that we deleted the 7 from B) while a counter example would be our example in the first question.


References

  • Doerr, A., & Levasseur, K. (2022). Applied discrete structures (3rd ed.). licensed under CC BY-NC-SA. https://discretemath.org/ads/chapter_7.html
  • Levin, O. (2021). Discrete mathematics: An open introduction (3rd ed.). licensed under CC 4.0.