DMTuto 3 Functions
DMTuto 3 Functions
Partial Functions
A program designed to evaluate a function may not produce the correct value of the function for
all elements in the domain of this function. For example, a program may not produce a correct
value because evaluating the function may lead to an infinite loop or an overflow. Similarly, in
abstract mathematics, we often √ want to discuss functions that are defined only for a subset of
the real numbers, such as 1/x, x, and arcsin (x). Also, we may want to use such notions as
the “youngest child” function, which is undefined for a couple having no children, or the “time
of sunrise,” which is undefined for some days above the Arctic Circle. To study such situations,
we use the concept of a partial function.
DEFINITION 13 A partial function f from a set A to a set B is an assignment to each element a in a subset
of A, called the domain of definition of f , of a unique element b in B. The sets A and B are
called the domain and codomain of f , respectively. We say that f is undefined for elements
in A that are not in the domain of definition of f . When the domain of definition of f equals
A, we say that f is a total function.
▲
Exercises
1. Why is f not a function from R to R if 5. Find the domain and range of these functions. Note that
a) f (x) = 1/x? in each case, to find the domain, determine the set of
√ elements assigned values by the function.
b) f (x) = x?
c) f (x) = ± (x 2 + 1)? a) the function that assigns to each bit string the number
of ones in the string minus the number of zeros in the
2. Determine whether f is a function from Z to R if
string
a) f (n) = ±n.√
b) f (n) = n2 + 1. b) the function that assigns to each bit string twice the
number of zeros in that string
c) f (n) = 1/(n2 − 4).
3. Determine whether f is a function from the set of all bit c) the function that assigns the number of bits left over
strings to the set of integers if when a bit string is split into bytes (which are blocks
of 8 bits)
a) f (S) is the position of a 0 bit in S.
b) f (S) is the number of 1 bits in S. d) the function that assigns to each positive integer the
c) f (S) is the smallest integer i such that the ith bit of largest perfect square not exceeding this integer
S is 1 and f (S) = 0 when S is the empty string, the 6. Find the domain and range of these functions.
string with no bits. a) the function that assigns to each pair of positive inte-
4. Find the domain and range of these functions. Note that gers the first integer of the pair
in each case, to find the domain, determine the set of b) the function that assigns to each positive integer its
elements assigned values by the function. largest decimal digit
a) the function that assigns to each nonnegative integer c) the function that assigns to a bit string the number of
its last digit ones minus the number of zeros in the string
b) the function that assigns the next largest integer to a
positive integer d) the function that assigns to each positive integer the
largest integer not exceeding the square root of the
c) the function that assigns to a bit string the number of
integer
one bits in the string
d) the function that assigns to a bit string the number of e) the function that assigns to a bit string the longest
bits in the string string of ones in the string
P1: 1
CH02-7T Rosen-2311T MHIA017-Rosen-v5.cls May 13, 2011 10:24
29. Show that the function f (x) = |x| from the set of real inverse of the invertible function f . Notice also that f −1 (S),
numbers to the set of nonnegative real numbers is not the inverse image of the set S, makes sense for all functions f ,
invertible, but if the domain is restricted to the set of non- not just invertible functions.)
negative real numbers, the resulting function is invertible. 42. Let f be the function from R to R defined by
30. Let S = {−1, 0, 2, 4, 7}. Find f (S) if f (x) = x 2 . Find
a) f (x) = 1. b) f (x) = 2x + 1. a) f −1 ({1}). b) f −1 ({x | 0 < x < 1}).
c) f (x) = x /5. d) f (x) =(x 2 + 1)/3. c) f −1 ({x | x > 4}).
31. Let f (x) = x 2 /3. Find f (S) if 43. Let g(x) = x. Find
a) S = {−2, −1, 0, 1, 2, 3}. a) g −1 ({0}). b) g −1 ({−1, 0, 1}).
−1
c) g ({x | 0 < x < 1}).
b) S = {0, 1, 2, 3, 4, 5}.
c) S = {1, 5, 7, 11}. 44. Let f be a function from A to B. Let S and T be subsets
d) S = {2, 6, 10, 14}. of B. Show that
a) f −1 (S ∪ T ) = f −1 (S) ∪ f −1 (T ).
32. Let f (x) = 2x where the domain is the set of real num- b) f −1 (S ∩ T ) = f −1 (S) ∩ f −1 (T ).
bers. What is
a) f (Z)? b) f (N)? c) f (R)? 45. Let f be a function from A to B. Let S be a subset of B.
Show that f −1 (S) = f −1 (S).
33. Suppose that g is a function from A to B and f is a
46. Show that x + 21 is the closest integer to the number x,
function from B to C.
except when x is midway between two integers, when it
a) Show that if both f and g are one-to-one functions, is the larger of these two integers.
then f ◦ g is also one-to-one.
47. Show that x − 21 is the closest integer to the number x,
b) Show that if both f and g are onto functions, then except when x is midway between two integers, when it
f ◦ g is also onto. is the smaller of these two integers.
∗ 34. If f and f ◦ g are one-to-one, does it follow that g is 48. Show that if x is a real number, then x − x = 1 if x
one-to-one? Justify your answer. is not an integer and x − x = 0 if x is an integer.
∗ 35. If f and f ◦ g are onto, does it follow that g is onto? 49. Show that if x is a real number, then x − 1 < x ≤ x ≤
Justify your answer. x < x + 1.
36. Find f ◦ g and g ◦ f , where f (x) = x 2 + 1 and g(x) = 50. Show that if x is a real number and m is an integer, then
x + 2, are functions from R to R. x + m = x + m.
37. Find f + g and fg for the functions f and g given in 51. Show that if x is a real number and n is an integer, then
Exercise 36. a) x < n if and only if x < n.
b) n < x if and only if n < x.
38. Let f (x) = ax + b and g(x) = cx + d, where a, b, c,
and d are constants. Determine necessary and suffi- 52. Show that if x is a real number and n is an integer, then
cient conditions on the constants a, b, c, and d so that a) x ≤ n if and only if x ≤ n.
f ◦ g = g ◦ f. b) n ≤ x if and only if n ≤ x.
39. Show that the function f (x) = ax + b from R to R is 53. Prove that if n is an integer, then n/2 = n/2 if n is even
invertible, where a and b are constants, with a = 0, and and (n − 1)/2 if n is odd.
find the inverse of f .
54. Prove that if x is a real number, then −x = −x and
40. Let f be a function from the set A to the set B. Let S and −x = −x.
T be subsets of A. Show that
55. The function INT is found on some calculators, where
a) f (S ∪ T ) = f (S) ∪ f (T ). INT(x) = x when x is a nonnegative real number and
b) f (S ∩ T ) ⊆ f (S) ∩ f (T ). INT(x) = x when x is a negative real number. Show
that this INT function satisfies the identity INT(−x) =
41. a) Give an example to show that the inclusion in part (b)
−INT(x).
in Exercise 40 may be proper.
b) Show that if f is one-to-one, the inclusion in part (b) 56. Let a and b be real numbers with a < b. Use the floor
in Exercise 40 is an equality. and/or ceiling functions to express the number of inte-
gers n that satisfy the inequality a ≤ n ≤ b.
Let f be a function from the set A to the set B. Let S be a
57. Let a and b be real numbers with a < b. Use the floor
subset of B. We define the inverse image of S to be the subset
and/or ceiling functions to express the number of inte-
of A whose elements are precisely all pre-images of all ele-
gers n that satisfy the inequality a < n < b.
ments of S. We denote the inverse image of S by f −1 (S), so
f −1 (S) = {a ∈ A | f (a) ∈ S}. (Beware: The notation f −1 is 58. How many bytes are required to encode n bits of data
used in two different ways. Do not confuse the notation intro- where n equals
duced here with the notation f −1 (y) for the value at y of the a) 4? b) 10? c) 500? d) 3000?
P1: 1
CH02-7T Rosen-2311T MHIA017-Rosen-v5.cls May 13, 2011 10:24
59. How many bytes are required to encode n bits of data 72. Suppose that f is a function from A to B, where A and B
where n equals are finite sets with |A| = |B|. Show that f is one-to-one
a) 7? b) 17? c) 1001? d) 28,800? if and only if it is onto.
60. How many ATM cells (described in Example 28) can be 73. Prove or disprove each of these statements about the floor
transmitted in 10 seconds over a link operating at the fol- and ceiling functions.
lowing rates? a) x = x for all real numbers x.
a) 128 kilobits per second (1 kilobit = 1000 bits) b) 2x = 2x whenever x is a real number.
b) 300 kilobits per second c) x + y − x + y = 0 or 1 whenever x and y are
c) 1 megabit per second (1 megabit = 1,000,000 bits) real numbers.
61. Data are transmitted over a particular Ethernet network d) xy = x y for all real numbers x and y.
x x+1
in blocks of 1500 octets (blocks of 8 bits). How many e) = for all real numbers x.
blocks are required to transmit the following amounts of 2 2
data over this Ethernet network? (Note that a byte is a 74. Prove or disprove each of these statements about the floor
synonym for an octet, a kilobyte is 1000 bytes, and a and ceiling functions.
megabyte is 1,000,000 bytes.) a) x = x for all real numbers x.
a) 150 kilobytes of data b) x + y = x + y for all real numbers x and y.
b) 384 kilobytes of data c) √ x/2 /2 = √x/4 for all real numbers x.
c) 1.544 megabytes of data d) x = x for all positive real numbers x.
d) 45.3 megabytes of data e) x + y + x + y ≤ 2x + 2y for all real
62. Draw the graph of the function f (n) = 1 − n2 from Z numbers x and y.
to Z. 75. Prove that if x is a positive real number, then
63. Draw the graph of the function f (x) = 2x from R √ √
a) √x = √x .
to R. b) x = x .
64. Draw the graph of the function f (x) = x/2 from R 76. Let x be a real number. Show that 3x =
to R. x + x + 13 + x + 23 .
65. Draw the graph of the function f (x) = x + x/2 from 77. For each of these partial functions, determine its domain,
R to R. codomain, domain of definition, and the set of values for
66. Draw the graph of the function f (x) = x + x/2 from which it is undefined. Also, determine whether it is a total
R to R. function.
67. Draw graphs of each of these functions. a) f : Z → R, f (n) = 1/n
a) f (x) = x + 21 b) f (x) = 2x + 1 b) f : Z → Z, f (n) = n/2
c) f (x) = x/3 d) f (x) = 1/x c) f : Z × Z → Q, f (m, n) = m/n
e) f (x) = x − 2 + x + 2 d) f : Z × Z → Z, f (m, n) = mn
f ) f (x) = 2xx/2 g) f (x) = x − 21 + 21 e) f : Z × Z → Z, f (m, n) = m − n if m > n
68. Draw graphs of each of these functions. 78. a) Show that a partial function from A to B can be viewed
a) f (x) = 3x − 2 b) f (x) = 0.2x as a function f ∗ from A to B ∪ {u}, where u is not an
c) f (x) = −1/x d) f (x) = x 2 element of B and
e) f (x) = x/2x/2 f ) f (x) = x/2 + x/2 ⎧
g) f (x) = 2 x/2 + 21 ⎨f (a) if a belongs to the domain
69. Find the inverse function of f (x) = x 3 + 1. f ∗ (a) = of definition of f
⎩u if f is undefined at a.
70. Suppose that f is an invertible function from Y to Z
and g is an invertible function from X to Y . Show
that the inverse of the composition f ◦ g is given by b) Using the construction in (a), find the function f ∗
(f ◦ g)−1 = g −1 ◦ f −1 . corresponding to each partial function in Exercise 77.
71. Let S be a subset of a universal set U . The characteristic 79. a) Show that if a set S has cardinality m, where m is a
function fS of S is the function from U to the set {0, 1} positive integer, then there is a one-to-one correspon-
such that fS (x) = 1 if x belongs to S and fS (x) = 0 if x dence between S and the set {1, 2, . . . , m}.
does not belong to S. Let A and B be sets. Show that for b) Show that if S and T are two sets each with m ele-
all x ∈ U , ments, where m is a positive integer, then there is a
a) fA∩B (x) = fA (x) · fB (x) one-to-one correspondence between S and T .
b) fA∪B (x) = fA (x) + fB (x) − fA (x) · fB (x) ∗ 80. Show that a set S is infinite if and only if there is a proper
c) fA (x) = 1 − fA (x) subset A of S such that there is a one-to-one correspon-
d) fA⊕B (x) = fA (x) + fB (x) − 2fA (x)fB (x) dence between A and S.