Table of Contents
A relation from set to set is a function, if and only if every element of set relates to exactly one element of set .
- Number of functions that can be made between and .
If is a function -
- is called the domain of
- is called the co-domain of
- Range of a function is the subset of the co-domain of containing those elements that are mapped by at least one element of the domain.
- If , then image of w.r.t is and pre-image of w.r.t is .
A function from set to itself is called a function on .
Injective Functions (one-one)
A function is injective if every distinct element in the domain of has a distinct image in the co-domain of .
- If ) then .
- Number of injective functions that can be made between and .
Surjective Functions (onto)
A function is surjective if every element in the co-domain of has at least one preimage in the domain of .
- A function can never be onto if the size of its co-domain is larger than the size of its domain.
Count of all Surjective Functions
Number of subjective functions is hard to get directly. One way to get the count is by doing -
Let and be two sets such that and , the general formula for number of onto functions possible from to are -
Derivation -
- is the total number of functions possible. So if we subtract the count of all non-onto functions from this count, we should get the total number of onto functions.
- For a function to not be onto, its codomain can have at most elements and at least element.
Thus the count of onto functions would be something of the form -
- Step 1 -
- To get the count of all functions with exactly one element of B not in their co-domain, we have to consider a subset of elements which acts as the codomain to a non-onto function. We can pick 1 element to remove from in ways.
- Once this element has been excluded we can make a total of functions between the elements in and elements in .
- Thus functions need to be added to the total number of functions for the first step.
- Step 2 -
- To get the count of all functions with exactly one element of B not in their co-domain, we can use a similar logic as Step 1. Thus the total number of functions to exclude would be .
- But the Step 1 would already exclude the functions with exactly elements in their co-domains twice. Similar to how we do in Principle of Inclusion and Exclusion, we’d have to reintroduce the count of these functions such that they are only excluded once. (Lecture 17, 33:50)
- Thus functions need to be added to the total number of functions for the second step.
- Step 3 -
- Similar to how in Step 2 we saw that functions with co-domain size of elements were excluded twice in Step 1, functions with co-domain size of elements were excluded thrice in Step 1. At the same time in Step 2 they were again added back thrice, thus resulting in a net of .
- Thus they need to be excluded at least one time, and thus needs to be added to the total number of functions for the third step.
Using the logic for these steps is what leads to the final formula mentioned above. Check Question 1 for an aptitude related application.
Bijective Function
If a function is both injective (one-one) and surjective (onto), then the function is called a bijective function.
Any function has an inverse function if and only if it is bijective.
Identity Function
An Identity Function on a set is a function such that .
Identical Function
Two functions are said to be identical if -
- They have the same domain and range.
- Both the functions generate the same value for all elements in the domain.
Function Composition
When the output of a function is passed as the input to a function , we say this is a function composition , where .
Inverse of a Function
A function has an inverse function if and only if is bijective. Every bijective function has an inverse such that, and where and are the identity functions on set and .
Function composition is an associative operation.
Questions
Q1) If there are 6 jobs being assigned to 3 computers, in how many ways can they be assigned such that each computer does at least one job?
Here we can see that the a mapping exists between jobs and computers where a job can only be assigned to a single computer and all computers must have at least one job assigned to them. This is the exact structure of a surjective function where the domain is the set of jobs and co-domain is the set of computers. Just apply the formula for count of all onto functions with and , the answer would come out to be .