7

Let $A$ be set such that $n(A)=5$. How many functions can we define on $A$ with the property $(f\circ f)(x)=x$ ? I think the identity function works but what about others? Should $f$ have an inverse? I think permutations may be involved, but I am not sure how to progress.

Trevor Gunn
  • 27,041
andy
  • 91

4 Answers4

7

There are $26$ such functions.

Since $f\bigl(f(x)\bigr)=x$ for every $x$, $f$ is one-to-one and surjective; in other words, it is a bijection. Yet in other words, it is a permutation.

How many permutations $f$ of $\{1,2,3,4,5\}$ are there such that $f\circ f=\operatorname{id}$?

  • the identity: $1$;
  • the transpositions: $10$;
  • the composition of two disjoint transpositions (such as $(12)(35)$): $15$.
5

Hint:

You're correct in the identity function, which maps every element to itself, being one -- but consider the following function:

$1 \mapsto 2$

$2 \mapsto 1$

$3 \mapsto 3$

$4 \mapsto 4$

$5 \mapsto 5$

What happens when you compose the function above with itself? Try to look at more situations similar to the one above and the rest should begin to become clear.

Edit: Since I'm on my laptop I can provide a better answer now!

So, if you've looked at my hint, you've probably figured out you can swap two elements with your function and have $(f \circ f)(x)=x$. So let's count every way you can swap exactly two elements -- essentially, how many ways can you pick out two elements from five? Five choose two!

$${5 \choose 2} = \dfrac{5!}{2!(5-2)!}=10.$$

So that's how many ways we can swap two. But there's more! We can switch four elements. That is, you can swap two of them in one corner, and then swap two others in another corner. (Can you guess why we can't do that with three?)

So let's use combinations to find that as well. First, we're going to swap two elements. So that's ${5 \choose 2}$ again -- then we have three elements left over and we're going to pick out two and swap those as well, so that's ${3 \choose 2}$. But! We don't want to accidentally count things twice! (See Trevor Gunn's comment) Which gives us:

$${5 \choose 2} \cdot {3 \choose 2} \cdot \frac{1}{2} = \dfrac{5!}{2!(5-2)!} \cdot \dfrac{3!}{2!(3-2)!} \cdot \frac{1}{2} =10\cdot 3 \cdot \frac{1}{2}=30 \cdot \frac{1}{2} = 15.$$

(We multiply them because every time we pick out two from our set, we then pick out three from the remaining -- so it's a repetitive process, and what operation screams repetition?)

So in summary -- bringing in that one identity function we had on the sidelines, the total amount is:

$$1+{5 \choose 2} +{5 \choose 2} \cdot {3 \choose 2} \cdot \frac{1}{2}=1+10+30 \cdot \frac{1}{2}=26.$$

:)

4

The connected components of the functional digraph for such functions all look like

$$ x \to x = f(x)$$

or

$$ x \to f(x) \to f(f(x)) = x $$

The first is a loop and has generating function $\frac{x^1}{1!}$. The second is a $2$-cycle and has generating function $\frac{x^2}{2!}$. To go from connected to possibly disconnected, we take $\exp$. Thus the generating function is

$$ \exp(x + x^2/2) = \sum_{n \ge 0} a_n \frac{x^n}{n!} $$

where $a_n$ is the number of functions from a set of size $n$ to itself with the property that $f(f(x)) = x$.

This gives

\begin{align} a_n &= n! \left[ x^n \right] \exp(x + x^2/2) \\ &= n! \left[ x^n \right] e^{x^2/2}e^x \\ &= n! \left[ x^n \right] \sum_{k} \frac{x^{2k}}{2^kk!} e^{x} \\ &= \sum_{k} \frac{n!}{2^k k!} \left[ x^{n - 2k} \right] e^{x} \\ &= \sum_{k = 0}^{\lfloor n/2 \rfloor} \frac{n!}{2^k k!(n - 2k)!} \end{align}

Which gives

$$ a_5 = \sum_{k = 0}^{2} \frac{5!}{2^k k!(5 - 2k)!} = \frac{5!}{5!} + \frac{5!}{2 \cdot 3!} + \frac{5!}{2^3} = 1 + 10+15 = 26. $$


Note that

$$ \frac{n!}{2^k k!(n - 2k)!} $$

counts the number of elements of $S_n$ which can be written as a product of $k$ two cycles and $n - 2k$ one cycles.

Trevor Gunn
  • 27,041
  • Thank you. I think we have to do five choose 4 [c(5,4) ] instead of c(5,2)*c(3,2) so it must be 15 instead of 30 in the first answer. – andy Aug 06 '17 at 19:52
  • @andy 5 choose 4 is a valid interpretation. I was thinking c(5,2)c(3,2) / 2 because otherwise we would be counting $(12)(34)$ and $(34)(12)$ twice. – Trevor Gunn Aug 06 '17 at 19:53
  • I got it. Finally (; – andy Aug 06 '17 at 19:55
4

This can be solved using recursion. Let $u_n$ be the number of involutions of $\{1,\dotsc,n\}$.

To make things concrete, we'll consider $u_5$. We'll proceed by asking what $5$ is mapped to. Either to $5$ or to something else. If it's mapped to $5$ then there are $u_4$ further continuations. If on the other hand $5$ gets mapped to some other $k$, you can remove $5$ and $k$ from the set, and relabel the remaining elements $\{1,\dotsc,3\}$.

Ergo, we have that $u_5 = u_4 + 4\times u_3$.

In general we get the following recurrence relation: $$u_n = u_{n-1} + (n-1)u_{n-2}\\u_1 = 1 \\u_2 = 2$$. This recurrence defines the telephone numbers. The answer to your question is thus $u_5 = 26$.

wlad
  • 8,185
  • 1
    Thank you. When i first read the question i guessed it maybe solved by permutations or by fibonacci type sequence. The reccurence relation i need is what you defined. It is wonderful to see different solutions. Thanks all (; – andy Aug 06 '17 at 21:05