<s>[INST] $f\colon\{1,2,3,4,5\}\longrightarrow\{1,2,3,4,5\}$ Find the total number of functions such that $f(f(x))=f(x)$ I tried to solve it by letting $f(x)=y$
then equation reduces to $f(y)=y$ but i didn't get it further.
Please give me hint to solve this from where I should start
 [/INST] You have a very good starting point: for all $x$ in your set, $y=f(x)$ is a fixed point.
Conversely, suppose $f$ maps elements to fixed points, then it clearly satisfies $f(f(x))=f(x)$.
So the answers looks like: choose a subset of $\{1,2,3,4,5\}$ to be the fixed points of your function, and then map the remaining points arbitrarily to these fixed points. A few choices of $f$ are:
1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1
1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 5
1 => 1, 2 => 1, 3 => 1, 4 => 4, 5 => 1
1 => 1, 2 => 1, 3 => 1, 4 => 4, 5 => 4
1 => 1, 2 => 1, 3 => 1, 4 => 4, 5 => 5
1 => 1, 2 => 1, 3 => 1, 4 => 5, 5 => 5
1 => 1, 2 => 1, 3 => 3, 4 => 1, 5 => 1
1 => 1, 2 => 1, 3 => 3, 4 => 1, 5 => 3
1 => 1, 2 => 1, 3 => 3, 4 => 1, 5 => 5
1 => 1, 2 => 1, 3 => 3, 4 => 3, 5 => 1
1 => 1, 2 => 1, 3 => 3, 4 => 3, 5 => 3
1 => 1, 2 => 1, 3 => 3, 4 => 3, 5 => 5
1 => 1, 2 => 1, 3 => 3, 4 => 4, 5 => 1
1 => 1, 2 => 1, 3 => 3, 4 => 4, 5 => 3
1 => 1, 2 => 1, 3 => 3, 4 => 4, 5 => 4
1 => 1, 2 => 1, 3 => 3, 4 => 4, 5 => 5
1 => 1, 2 => 1, 3 => 3, 4 => 5, 5 => 5
1 => 1, 2 => 1, 3 => 4, 4 => 4, 5 => 1

The list goes on.
</s>