146 2 / Basic Structures: Sets, Functions, Sequences, and Sums 2-36
Example 29 illustrates that the factorial function grows extremely rapidly as n grows.
The rapid growth of the factorial function is made clearer by Stirling's formula, a result
from higher mathematics that tell us that n ! '" J2rrn(n/et . Here, we have used the notation
f(n) '" g(n), which means that the ratio f(n)/g(n) approaches 1 as n grows without bound
(that is, limn -4oo f(n)/g(n) = 1). The symbol '" is read "is asymptotic to." Stirling's formula is
named after James Stirling, a Scottish mathematician of the eighteenth century.
Exercises
1. Why is f not a function from to if
R R c) the function that assigns to a bit string the number of
a) f(x ) =
b) f(x) = .JX 1/x?? ones minus the number of zeros in the string
d) the function that assigns to each positive integer the
,.--,,.-
.-
c) f(x) ±J(x 2 + I )?
=
largest integer not exceeding the square root of the
integer
2. Determine whether f is a function from Z to if R
e) the function that assigns to a bit string the longest
b) f(n
a)
c)
f(n) n. .
) = ±J1i2+1
=
f(n) 1/(n 2 - 4).
=
string of ones in the string
7. Find the domain and range of these functions.
a) the function that assigns to each pair of positive inte
3. Determine whether f is a function from the set of all bit
gers the maximum of these two integers
strings to the set of integers if
a) f(S) isis the position of a 0 bit in S.
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
b) f(S
f(S) the number o f 1 bits i n S. not appear as decimal digits of the integer
c) ) i s the smallest integer i such that the ith bit of
S is 1 and f(S) = 0 when S is the empty string, the
c) the function that assigns to a bit string the number of
times the block 1 1 appears
string with no bits. d) the function that assigns to a bit string the numerical
4. Find the domain and range of these functions. Note that position of the first 1 in the string and that assigns the
in each case, to find the domain, determine the set of ele value 0 to a bit string consisting of all Os
ments assigned values by the function. 8. Find these values.
a) the function that assigns to each nonnegative integer l.1 J b) r -01 . 11 1
LL -O.l J
a)
its last digit
b)
the function that assigns the next largest integer to a
c)
e) r2 .991
d)
1)
rr -2.99· 1 1
positive integer
c) the function that assigns to a bit string the number of
g) L ! + r!l J h) r L! J + r! 1 + ! 1
one bits in the string 9. Find these values.
d) the function that assigns to a bit string the number of a) r�l- b) L�J
bits in the string
5. Find the domain and range of these functions. Note that
c)
e)
r �l
r3 1
d)
1)
LL --lJ� J
in each case, to find the domain, determine the set of ele
ments assigned values by the function.
g) L! + r � 1 J h) L! ' L � J J
10. Determine whether each of these functions from
a) the function that assigns to each bit string the number {a, b, c, d} to itself is one-to-one.
of ones minus the number of zeros a) f(a ) = b, f(b) = a, f(c) = c, f(d) = d
b) b) f(a
f(a) = d,b, f(b b, f(c) d, f(d)
) = f(b)) == b, f(c) == c, f(d) == dc
the function that assigns to each bit string twice the
number of zeros in that string c)
c) the function that assigns the number of bits left over
1 1 . Which functions in Exercise 1 0 are onto?
when a bit string is split into bytes (which are blocks
of 8 bits) 12. Determine whether each of these functions from Z to Z
d) the function that assigns to each positive integer the is one-to-one.
largest perfect square not exceeding this integer a) f(n
f(n )) = nn 3- 1
= f(n) == nn2 +2 1
b) f(n)
6. Find the domain and range of these functions. c) d) r11
a) the function that assigns to each pair of positive inte 13. Which functions in Exercise 1 2 are onto?
gers the first integer of the pair 14. Determine whether f: Z x Z � Z is onto if
b)
the function that assigns to each positive integer its
largest decimal digit
a)
b) f(m, n) = m 2 - nn.2 •
f(m, n ) = 2m -
2-3 7 2.3 Functions 147
c) f(m,
f(m, n ) == mI m + n I+n 1 .
n) 26. Let S = { - I , 0, 2, 4, 7 } . Find f(S) if
d)
e) f(m, n ) = m 2l -- 4. l. a) f(x) = 1 .
c) f(x) = fx /5 l
b) f(x) = 2x + 1 .
d) f(x) = L(x 2 + I )/3J .
15. Detennine whether the function f: Z xZ � Z is onto if 27. Let f(x) = Lx 2 /3J . Find f(S) if
a)
b)
f(m,
f(m, n ) == mm 2++n.n2 •
n) -
a) S = { 2, - 1 , 0, 1 , 2, 3 } .
b ) S = {O, 1 , 2, 3 , 4, 5 } .
c) f(m, n ) = m. c ) S = { l , 5 , 7, l l } .
d)
e)
f(m, n) = I n l .
f(m , n ) = m - n .
d) S = {2, 6 , 1 0, 1 4 } .
28. Let f(x) = 2x . What is
16. Give an example of a function from N to N that is
a) f(Z)? b) f(N)? c) f(R)?
a) one-to-one but not onto.
29. Suppose that g is a function from A to B and f is a func
b) onto but not one-to-one.
tion from B to C .
c) both onto and one-to-one (but different from the iden
a) Show that i f both f and g are one-to-one functions,
tity function).
d) neither one-to-one nor onto.
then f o g is also one-to-one.
b) Show that if both f and g are onto functions, then
17. Give an explicit fonnula for a function from the set of
f o g is also onto.
integers to the set of positive integers that is
*30. If f and f o g are one-to-one, does it follow that g is
a) one-to-one, but not onto.
one-to-one? Justify your answer.
b) onto, but not one-to-one.
*31 . If f and f o g are onto, does it follow that g is onto?
c) one-to-one and onto.
d) neither one-to-one nor onto.
Justify your answer.
32. Find f o g and g 0 f, where f(x) = x 2 + 1 and g(x) =
18. Detennine whether each of these functions is a bijection
from R to R. x + 2, are functions from R to R.
33. Find f + g and fg for the functions f and g given in
a) f(x) = -3x + 4
b) f(x) = -3x 2 + 7 Exercise 32.
c) f(x) = (x + I )/(x + 2) a d,
34. Let f(x) = x + b and g(x) = ex + where b, e, and
d d a, a,
are constants. Detennine for which constants b, e,
d) f(x) = x 5 + I
19. Detennine whether each of these functions is a bijection and it is true that f o g = g 0 f.
from R to R.
a a
35. Show that the function f(x) = x + b from R to R is
a
invertible, where and b are constants, with #- 0, and
a) f(x) = 2x + 1
b) f(x) = x 2 + 1
find the inverse of f.
c) f(x) = x3 36. Let f be a function from the set A to the set B. Let S and
d) f(x) = (x 2 + I )/(x 2 + 2) T be subsets of A . Show that
20. Let f: R � R and let f(x) > 0 for all x E R. Show a) f(S U T ) = f(S) U f(T ).
that f(x) is strictly increasing if and only if the function b) f(S n T) c;:: f(S) n f(T ).
g(x) = 1 /f(x) is strictly decreasing. 37. Give an example to show that the inclusion in part (b) in
21. Let f: R � R and let f(x) > O. Show that f(x) is strictly Exercise 36 may be proper.
decreasing if and only if the function g(x) = 1 /f(x) is Let f be a function from the set A to the set B . Let S be a
strictly increasing. subset of B . We define the inverse image of S to be the subset
22. Qive an example of an increasing function with the set of A whose elements are precisely all pre-images of all ele
of real numbers as its domain and codomain that is not ments of S. We denote the inverse image of S by f - I (S), so
one-to-one. a I a
f - I (S) = { E A f( ) E S } . (Beware: The notation f - I is
used in two different ways. Do not confuse the notation intro
23. Give an example of a decreasing function with the set
of real numbers as its domain and codomain that is not
duced here with the notation f - I (y) for the value at y of the
inverse of the invertible function f. Notice also that f - I (S),
one-to-one.
the inverse image of the set S, makes sense for all functions f,
24. Show that the function f(x) = eX from the set of real
number to the set of real numbers is not invertible, but
not just invertible functions.)
38. Let f be the function from R to R defined by
if the codomain is restricted to the set of positive real f(x) = x 2 • Find
numbers, the resulting function is invertible.
a) f - I ({ I }). b) f - I ({x 1 0 < x < I }).
25. I
Show that the function f(x) = x I from the set of real
numbers to the set of nonnegative real numbers is not
c) f - I ({x I x > 4}) .
invertible, but if the domain is restricted to the set 39. Let g(x) = LxJ . Find
of nonnegative real numbers, the resulting function is a) g - I ({O}). b) g - I ({- I , O, I }).
invertible. - I
c) g ({X 1 0 < x < I }).