Let $A=\{1,2,3...n\}$,How many functions satisfy the following conditions?
(1) $f \circ f=f $
(2) $f \circ f =I_A$
(3) $f \circ f\circ f=I_A$
$\circ$ is composite.
The question is from a 'Discrete Mathematics' book, and the book gave the answer of the first two questions.
(1) $n+1$
(2) $ C_n^2+1(\tbinom{n}{2}+1)$
But I think the answer of first is wrong.It should be $\sum_{k=0}^{n}{\tbinom{n}{k}k^{n-k}}$.
For the $f$ satisfied (1), The $f=\{<1,b_1>,<2,b_2>,...<n,b_n>\}$, and if $ b_n\neq n$, there is $<b_n,b_n>$ in $f$.
EDIT
For the answer I gave, I think it's wrong now.Because I think it contains repeated parts.That is, it is bigger than the correct answer.
I want to konw my answer whether is correct,and get the answer or hint of the three questions
Any help would be greatly appreciated :-)
Thanks very much!
First of all, the answer in the book is obviously wrong for $n = 1$ as there is only $1$ possible map to begin with.
Now for the actual solution, assume that $f$ satisfies (1). Set $B := f(A)$. By assumption we must have $f(x) = x$ for all $x \in B$. For $x \notin B$, there is no further restriction, it can be mapped to any point in $B$. There are $n \choose k$ ways to choose the set $B$ with $k$ elements. For the remaining $n-k$ elements there are $k$ possible choices each. We would therefore come up with $$\sum\limits_{k = 1}^n {n \choose k} k^{n-k}.$$