How many onto (or surjective) functions are there from an n-element (n ≥ 2) set to a 2-element set?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2012 · Q37
Time
Select one answerSingle correct
Solution
Official answer: C) 2n - 2
CombinatoricsLet the domain set be with and the codomain set be with .
The total number of functions from to is:
A function is not onto (not surjective) if its range does not cover the entire codomain . In this case, that happens when all elements of map to only , or all elements map to only .
There are exactly such constant functions:
for all
for all
Therefore, the number of onto functions is:
Hence, (C) is the correct option.
Try the question first, then check your work.
Examiner trap
Subtract the number of non-surjective (constant) functions from the total number of functions.
This Combinatorics previous year question is Q37 of the GATE CSE 2012 paper. Find more GATE CSE PYQs on Combinatorics in Engineering Mathematics, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Combinatorics PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Combinatorics has 19 GATE CSE PYQs across 15 papers from 2012 to 2025. 5 of them are 2-mark MCQs like this one, and GATE CSE 2012 has 2.
How GATE tests CombinatoricsIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.