GATE | GATE CS 2012 | Question 35

How many onto (or surjective) functions are there from an n-element (n >= 2) set to a 2-element set?
(A) 2n
(B) 2n – 1
(C) 2n – 2
(D) 2(2n – 2)


Answer: (C)

Explanation: Total possible number of functions is 2n.

In mathematics, a function f from a set X to a set Y is surjective (or onto), or a surjection, if every element y in Y has a corresponding element x in X such that f(x) = y (Source: http://en.wikipedia.org/wiki/Surjective_function)

There are total 2 functions out of 2n that are NOT onto: one that maps to all 1s and other that maps to all 2s.

Therefore total number of onto functions is 2n – 2.


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.