Counting Functions
Solved Problems
Example 1.
Let
- the number of functions from
to - the number of functions from
to - the number of injective functions from
to - the number of injective functions from
to - the number of surjective functions from
to - the number of surjective functions from
to
Solution.
- We see that
and The total number of functions is given by - The total number of functions
is - There are no injections from
to since - Similarly, there are no surjections from
to because - The number of surjective functions
is given by the formula Note that and are interchanged here because now the set is the domain and the set is the codomain. So, we haveThe Stirling partition number is equal to Hence, the number of surjections from to is
Example 2.
Let
- What is the total number of functions from
to - How many injective functions are there from
to - How many injective functions are there from
to such that - How many injective functions are there from
to such that and
Solution.
- The cardinalities of the sets are
and Then the total number of functions is equal to - The number of injective functions from
to is equal to - Since
there are mapping options for the next elementRespectively, for the element there are possibilities:Thus, there are injective functions with the given restriction. - By condition,
Then the first element of the domain can be mapped to set in ways:If then has mapping options:If then has mapping options:There are no restrictions for the last element . In all cases it can be mapped in ways:Hence, there are injective functions satisfying the given restrictions.
Example 3.
Let
Solution.
The power set of
The number of functions from
Similarly, the number of functions from
Hence, the mapping
Example 4.
Count the number of injective functions
Solution.
The Cartesian square
The number of injective functions is given by
Example 5.
Suppose
Solution.
The total number of functions from
To find the number of surjective functions, we determine the number of functions that are not surjective and subtract the ones from the total number.
A function is not surjective if not all elements of the codomain
We obtain the same result by using the Stirling numbers. Given that
Example 6.
Let
Solution.
First we find the total number of functions
Since
Determine the number of injective functions:
Hence the number of functions