Download Functions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Structure (mathematical logic) wikipedia , lookup

Birkhoff's representation theorem wikipedia , lookup

Homomorphism wikipedia , lookup

Transcript
Section 1.8
Functions
1
Loose Definition
• Mapping of each element of one set onto
some element of another set
– each element of 1st set must map to something,
but that something need not be unique; 2 or
more elements of 1st set can map to single
element in 2nd set
– however, no element of 1st set can map to more
than one element of 2nd set
2
Examples
Let A = {x, y, z} and B = {1, 2, 3}
3
Formal Definition
• Let A and B be sets. A function f from A to
B is an assignment of exactly one element
of B to each element of A
• In more algebraic terms:
f(a) = b if b  B and is the unique element
assigned to a  A
• If f is a function from A to B we write
f: A  B
4
Specifying Functions
• Can explicitly state assignments, e.g.
f(x)=2, f(y)=1, f(z)=3
• Can write as formula, e.g. f(x)=x+1
5
Some Terminology
• Given f:AB
– A is the domain of f
– B is the co-domain of f
• Given f(a)=b
– b is the image of a
– a is the pre-image of b
• The range of f is the set of all images of
elements of A
6
Examples
f(x)=2, f(y)=1, f(z)=3
domain is {x,y,z}
co-domain is {1,2,3}
range is {1,2,3}
f(x)=2, f(y)=2, f(z)=2
domain is {x,y,z}
co-domain is {1,2,3}
range is {2}
Suppose A=N and B=N and f:AB = f(x) = x*2
Then the domain and co-domain are N; the range is the
positive even integers
7
Addition & Multiplication of
Functions
Two real-valued functions with the same domain can be added
and multiplied
Where f1: AR and f2: A R,
(f1 + f2)(x) = f1(x) + f2(x) and
(f1f2)(x) = f1(x) * f2(x)
For example, let f1: RR = f1(x) = x + 2 and
f2: RR = f2(x) = x2 + 3
(f1 + f2)(x) = f1(x) + f2(x) = (x + 2) + (x2 + 3) = x2 + x + 5
(f1f2)(x) = f1(x) * f2(x) = (x + 2)(x2 + 3) = x3 + 2x2 + 3x + 6
8
Image of a Subset
Given f:AB and SA
The image of S is the subset of B that consists of the images
of the elements of S:
f(S) = {f(s) | s  S}
For example:
Suppose S = {x,y}
Then the image of S is the set
f(S) = {3,1}
9
One-to-one, or Injective
Functions
• If each member of set A has a unique image
in function f, then the domain of f:AB is
said to be a one-to-one function
• A one-to-one function is also called an
injection
• A function is injective if and only if f(x) =
f(y) implies that x=y in the domain of f
10
Examples
Let A = Z and B = Z and f:AB = f(n) = n - 1
Suppose n = x = y
If x = y then x-1 = y - 1
So f is one-to-one
Let A = Z and B = Z and f:AB = f(n) = n2 + 1
Suppose n = x = y
If x = y then x2 + 1 = y2 + 1, and x2 = y2
But, for example, -22 = 22
So f is not one-to-one
11
Strictly Increasing/Decreasing
Functions
• If AR and BR and f:AB and x & y are
in the domain of f,
• If f(x) < f(y) whenever x<y, then f is said to
be strictly increasing
• If f(x) > f(y) whenever x<y, then f is said to
be strictly decreasing
• All such functions are one-to-one
12
Surjective (Onto) Functions
• A function f:AB is surjective if and only
if for every element b  B, there is an
element a A with f(a) = b
• In other words, if all elements in B have an
A element or elements mapped to them, it’s
a surjective function
• Or, all elements in co-domain are images of
elements in domain; range = co-domain
13
Bijection: One-to-one
Correspondence
• If a function is BOTH injective and
surjective (one-to-one and onto), it is
bijective
• If A is a finite set, and f is a function from A
to itself (f:AA), then f is injective ONLY
if it is surjective
14
Identity function on a set
The identity function assigns each element
of a set to itself
iA: AA where iA(x) = x where x  A
15
Inverse Function
• Given f:AB, and f is a bijection
• The inverse function of f, denoted f -1,
assigns to an element bB the unique
element a A such that f(a)=b
• In other words, when f(a)=b, f -1(b)=a
• A bijection is invertible because its inverse
can be defined; a function that is not a
bijection is not invertible
16
Composition of 2 functions
• Given two functions, f and g such
that g:AB and f:BC,
• The composition of f and g,
denoted (f o g)(a), is f(g(a))
• Take the result of g(a) and plug it
into f to get (f o g)(a)
• f o g can only be defined if the range
of g is a subset of the range of f
17
Example
Find f o g and g o f where f:RR = f(x) = x2 + 1 and
g:RR = g(x) = x + 2
f o g = f(g(x)) = f(x+2) = (x+2)2 + 1 = x2 + 4x + 5
g o f = g(f(x)) = g(x2 + 1) = (x2 + 1) + 2 = x2 + 3
18
Notes on Composition
• As is evident from the previous example,
the commutative law does not apply to
composition; in other words, f o g  g o f
• When the composition of a function and its
inverse is found, an identity function is
obtained: (f -1)-1 = f
19
Graphs of Functions
• The graph of a function is a set of ordered
pairs
• For f:AB, the graph of f is the set defined
as: { a,b | a  A and b  B }
20
Floor & Ceiling Functions
• Floor function: assigns to real number x the
largest whole number that is less than or
equal to x - denoted x or [x]
• Ceiling function: assigns to real number x
the smallest whole number that is greater
than or equal to x - denoted x
• These functions have useful applications
involving the storage & transmission of data
21
Example
How many bytes are required to encode 11,325
bits of data for transmission (as strings of 8-bit
bytes)?
Dividing 11,325 bits by 8 bits per byte produces
the result 1415.625
Since we can’t transmit anything smaller than a
byte, we use the ceiling function to find the
closest usable whole number: 1415.625 = 1416
22
Section 1.6
Functions
-ends-
23