Question
How many onto (or surjective) functions are there from an -element () set to a 2-element set?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2012 answer key
Solution
Use the principle of inclusion-exclusion to count the number of onto (surjective) functions.
-
Let be a set with elements and be a set with 2 elements.
-
Total number of functions from to is:
- A function is NOT surjective if its range excludes at least one element of :
- The function where all elements of map to (range is ). Exactly 1 such function.
- The function where all elements of map to (range is ). Exactly 1 such function.
-
The intersection of these two cases is empty since a function cannot simultaneously map all inputs to and to .
-
Subtracting these 2 non-surjective functions from the total gives:
- This matches option (C).
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2012 Computer Science and Information Technology (CS)
- Question
- 37 of 65, printed as CS Q.37
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.