GATE Computer ScienceVery hardGATE CS (PYQ pattern)

How many functions f : {1, 2, 3, 4} → {1, 2, 3, 4} satisfy f(f(x)) ≠ x for every x?

  1. A. 81
  2. B. 108
  3. C. 160
  4. D. 30

Correct answer: D. 30

f(f(x)) ≠ x forbids fixed points (f(x) = x gives f(f(x)) = x) and 2-cycles; every other functional graph is allowed. Direct enumeration of the 256 functions gives 30.

More Discrete Mathematics questions

Exams that ask this topic