# How many functions are possible?

I would appreciable any insight you give to solve this type of question:

How many $$f: \{1,2,3\}\to \{1,2,3\}$$ satisfy $$f(f(x))=f(f(f(x)))$$ for all $$x$$?

Normally questions of this type I used try by guessing, until I can't see any more possibilities. But I don't like this way of solving, do you know a theorem or some tool to solve this type of question with certainty?

• What have you tried? How many functions are there? If there are few functions, just list them all out and then see what conclusions you can draw. Nov 22 '20 at 4:46

Hint: Show that we cannot have $$f(a) = b, f(b) = a$$.
Hence, we must either have A) $$f(a) = a$$ or B) $$f(a) = b, f(b) = c$$.
Hence, there are $$X$$ such functions.