Chapter 3 What is function composition? Suppose f and g are

advertisement
Chapter 3
What is function composition?
Suppose f and g are functions and f ε X x Y and g ε Y x Z then
fg is not defined and gf is defined, gf ε X x Z. We say that gf
is the composition of g and f.
How
How
How
How
How
How
How
How
How
How
How
How
are
are
are
are
are
are
are
are
are
are
are
are
the
the
the
the
the
the
the
the
the
the
the
the
domain of f and the codomain of g related?
codomain of f and the domain of g related?
codomain of f and the codomain of g related?
domain of f and the domain of g related?
domain of gf and the domain of g related?
domain of gf and the domain of f related?
domain of gf and the codomain of g related?
domain of gf and the codomain of f related?
codomain of gf and the domain of g related?
codomain of gf and the domain of f related?
codomain of gf and the codomain of g related?
codomain of gf and the codomain of f related?
Why is fg undefined? The range of g is not a subset of the
domain of f!
What conditions must g and f satisfy so that gf is defined?
What conditions must g and f satisfy so that fg is defined?
X = {1,2,3}
Y = {4,5,6,7}
Z = {8,9}
X x Y =
{(1,4), (1,5), (1,6), (1,7), (2,4), (2,5), (2,6), (2,7), (3,4),
(3,5), (3,6), (3,7)}
Y x Z = ?
f = {(1,4),(2,5), (3,6)}
g = {(4,8), (5,8), (6,9), (7,9)}
g maps Y to Z
f maps X to Y
fg is not defined. Why not? The g’s range is not a subset of f’s
domain. g maps Y to Z and f maps X to Y
If f and g are functions and the range of g is a subset of the
domain of f the fg is a function
f’s domain = {1,2,3}
g’s range = {8,9}
g(4)
g(5)
g(6)
g(7)
=
=
=
=
8
8
9
9
f(8)
f(8)
f(9)
f(9)
is
is
is
is
not
not
not
not
defined
defined
defined
defined
but f’s range is a subset of g’s domain
f’s range = {4,5,6}
g’s domain = {4,5,6,7}
gf maps X to Z
f(1) = 4 g(4) = 8 gf(1) = 8
f(2) = 5 g(5) = 8 gf(2) = 8
f(3) = 6 g(6) = 9
gf(1) = 8
gf(2) = 8
gf(3) = 9
gf = {(1,8), (2,8), (3,9)}
Is gf a subset of X x Z?
X x Z = {(1,8), (1,9), (2,8), (2,9), (3,8), (3,9)}
What are the sufficient conditions for the existence of the
composition function gf? If g and f are functions and the range
of f is a subset of the domain of g then gf is a function and
gf(x) = g(f(x)) for all x ε f’s domain and if the range of g is
a subset of the domain of f then fg is a function
If f and g are functions with the same domain and range then f +
g is a function (f + g)(x) = f(x) + g(x)
f*g, f/g, g/f
f*g(x) = f(x) * g(x) ≠ f(g(x)) = fg(x)
That is, the product of two functions is not the same as the
composition of two functions. They are very different functions!
How do we define two functions, g and f, such that gf is a
function and fg is a function?
We know that range of f is a subset of the domain of g and the
range of g is a subset of the domain of f
Suppose f ε X x Y and g ε U x V and that f(X) is the range of f
and g(U) is the range of g. Then f(X) <= Y and g(U) <= V. That
is the range of f is a subset of its codomain Y and the range of
g is a subset of its codomain V. Further suppose that fg is a
composite function and gf is a composite function. Then f(X) <=
U and g(U) <= X. But f(X) <= Y and g(U) <= V. Therefore f(X) <=
UY and g(U) <= XV.
As we just want to build an example, we can assume that X = V
and U = Y. Therefore, for our example, we can assume that
f ε X x Y and g ε Y x X. There is more. We know that f(X) <= Y
and g(U) <= V. Therefore, f(X) <= Y and g(Y) <= X
X = {1,2,3,4,5}
Y = {7,8,9,10}
f = {(1,7), (2,8), (3,9), (4,10), (5,7)}
g = {(7,1), (8,2), (9,3), (10,4)}
Can we define fg and gf
the range of g, g(Y) = {1,2,3,4}
the domain of f, X = {1,2,3,4,5}
Is g’s range <= f’s domain?
Is g’s output <= of f’s input
Is {1,2,3,4} <= {1,2,3,4,5}? Yes!
g(7)
g(8)
g(9)
g(10)
=
=
=
=
1,
2,
3,
4,
f(1)
f(2)
f(3)
f(4)
= 7,
= 8,
= 9,
= 10,
fg(7)
fg(8)
fg(9)
fg(10)
=
=
=
=
7
8
9
10
fg = {(7,7), (8,8), (9,9), (10,10)}
the range of f, f(X) = {7,8,9,10)
the domain of g, Y = {7,8,9,10}
Is f’s range a subset of g’s domain?
Is f’s output <= of g’s input?
Is {7,8,9,10} <= {7,8,9,10} Yes!
f(1)
f(2)
f(3)
f(4)
f(5)
= 7, g(7)
= 8, g(8)
= 9, g(9)
= 10, g(10)
= 7, g(7)
=
=
=
=
=
1,
2,
3,
4,
1,
gf(1)
gf(2)
gf(3)
gf(4)
gf(5)
=
=
=
=
=
1
2
3
4
1
gf = {(1,1), (2,2), (3,3), (4,4), (5,1)}
What are sufficient conditions that fg and gf be functions? If f
and g are functions and f ε X x Y and g ε U x V and f(X) <= UY
and g(U) <= XV then fg and gf are functions
Do you remember functions and their inverses? A function f’s
inverse, f-1 is also a function if f is one-to-one and onto. What
are the compositions, ff-1 and f-1f?
f ε X x Y and f-1 ε Y x X
How do we define X and Y?
Since f and f-1 must be one-to-one and onto functions |X| = |Y|.
That is X and Y must be the same size. Since the functions are
one-to-one and onto, f(X) = Y and f-1(Y) = X. Do you see that we
have satisfied the conditions for the existence of composite
functions ff-1 and f-1f?
X = {1,2,3} and Y = {4,5,6}
f = {(1,6), (2,5), (3,4)}
f-1 = {(4,3), (5,2), (6,1)}
ff-1 = f-1f = I, the identity function
I(1) = 1, I(2) = 2, I(3) = 3
I(4) = 4, I(5) = 5, I(6) = 6
There actually 2 identify functions, one on X and one on Y.
The pigeonhole principle
What is the pigeonhole principle?
The pigeonhole principle is easy to state but hard to use. See
page 86:
If n pigeonholes are occupied by n + 1 or more pigeons, then at
least one pigeonhole is occupied by 2 or more pigeons
If n pigeonholes are occupied are occupied by kn + 1 or more
pigeons then at least one pigeonhole is occupied by k + 1 or
more pigeons
In general, if a function maps a larger set into a smaller set
then function is not one-to-one?
How many people must you meet to be sure that you met at least
two people who were born on the same day of the week?
You must be at least 8 people to be sure that two were born on
the same day of the week.
How many people must you meet to be sure that you met at least
two people who were born on the same month?
You must meet at least 13 people
A drawer contains 6 pairs of black, 5 pairs of white, 5 pairs of
red, and 4 pairs of green socks.
How many single socks do we have to take out to make sure that
we take out two socks with the same color?
You have to take out at least 5 socks to get a match.
How many single socks do we have to take out to make sure that
we take out two socks with different colors?
You have to take out 13 single socks to make sure you get two
socks of different colors.
You have to take out 7 pairs of socks to make sure you get two
socks of different colors
We select 38 even positive integers, all less than 1000. Prove
that there will be two of them whose difference is at most 26.
You have 37 consecutive differences, non-over lapping
differences that more or less partition the number line from 0
to 1000 into 37 partitions
0 n1 n2 n3 … n38 1000
0 < n1 < n2 < n3 < n38 < 1000
How many partitions are there?
0 < n1 < n2 < 1000
(0,n1) (n1,n2), (n2,1000)
What is the relation between the number of points and the number
of partitions?
What are the pigeons and what are the pigeon holes?
The pigeons holes are line segments of the form, [x,y] where x
and y are even integers, 2 <= x < y <= 998 and y – x = 2. The
pigeons appear in flocks of the form [x,y] where x and y are
even integers, 2 <= x < y <= 998 and y – x >= 2
Suppose that the length of all the pigeon flocks is greater than
26. Since the length of every flock is even, our supposition is
that the length of every flock is greater than or equal to 28.
We have 37 flocks. We know that the sum of the lengths of the
flocks is less than or equal to 996. We also know that sum of
the lengths of the flocks is at least 28 x 37. 28 x 37 = 1036.
The contradiction shows that our initial assumption, that the
length of all the flocks is greater than equal to 28, is false.
Therefore, the length of at least one flock is no more than 26.
Chapter 4
Rule of Sum: If a set of objects can be divided into m disjoint
subsets and the ith subset has ni elements, then we have exactly
n1 + n2 + ... nm objects altogether.
Rule of Product: If an activity can be composed from m different
tasks, of which the ith can be chosen in ni ways, then we have
exactly n1 x n2 x ... x nm ways of composing the activity.
Suppose a college has 3 different history courses, 4 different
literature courses, and 2 different sociology courses. How many
ways can a student choose one of each kind of course? How many
ways can a student choose exactly one course?
Let’s simplify the problem
2 h’s (h1, h2), 1 l’s (l1) and 2 soc’s(s1,s2)
h1,l1,s1
h1,l1,s2
h2,l1,s1
h2,l1,s2
2 x 1 x 2 = 4
Let’s look at the original problem
How many ways can we choose 3 courses one from each subject?
3 x 4 x 2 = 24
A student can choose exactly one course in 9 ways because there
are 9 different courses!
Can you enumerate them?
{h1,h2,h3}, {l1,l2,l3,l4},(s1,s2}
{h1,l1,s1}
...
{h3,l4,s2}
Suppose a bookcase shelf has 5 History texts, 3 Sociology texts,
6 Anthropology texts, and 4 Psychology texts. How many ways can
a student choose one of the texts? How many can a student choose
one of each type of text?
5 + 3 + 6 + 4 = 18
5 x 3 x 6 x 4 = 360
H
S
A
P
=
=
=
=
{h1,h2,h3,h4,h5}
{s1,s2,s3}
{a1,a2,a3,a4,a5,a6}
{p1,p2,p3,p4}
|H x S x A x P| = 360
A history class contains 8 male students and 6 female students.
Find the number of ways that class can elect 1 class
representative; 2 class representatives; 1 male and 1 female
class representative; 1 president and 1 vice president?
How many ways can
How many ways can
first rep and the
14 x 13
Does 14 x 13 make
the class select one rep? 14
the class select two reps assuming that the
second rep have different responsibilities?
sense?
Look at a simpler version of
2 males and 2 females
How many ways can you select
{m1,m2} and (f1,f2,f3}
(m1,m2) (m2,m1) (f1,m1) (f2,m1)
(m1,f1) (m2,f1) (f1,m2) (f2,m2)
(m1,f2) (m2,f2) (f1,f2) (f2,f1)
(m1,f3) (m2,f3) (f1,f3) (f2,f3)
the problem
two students
(f3,m1)
(f3,m2)
(f3,f1)
(f3,f2)
That there are 20 ways
By analogy, therefore there are 14 x 13 ways to select the 2
reps = 182 ways to select the 2 reps
If we just want to know the number of sets of two students
rather than the number of ordered pairs of students then the
answer is 14 x 13 / 2 = 91.
The number of pairs of presidents and vice-presidents is 14 x 13
= 182.
The number of ways to select 1 male and 1 female representative
= 8 x 6 = 48
There are 4 bus lines between A and B, and 3 bus lines between B
and C. Find the number of ways that a man can travel by bus:
from A to C by way of B; roundtrip from A to C by way of B;
round trip from A to C by way of B but without using a bus line
more than once?
A store sells clothes for men. It has 3 kinds of jackets, 7
kinds of shirts, and 5 kinds of pants. Find the number of ways a
person can buy: one of each item; one of each of the three kinds
of clothes.
Suppose a code consists of 5 characters, two letters followed by
3 digits. Find the number of: codes; codes with distinct
letters; codes with the same letters?
Find the number of automobile license plates where: each plate
contains 2 different letters followed by three different digits;
the first digit cannot be 0.
Download