Let $A=\{1,2,3,4,5,6\}$ and $B=\{a,b,c,d,e\}$. How many functions $f: A$ to $B$ are there such that for every $x$ belonging to $A$, there exists one and only one $y$ in $A$ such that $x$ is not equal to $y$ and $f(x)=f(y)$?
What I understood is that we need to find all possible groups of 2 elements from $A$ such that they map out to the same element in $B$. I figured out that there'd be 15 such groups. Each group of 2 can be mapped into 5 such elements in $B$. This would give us 15*5 ways such that only one group in $A$ maps into the same element in $B$.
However, since $A$ has 6 elements, a total of 3 groups can be formed. The above calculation pertained to such functions when only one group mapped onto the same element in $B$.
How do we consider cases, i.e. such functions wherein, say, 2 or even all 3 groups satisfy the proerty stated in the question.
Please correct me if I'm wrong and help me with this question. Thanks.
Edit: I seemed to have overlooked the fact that we need ALL the elements in $A$ to have at least one $y$ in $A$ as well such that property holds. Thus, the no. of ways for 1st group to have a an element in the Range is 75. The no. of ways for the second group to have a similar image in Range is 6*4=24 and the no. of ways for the third group to have a similar image in Range is 1*3.
The total no. of ways would be 5400 (since we need the three groups to simultaneously validate the property stated in the question). I am not sure if this is correct.
Please try to elaborate the answer if possible. Thanks.