[Math] $A=\{1,2,3,4,5\}$. How many functions $f : A \to A$ so that $(f\circ f)(1) = 3$

combinatoricsdiscrete mathematicsfunction-and-relation-compositionfunctions

$A=\{1,2,3,4,5\}$

How many functions $f : A \to A$ so that $f$ is onto?

$5!$

is this correct?

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

$f(1)=1, f(1)=2, f(1)=3, f(1)=4, f(1)=5$?

I don't know what to do…

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

Best Answer

Your first answer is correct. As for the second question, consider the following process of constructing a suitable function:

$f(1)$ has to be something. If $f(1)$ is $1$, then $f(f(1))=1$, which is disallowed. So, set $f(1)=a$, where $a$ is some number in this set which isn't $1$.

Our constraint is that $f(f(1))=3$. That is, $f(a)$ has to be $3$. So, set $f(a)=3$. We are now sure that our function, however we proceed to construct the rest of it, will satisfy the constraint $f(f(1)) = 3$. Proceed to extend the function to all other numbers in this set. Note that any function satisfying the constraint may be constructed in this fashion.

Now, we ask the question: how many ways are there to proceed through this process?

In our first step, setting $f(1) = a$, we have four choices of $a$. Having chosen an $a$, we have no choice but to set $f(a) = 3$. We have $3$ more distinct elements $t\in A$ whose value $f(t)$ must be chosen from a set of the $5$ possible options in $A$.

Thus, there are $4\times 5 \times 5 \times 5 = 500$ possibilities.


All right, apparently this process is confusing, so let's build an example function.

First, we need to choose some $a \neq 1$. Let's say $a = 4$. Now, we have $f(1) = 4$, and $f(4) = 3$.

With that settled, we have to figure out what $f(2),f(3),$ and $f(5)$ are. Let's say $f(2) = 1$, $f(3) = 3$, and $f(5) = 4$. We now have a suitable function. We could have picked any of $5$ values for each of $f(2),f(3)$ and $f(5)$.