386
Relations, Functions, and Matrices
The next example defines two functions that are sometimes useful in analyzing algorithms.
PRaCtiCe 25 Let the function defined by the wff A ` (B ~ C′) be denoted by f. What is f (T, T, F )?
What is f (F, T, F )?
example 32
The floor function :x; associates with each real number x the greatest integer less
than or equal to x. The ceiling function
smallest integer greater than or equal to x. Thus :2.8; = 2, <2.8= = 3, :−4.1; = −5,
and <−4.1= = −4. Both the floor function and the ceiling function are functions
from R to Z.
PRaCtiCe 26
a. Sketch a graph of the function :x;.
b. Sketch a graph of the function
■
example 33
For any integer x and any positive integer n, the modulo function, denoted by
f (x) = x mod n, associates with x the nonnegative remainder when x is divided by
n. We can write x as x = qn + r, 0 ≤ r < n, where q is the quotient and r is the
remainder, so the value of x mod n is r.
25 = 12 # 2 + 1 so 25 mod 2 = 1
21 = 3 # 7 + 0 so 21 mod 7 = 0
15 = 3 # 4 + 3 so 15 mod 4 = 3
−17 = (−4) # 5 + 3 so −17 mod 5 = 3
(it is true that
−17 = (−3)5 + (−2)
but remember that the
remainder must be
nonnegative)
Section 5.6 discusses some of the many applications of the modulo function.
The definition of a function f: S S T includes three parts—the domain set S,
the codomain set T, and the association itself. Is all this necessary? Why can’t we
simply write an equation, like g(x) = x
3
, to define a function?
The quickest answer is that not all functional associations can be described by
an equation (see Example 30, for instance). But there is more to it—let’s limit our
attention to situations where an equation can be used to describe the association,
such as g: R S R where g(x) = x
3
. Even in algebra and calculus, it is common to
say “consider the function g(x) = x
3
,” implying that the equation is the function.
Technically, the equation only describes a way to compute associated values. The
function h: R S R given by h(x) = x
3
− 3x + 3(x + 5)−15 is the same function as g because it contains the same ordered pairs. However, the equation is
different in that it says to process any given x value differently.
■
Relations, Functions, and Matrices
The next example defines two functions that are sometimes useful in analyzing algorithms.
PRaCtiCe 25 Let the function defined by the wff A ` (B ~ C′) be denoted by f. What is f (T, T, F )?
What is f (F, T, F )?
example 32
The floor function :x; associates with each real number x the greatest integer less
than or equal to x. The ceiling function
and <−4.1= = −4. Both the floor function and the ceiling function are functions
from R to Z.
PRaCtiCe 26
a. Sketch a graph of the function :x;.
b. Sketch a graph of the function
example 33
For any integer x and any positive integer n, the modulo function, denoted by
f (x) = x mod n, associates with x the nonnegative remainder when x is divided by
n. We can write x as x = qn + r, 0 ≤ r < n, where q is the quotient and r is the
remainder, so the value of x mod n is r.
25 = 12 # 2 + 1 so 25 mod 2 = 1
21 = 3 # 7 + 0 so 21 mod 7 = 0
15 = 3 # 4 + 3 so 15 mod 4 = 3
−17 = (−4) # 5 + 3 so −17 mod 5 = 3
(it is true that
−17 = (−3)5 + (−2)
but remember that the
remainder must be
nonnegative)
Section 5.6 discusses some of the many applications of the modulo function.
The definition of a function f: S S T includes three parts—the domain set S,
the codomain set T, and the association itself. Is all this necessary? Why can’t we
simply write an equation, like g(x) = x
3
, to define a function?
The quickest answer is that not all functional associations can be described by
an equation (see Example 30, for instance). But there is more to it—let’s limit our
attention to situations where an equation can be used to describe the association,
such as g: R S R where g(x) = x
3
. Even in algebra and calculus, it is common to
say “consider the function g(x) = x
3
,” implying that the equation is the function.
Technically, the equation only describes a way to compute associated values. The
function h: R S R given by h(x) = x
3
− 3x + 3(x + 5)−15 is the same function as g because it contains the same ordered pairs. However, the equation is
different in that it says to process any given x value differently.
■
