GATE Computer ScienceHardGATE CS (PYQ pattern)

How many functions f : {1, 2, 3, 4, 5} → {1, 2, 3, 4, 5} are simultaneously non-decreasing, satisfy f(x) ≥ x for all x, and satisfy f(f(x)) = f(x) for all x?

  1. A. 42
  2. B. 16
  3. C. 32
  4. D. 55

Correct answer: B. 16

Idempotence makes the image the fixed-point set F, and f(x) ≥ x with monotonicity forces f(x) = the least element of F that is ≥ x (a closure operator on the chain). F must contain 5 and is otherwise arbitrary: 2⁴ = 16. (Dropping idempotence gives Catalan C₅ = 42.)

More Discrete Mathematics questions

Exams that ask this topic