Chapter 7 Functions

advertisement
Chapter 7
Functions
Dr. Curry Guinn
Outline of Today
• Section 7.1: Functions Defined on General
Sets
• Section 7.2: One-to-One and Onto
• Section 7.3: The Pigeonhole Principle
• Section 7.4: Composition of functions
• Section 7.5: Cardinality
What is a function?
• A function f
f:X→Y
– Maps a set X to a set Y
– is a relation between
• the elements of X (called the inputs) and
• the elements of Y (called the outputs)
– with the property that each input is related to one and
only one output.
• X is the domain.
• Y is the co-domain.
• The set of all values f(x) is called the range.
How do we represent functions
• Arrow diagrams
• f:X→Y
•
•
•
•
What is the domain?
– {a,b,c,d}
What is the co-domain?
– {x, y, z, p, q, r, s}
What is the range?
– {x, y, p}
What is the inverse image of y?
– {a, c}
How do we represent functions?
• As Ordered Pairs
• f = { (a,y), (b,p), (c,y), (d,x) }
How do we represent functions?
• As machines
How do we represent functions?
• By Formula
• f(x) = 2x2 + 3
Equality of functions
• Two functions, f and g, are equal if
– Both map from set X to set Y
– And
– f(x) = g(x) for all x  X.
• If f(x) = SQRT(x^2) and g(x) = x, is f = g?
• Identity function, i is such that
– i(x) = x for all x  X
The Logarithmic Function
•
•
•
•
•
•
Logb x = y  by = x
Log2 8
Log10 1000
Log3 3n
Log5 1/25
Loga 1 for a > 0
“Well defined” function
• Remember: a function must map an input
to a single, unique value
• F: R → R such that
– f(x) = SQRT(-x2) for all real numbers X.
• Why is this not well defined?
7.2: One-to-one and onto
• A function is f : X → Y is one-to-one when
• If f(x1) = f(x2), then x1 must be equal to
x2.
• To show a function is one-to-one, assume
f(a) = f(b) for arbitrary a and b. Show a =
b.
One-to-one and finite sets
• See board
One-to-one example, infinite sets
• f(n) = 2n + 1
• f(n) = n^2
Onto functions
• A function f : X → Y is onto if for every y in
the co-domain, that is, every y  Y, there
exist some x  X, such that f(x) = y.
• To prove something is onto, pick an
arbitrary element in Y and find an x in X
that maps to the y.
Onto functions and finite sets
• See board
Onto examples, infinite sets
• Show the following are or are not onto:
• f: Z → Z by f(n) = 2n + 1.
• f: Z → Z by f(n) = n + 5.
One-to-one correspondences
• If a function f : X → Y is both one-to-one
and onto, there is a one-to-one
correspondence (or bijection) from the set
X to set Y.
• Show f: Z → Z by f(n) = n + 5 has a oneto-one correspondence.
Inverse functions
• If a function f : X → Y is has as one-to-one
correspondence, the there is an inverse
function f-1: Y → X such that if f(x) = y, then
f-1(y) = x.
• f(x) = n + 5
• What’s the inverse?
Exponential and Logarithmic
functions
• Expb(x) = bx for any x  R and b > 0.
• Logb(x) = y, for any x  R+ if x = by
• Show logb(x/y) = logb(x) – logb(y)
• Hint: Let u = logb(x) and v = logb(y)
7.3: The Pigeonhole Principle
• Suppose X and Y are finite sets and N(X)
> N(Y). Then a function f : X → Y cannot
be one-to-one.
• Proof by contradiction.
Using the Pigeonhole Principle
• Prove there must be at least 2 people in
New York city with the same number of
hairs on their head.
• How many integers must you pick in order
for them to have at least one pair with the
same remainder when divided by 3.
The Generalized Pigeon Hole
Principle
• For any function f from a finite set X to a
finite set Y and for any positive integer k, if
N(X) > k*N(Y), then there is some y  Y
such that the inverse image of y has at
least k+1 distinct elements of X.
• If you have 85 people, and there are 26
possible initials of their last name, at least
one initial must be used at least ___ times.
Pigeonhole
• In a group of 1,500 people, must at least
five people have the same birthday?
7.4 Composition of Functions
Composition of functions
• The composition of two functions occurs
when the output of one function is the
input to another.
• Let f: X → Y’ and g: Y → Z where the
range of f is a subset of the domain of g.
Define a new function g  f(x) = g(f(x)).
Composition Examples
• F(n) = n + 1 and g(n) = n2
• What is f  g?
• What is g  f?
Composition of one-to-one
functions
• If both f and g are one-to-one, is f  g oneto-one?
• Proof: See board
• If both f and g are onto, is f  g onto?
7.5 Cardinality
• The cardinality of a set is how many members it
has.
• Let X and Y be sets. X has the same cardinality
as Y iff there exists a one-to-one
correspondence from X to Y.
– X has the same cardinality as X (Reflexive)
– If X has the same cardinality as Y, Y has the same
cardinality as X (Symmetric)
– If X has the same cardinality as Y, and Y has the
same cardinality as Z, then x has the same cardinality
as Z (Transitive).
Countable Sets
• A set X is countably infinite iff has the
same cardinality as the set of positive
integers.
• Is the set of all integers countable?
• F(n) = {
0
if n = 1
-n/2
if n is even
(n-1)/2 if n is odd }
Is this one-to-one? Onto?
Rational numbers are countable
The set of real numbers between 0
and 1 is uncountable.
• Uses Cantor’s Diagnolization Argument
• Proof by contradiction
• See board!!
• Any set with an uncountable subset is
uncountable.
Some interesting results
• The set of all computer programs in a
given computer language is countable.
– How?
– Each program is a finite set of strings.
– Convert to binary.
– Now each program is a unique number in the
set of integers.
– The set of all programs is a subset of the set
of all integers. Therefore countable.
Download