# Is there a nice characterization of these classes of functions on a set of $n$ elements?

I am looking at the set of all functions from $[n] \to [n]$, where $[n] = \{1,2,\dots,n\}$. Now, I consider two functions equivalent, if they are conjugates by some permutation, that is, they are the same upto renaming of the elements.

For example, if $n=3$, I consider $1\mapsto 1,2\mapsto3,3\mapsto3$ to be equivalent to $1\mapsto 1,2\mapsto2,3\mapsto1$. Is there a "nice" set of representatives, or a nice characterization of the equivalence classes? If there is no "perfect" characterization, is there a set of representatives with fairly few repetitions of the same class?

As an analogue, if we were to consider only permutations, instead of all functions, each (unordered) partition of $[n]$ characterizes a class via the cycle decomposition.

Some progress: Every class has some function $f$ that satisfies $f(x) \leq x+1$ for each $x$.

If we consider each function as a graph on $n$ nodes, then each class almost corresponds to graphs of the following form upto isomorphism:

A number of disjoint cycles, with some trees attached some of the nodes of the cycles.

• This might be a good application for Burnside's lemma. – Omnomnomnom Jun 10 '13 at 20:29

Observe that we have $n$ slots and we can place any one of $n$ values in them, with the symmetric group acting on the slots and the values simultaneously. We will solve this problem using Burnside.

What we have here is a special and unique variant of Simultaneous Power Group Enumeration (as presented by Harary and Palmer and Fripertinger, in a differet publication), with the group acting on the $n$ slots where the $n$ values are placed being the symmetric group on $n$ elements $S_n$ which acts on the values themselves at the same time.

We can compute the number $q_n$ of functions by Burnside's lemma which says to average the number of assignments fixed by the elements of the group acting on the slots and values, which has $n!$ elements. But this number is easy to compute.

Suppose we have a permutation $\beta$ from $S_n.$ If we place the appropriate number of complete, directed and consecutive copies of a cycle from $\beta$ on another cycle from $\beta$ (possibly the same) then this assignment is fixed under the group action, and this is possible iff the length of the first cycle from $\beta$ divides the length of second cycle from $\beta$ and there are as many assignments as the length of the first cycle from $\beta.$

This uses the recurrence by Lovasz for the cycle index $Z(S_n)$, which is $$Z(S_n) = \frac{1}{n} \sum_{l=1}^n a_l Z(S_{n-l}) \quad\text{where}\quad Z(S_0) = 1.$$

Actually doing the computation we obtain for the number of functions the following sequence: $$1, 3, 7, 19, 47, 130, 343, 951, 2615, 7318, \ldots$$ which directs us to OEIS A001372.

This link includes an important observation, namely that what we have here is the following unlabelled species: $$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \textsc{MSET}(\textsc{CYC}(\mathcal{T})) \quad\text{where}\quad \mathcal{T} = \mathcal{Z} \times \textsc{MSET}(\mathcal{T}).$$

The Maple code to compute these is as follows.

pet_cycleind_symm :=
proc(n)
option remember;

if n=0 then return 1; fi;

end;

pet_flatten_term :=
proc(varp)
local terml, d, cf, v;

terml := [];

cf := varp;
for v in indets(varp) do
d := degree(varp, v);
terml := [op(terml), seq(v, k=1..d)];
cf := cf/v^d;
od;

[cf, terml];
end;

q :=
proc(n)
option remember;
local idx_colors, res, b,
flat, cyc_a, cyc_b, len_a, len_b, p, q;

if n=1 then
idx_colors := [a[1]]
else
idx_colors := pet_cycleind_symm(n);
fi;

res := 0;

for b in idx_colors do
flat := pet_flatten_term(b);

p := 1;

for cyc_a in flat[2] do
len_a := op(1, cyc_a);

q := 0;
for cyc_b in flat[2] do
len_b := op(1, cyc_b);

if len_a mod len_b = 0 then
q := q + len_b;
fi;

od;

p := p*q;
od;

res := res + p*flat[1];
od;

res;
end;


Addendum Sat Apr 21 2018. While the algorithm we presented here will produce the correct result, it nonetheless admits of a considerable improvement, namely that there is no need to flatten the permutation because we can compute the contribution from a pair of two cycle types of the permutation $\beta$ with the first type being covered by the second by multiplying the number of coverings of the first by the number of instances of the second, raising the result to the power of the number of instances of the first. This yields the following code.

pet_cycleind_symm :=
proc(n)
option remember;

if n=0 then return 1; fi;

end;

q :=
proc(n)
option remember;
local idx_colors, res, term_a,
v_a, v_b, inst_a, inst_b, len_a, len_b, p, q;

if n = 1 then
idx_colors := [a[1]];
else
idx_colors := pet_cycleind_symm(n);
fi;

res := 0;

for term_a in idx_colors do
p := 1;

for v_a in indets(term_a) do
len_a := op(1, v_a);
inst_a := degree(term_a, v_a);

q := 0;

for v_b in indets(term_a) do
len_b := op(1, v_b);
inst_b := degree(term_a, v_b);

if len_a mod len_b = 0 then
q := q + len_b*inst_b;
fi;
od;

p := p*q^inst_a;
od;

res := res + lcoeff(term_a)*p;
od;

res;
end;


This MSE link also does Power Group Enumeration, as does this MSE link II.

My attempt to make this a group theory problem:

I'm going to start with a half-way version: I'll say that two functions are equivalent if you can switch around the entries on the right side of the $\mapsto$ to get from one function to the other.

I'm going to say that any function $f:[n]\rightarrow[n]$ can be uniquely denoted as a list of the form $x=\{f(1),f(2),...,f(n)\}$, and I will call the collection of these lists $X$. Now, the action action that I may apply to this group is any permutation of these elements, that is, $G=S_n$, and for each permutation $g\in G,x\in X$: $g\cdot x=\{f(g(1)),f(g(2)),...,f(g(n))\}$. What we want is the number of distinct orbits (i.e. the number of equivalence classes) of $X$ as acted upon by $G$. Note, by the way, that $X$ is a set of size $n^n$.

Burnside's lemma tells us that this number corresponds to

$$|X/G|=\frac1{|G|}\sum_{g\in G}|X^g|$$ Where $|X^g|$ is the number of elements of $X$ fixed by a given permutation. I think the best way to explain what I mean here is by example. Let's consider what this means for $n=3$:

In the case of $n=3$, you could permute elements by doing nothing, which you can do in one way, switch two elements, which you can do in three ways, and shift every element right or left wrapping around, which you can do in one way. That is, there are $3!=6=|G|$ possible permutations. Now we look at which elements of $X$ are fixed by which elements of $G$:

do nothing: if $g$ does nothing, then $|X^g|=3^3=27$

switch two: if $g$ switch two elements, then $|X^g|$ is the set of all elements for which those two elements are the same. So, $|X^g|=3^2=9$

shift right or left: if $g$ shifts the elements, then $|X^g|$ contains only the constant functions. So, $|X^g|=3$

This tells us that our number of orbits is $$\frac16(1\times27+3\times9+2\times3)=10$$ That is, by this method of counting, there are 10 functions from $[3]$ to $[3]$.

Hope that helps a bit.

• +1 for the ideas, but note that you're looking at a somewhat different problem. For the equivalence noted in the question, there are $7$ classes for $n=3$. And the action I would look at is $g.f = g^{-1}fg$. – ronno Jun 10 '13 at 21:22
• Ah, good, you've seen this stuff before. I modified your problem because I wasn't sure how to get the right action, and I thought there might be a way to get from this halfway solution to what you're looking for. I'll update that if I can come up with anything to add to make this more comprehensive. – Omnomnomnom Jun 10 '13 at 21:27