GATE / CS ARCHIVE

GATE CSE 2012 / QUESTION 37

Surjections to a two-element codomain

Discrete Mathematics · Sets, Relations & Functions · Full GATE CSE 2012 paper

GATE 2012, Q37 2 marks · MCQ
Report issue

Sets, Relations & Functions

Question 37, GATE 2012: How many onto (surjective) functions exist from an n-element set, n≥2, to a two-element set?
(A) 2^n (B) 2^n−1 (C) 2^n−2 (D) 2(2^n−2).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Each of n domain elements has two choices, giving 2n functions. A function is not onto precisely when all n elements map to one fixed codomain element. There are two such constant functions. Subtract them to obtain 2n−2 surjections, C.

Check: For n=2 the four functions are the two constants and the two bijections, leaving two onto functions. The formula 2²−2=2 passes this small-case check and explains why subtracting just one constant function is insufficient.

Original paper, page 10 · Answer key