The number of onto functions (surjective functions) from set X = {1,2,3,4} to set Y = {a,b,c} is ________.
GATE 2015 · Discrete Mathematics · Functions · medium
Answer: 36
- Write the inclusion-exclusion sum: With m = 4 and k = 3: 3^4 - C(3,1)*2^4 + C(3,2)*1^4 - C(3,3)*0^4.
- Evaluate each term: 3^4 = 81, C(3,1)*2^4 = 3*16 = 48, C(3,2)*1^4 = 3*1 = 3, and the last term is 0. So 81 - 48 + 3 = 36.
- Cross-check with Stirling numbers: S(4,3) = 6 (ways to split 4 elements into 3 nonempty blocks), so 3! * 6 = 6 * 6 = 36, matching.