Question

How many onto (or surjective) functions are there from an nn-element (n≥2n \ge 2) set to a 2-element set?

Choose one option
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.

  1. Let AA be a set with nn elements and B={b1,b2}B = \{b_1, b_2\} be a set with 2 elements.

  2. Total number of functions from AA to BB is:

Total functions=∣B∣∣A∣=2n\text{Total functions} = |B|^{|A|} = 2^n
  1. A function is NOT surjective if its range excludes at least one element of BB:
  • The function where all elements of AA map to b1b_1 (range is {b1}\{b_1\}). Exactly 1 such function.
  • The function where all elements of AA map to b2b_2 (range is {b2}\{b_2\}). Exactly 1 such function.
  1. The intersection of these two cases is empty since a function cannot simultaneously map all inputs to b1b_1 and to b2b_2.

  2. Subtracting these 2 non-surjective functions from the total gives:

Onto functions=2n−2\text{Onto functions} = 2^n - 2
  1. This matches option (C).
Final answer

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.