R. Johnsonbaugh_ Discrete Mathematics 5th edition_ 2001 by yurtgc548

VIEWS: 0 PAGES: 12

• pg 1
```									                          Functions
p   A function f from X to Y (in
symbols f : X ® Y) is a
relation from X to Y such that
Dom(f) = X and if two pairs
(x,y) and (x,y’) Î f, then y = y’

n   Example:
Dom(f) = X = {a, b, c, d},
Rng(f) = {1, 3, 5}
f(a) = f(b) = 3, f(c) = 5, f(d) = 1.
Domain and Range
n Domain of f = X
n Range of f =
{ y | y = f(x) for some x ÎX}
n A function f : X ® Y assigns to
each x in Dom(f) = X a unique
element y in Rng(f) Í Y.
n Therefore, no two pairs in f have
the same first coordinate.
Modulus operator
p Let x be a nonnegative integer and y a positive
integer
p r = x mod y is the remainder when x is divided by
y
Examples:
1 = 13 mod 3
6 = 234 mod 19
4 = 2002 mod 111
p   mod is called the modulus operator
One-to-one functions
p A function f : X ® Y is one-to-one Û
for each y Î Y there exists at most one x Î X
with f(x) = y.
p Alternative definition: f : X ® Y is one-to-one Û
for each pair of distinct elements x1, x2 Î X there
exist two distinct elements y1, y2 Î Y such that
f(x1) = y1 and f(x2) = y2.
Examples:
n 1. The function f(x) = 2x from the set of real numbers to itself is
one-to-one
n 2. The function f : R ® R defined by f(x) = x2 is not one-to-one,
since for every real number x, f(x) = f(-x).
Onto functions

A function f : X ® Y is onto Û
for each y Î Y there exists at least one x Î X
with f(x) = y, i.e. Rng(f) = Y.
n   Example: The function f(x) = ex from the set of real
numbers to itself is not onto Y = the set of all real
numbers. However, if Y is restricted to Rng(f) = R +,
the set of positive real numbers, then f(x) is onto.
Bijective functions

A function f : X® Y is bijective Û
f is one-to-one and onto
n   Examples:
p   1. A linear function f(x) = ax + b is a bijective function from
the set of real numbers to itself
p   2. The function f(x) = x3 is bijective from the set of real
numbers to itself.
Inverse function
p Given a function y = f(x), the inverse f -1 is the
set {(y, x) | y = f(x)}.
p The inverse f -1 of f is not necessarily a
function.
n   Example: if f(x) = x2, then f -1 (4) = Ö4 = ± 2, not a
unique value and therefore f is not a function.
p   However, if f is a bijective function, it can be
shown that f -1 is a function.
Exponential and
logarithmic functions

p   Let f(x) = 2x and g(x) = log 2 x = lg x

n   f ◦ g(x) = f(g(x)) = f(lg x) = 2 lg x = x
n   g ◦ f(x) = g(f(x)) = g(2x) = lg 2x = x

p   Therefore, the exponential and logarithmic
functions are inverses of each other.
Composition of functions
p   Given two functions g : X ® Y and f : Y ® Z,
the composition f ◦ g is defined as follows:
f ◦ g (x) = f(g(x)) for every x Î X.
q   Example: g(x) = x2 -1, f(x) = 3x + 5. Then
f ◦ g(x) = f(g(x)) = f(3x + 5) = (3x + 5)2 - 1
q Composition of functions is associative:
f ◦ (g ◦h) = (f ◦ g) ◦ h,
q But, in general, it is not commutative:
f ◦ g ¹ g ◦ f.
Binary operators

A binary operator on a set X is a function f that
associates a single element of X to every pair of
elements in X, i.e. f : X x X ® X and f(x1, x2) Î X
for every pair of elements x1, x2.

n   Examples of binary operators are addition, subtraction
and multiplication of real numbers, taking unions or
intersections of sets, concatenation of two strings
over a set X, etc.
Unary operators
p   A unary operator on a set X associates to
each single element of X one element of X.
n   Examples:
1. Let X = U be a universal set and P(U) the power
set of U. Define f : P(U) ® P(U) the function
defined by f (A) = A', the set complement of A in U,
for every A Í U. Then f defines a unary operator
on P(U).
String inverse
Let X be any set, X* the set of all strings over X.
If a = x1x2…xn Î X*, let f(a) = a-1 = xnxn-
1…x2x1, the string written in reverse order.
Then f :X* ® X* is a function that defines a unary
operator on X*.

Observe that aa -1 = a -1a = l

```
To top