GATE Computer ScienceHardGATE CS (PYQ pattern)

How many onto functions f : {1, …, 7} → {a, b, c, d} have exactly one element of the codomain with a single preimage?

  1. A. 2520
  2. B. 3150
  3. C. 1260
  4. D. 8400

Correct answer: A. 2520

Choose the value with one preimage (4) and that preimage (7). The other 6 elements map onto the remaining 3 values with each value getting at least 2 (it cannot get 1, and it must be hit), so the sizes are 2, 2, 2: 6!/(2!2!2!) = 90. Total 4 × 7 × 90 = 2520.

More Discrete Mathematics questions

Exams that ask this topic