Option (C) is correct.
Step 1: count all functions, then remove those that are not onto. Each of the 4 tasks can go to any of the 3 workers, so there are 34=81 functions in all.
A function fails to be onto when some worker gets nothing.
- Functions that miss one named worker, say a, send all four tasks to b or c: 24=16 of them. There are 3 workers to miss, giving 3×16=48.
- That count takes the functions missing two workers twice. A function missing both a and b sends everything to c. There are 3 such constant functions, and each was subtracted twice, so add them back once.
81−48+3=36.
A second way to see 36. Four tasks shared among three workers, nobody empty-handed, means exactly one worker gets two tasks and the others get one each. Choose the two tasks that share a worker: (24)=6 ways. Now there are three bundles of tasks for three workers, one bundle each: 3!=6 ways. So 6×6=36.
Step 2: impose f(1)=f(2). Then tasks 1 and 2 form one bundle. Every worker needs a task and only 4 tasks exist, so the worker who gets tasks 1 and 2 gets nothing else, and tasks 3 and 4 go to the other two workers, one each. The three bundles {1,2}, {3}, {4} go to a,b,c one each:
3!=6.
So 36 onto functions, of which 6 have f(1)=f(2).
Why the other options are wrong
- (A) 81=34 counts every function, including those that leave a worker idle. Likewise 27=33 counts every function with f(1)=f(2), onto or not.
- (B) 24=4! is the number of bijections of a 4-element set onto itself. No function from 4 tasks to 3 workers can be one-one, so this is the wrong model. (Its second number, 6, happens to be right.)
- (D) 12 assumes f(1)=f(2) holds for one onto function in three, as it does among all functions (27 of 81). Among onto functions it is only one in six: 6 of 36, because {1,2} is just one of the 6 possible pairs that share a worker.