4. Find the domain and range of these functions. Note that in each case, to find the domain, determine the set of elements assigned values by the function.

Let’s first review the relevant definition to solve this exercise.

Definition: “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.

a) the function that assigns to each nonnegative integer its last digit

If the function assigns a value to each nonnegative integer, that is the domain, the set of nonnegative integers.

The values assigned by the function are digits. So, that is the range, the set of digits.

Answer:

Domain: nonnegative integer.

Range: the set {0,1,2,3,4,5,6,7,8,9}.

b) the function that assigns the next largest integer to a positive integer

If the function assigns values to a positive integer, that is the domain, the set of positive integers (Z+).

The value assigned to each integer is the next largest integer. So, that is the range, the set of positive integers.

Answer:

Domain: Z+.

Range: Z+.

c) the function that assigns to a bit string the number of one bits in the string

If the function assigns values to a bit string, without specifying length or composition, then the domain is the set of bit strings.

This function assigns to a bit string, the number of 1 bits. Therefore, the range is the set of nonnegative numbers (it can also have 0 one bits).

Answer:

Domain:  the set of bit strings.

Range: nonnegative integers.

d) the function that assigns to a bit string the number of bits in the string

If the function assigns values to a bit string, without specifying length or composition, then the domain is the set of bit strings.

This function assigns to a bit string, the number of bits. Therefore, the range is the set of nonnegative numbers (it can also have 0 bits if it is the null bit string).

Answer:

Domain:  the set of bit strings.

Range: nonnegative integers.

Related exercises: