The number of onto functions (surjective functions) from set ๐‘‹ = {1, 2, 3, 4}โ€ฆ

2015

The number of onto functions (surjective functions) from set ๐‘‹ = {1, 2, 3, 4} to set ๐‘Œ = {๐‘Ž, ๐‘, ๐‘} is __________.

Attempted by 146 students.

Show answer & explanation

Correct answer: 36

Key idea: count all functions and remove those that miss at least one value (inclusionโ€“exclusion).

  • Total functions from X to Y: 3^4 = 81.

  • Functions that miss a particular element of Y: 2^4 = 16. There are C(3,1)=3 choices of which element is missed, so subtract 3ร—16 = 48.

  • Functions that miss two particular elements of Y: 1^4 = 1. There are C(3,2)=3 such pairs, so add back 3ร—1 = 3.

  • By inclusionโ€“exclusion: 81 โˆ’ 48 + 3 = 36. Hence there are 36 onto functions.

  • Alternative (brief): Stirling number S(4,3)=6 counts partitions of X into 3 nonempty preimage sets; assign these to the 3 elements of Y in 3! ways, giving 6ร—6=36.

A video solution is available for this question โ€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir