Let $A=\{1,2,3..,9\}$. How many functions $f : A \to A$ so that $(f\circ f)(1) = 2$ and f is onto?

1.2k Views Asked by At

To clarify, A is set containing 9 elements (1-9). To tackle the problem, I first count

How many functions $f : A \to A$ so that $(f\circ f)(1) = 2$?

To which the answer I got is $8 \cdot 1 \cdot 9^7$

Then to get

How many functions $f : A \to A$ so that $(f\circ f)(1) = 2$ and f is onto?

what I would do is $8 \cdot 1 \cdot 9^7$ - not onto functions.

I'm not 100% sure how many not onto functions are there given $(f\circ f)(1) = 2$. I want to say $7!$ not onto functions then the answer is $8 \cdot 1 \cdot 9^7$ - $7!$

Would this be correct?

Also with some help from here, I tried counting the number functions $f : A \to A$ so that $(f\circ f)(1) = 2$ and f is onto directly to which I got the answer as $7\cdot 1\cdot 7!$

I am not sure which would be correct.

2

There are 2 best solutions below

3
On BEST ANSWER

Hint. If $f \circ f (1)=2$ then $f(1)=k$ and $f(k)=2$ for some $k\in \{2,3,4,5,6,7,8,9\}$ ($k=1$ is not allowed otherwise $f \circ f (1)=1$). Note that in order to be onto, $f$ should be bijective (hence $f(1)\not=2$ otherwise $f(1)=f(k)=2$ and $f$ is not injective).

0
On

If $f:\>[9]\to[9]$ is onto then it is bijective. It is easy to see that $f(1)=1$ and $f(1)=2$ both are impossible. Therefore $f(1)=k\in\{3,4,\ldots,9\}$, and $f(k)=2$. We can choose $k$ in $7$ ways and the rest of $f$ in $(9-2)!=5040$ ways. The total number of such functions therefore is $7\cdot5040=35\,280$.