7. Find the domain and range of these functions

Let’s revisit relevant definitions that will help us solve this exercise.

“If f is a function from A to B, we say that A is the domain of f and B is the codomain of f. If f (a) = b, we say that b is the image of a and a is a preimage of b. The range, or image, of f is the set of all images of elements of A. Also, if f is a function from A to B, we say that f maps A to B.” Discrete Mathematics and its Applications by Rosen.

Table of Contents

a) the function that assigns to each pair of positive integers the maximum of these two integers

Notice that the function assigns a value to each pair of positive integers. We can represent every pair of positive integers by the cartesian product Z+ x Z+.

The value that is assigned to each pair (the image) is the maximum between the two integers in the pair. In other words, the image is a positive integer (as per the description of the exercise), therefore the range is the set of all positive integers.

Answer:

Domain: Z+ × Z+ ; range: Z+

b) the function that assigns to each positive integer the number of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 that do not appear as decimal digits of the integer

As per the description above, the function assigns a value to each positive integer. Therefore, the domain is the set of positive integers.

The value that is assigned to each element of the domain, belongs to the set of digits {0,1,2,…,9}. Therefore, the previous set is the range.

Answer:

Domain: Z+ ; range: {0,1,2,3,4,5,6,7,8,9}

c) the function that assigns to a bit string the number of times the block 11 appears

As per the function definition, it assigns a value to a bit string without specifying any special requirement of the bit string. Therefore, the domain is the set of bit strings.

The function assigns to each element of the image, the number of times a specific block appears in the string. Being a number, this is the set of nonnegative numbers.

Answer:

Domain: the set of bit strings; range: the set of nonnegative numbers (consider as the set of natural numbers N by some authors)

d) the function that assigns to a bit string the numerical position of the first 1 in the string and that assigns the value 0 to a bit string consisting of all 0s

For the same reason as the previous exercise, the domain in this case is the set of bit strings.

This function assigns to each element of the domain a numerical position of the first 1, or 0 if there is no 1. Therefore, the range is 0 U Z+, also known as the set of nonnegative integers, or the set of natural numbers N.

Notice that some authors specify the set of natural numbers N as a set that does not include the 0, and others include the 0. So, every time that you use N, it would be good to state your position as to whether 0∈N or not.

Answer:

Domain: the set of bit strings; range: the set of nonnegative numbers

Related exercises: