4

In case of a finite subset of a group, the subgroup test boils down to showing that the subset is closed under the group operation. This holds, in particular, for the subsets of a finite group.

Q. Given a subset $\Sigma\subseteq S_n$ of size $n$, what is the time complexity of the most efficient deterministic algorithm, which implements the test for $\Sigma$? In particular, is it better than $O(n^3)$?

Kan't
  • 5,505
  • 1
    Making use of Lagrange theorem could be useful, maybe finding cycles very quickly could be useful? But then (provided it works) the celerity of the algorithm would depend on the « compositeness » of n – julio_es_sui_glace Aug 31 '25 at 16:13
  • 1
    In your previous questions you wanted to test whether $S$ is a transitive subgroup of $S_n$. Is that still what you want here? I can see how to do that in time $O(n^2 \log n)$. A general subgroup test might be harder. (In fact I can't immediately see how to that in time $O(n^3)$.) – Derek Holt Aug 31 '25 at 17:00
  • 2
    Since we are assuming that $|S| = n$, if $S$ is a subgroup then it must have a base of size at most $\log n$ and I think that by first finding a base we could solve the general problem (without requiring transitivety) in time $O(n^2 (\log n)^2)$, but I don't feel like writing down the details. – Derek Holt Sep 01 '25 at 14:33

1 Answers1

6

I will briefly describe a deterministic algorithm with time complexity $O(n^2 \log n)$ for testing whether $S$ (with $|S|=n$) is a transitive (and hence regular) subgroup of $S_n$. Note that, as is usual when analysing permutation group algorithms,we assume a RAM model in which images of points under permutations can be computed in constant time.

We start by finding, for each $k \in \{1,\ldots,n\}$ a permutation in $S$ that maps $1$ to $k$. This takes time $O(n)$ and enables us to identify elements in $S$ in constant time, because we only need to look at the image of $1$ under the element to be tested. Of course if this step fails then $S$ is not a transitive subgroup of $S_n$.

The idea of the algorithm is to define a subset $X$ of $S$ that generates $S$ (assuming that $S$ is a subgroup). We will have $|X| \le \log_2 n$, and we only need to test the products $sx$ for $s \in S$ and $x \in X$ for membership of $S$. Computing this product, identifying it, and checking whether it really is in $S$ takes time $O(n)$, so the whole process takes time $O(n^2 \log n)$. If any of the membership tests fails then $S$ is not a subgroup. (Since the group is finite, we don't need to worry about inverses of elements of $X$.)

The algorithm splits into $|X|$ stages. After stage $k$, we have computed a subset $\{x_1,x_2,\ldots,x_k\}$ of $X$ of size $k$, and a subset $S_k$ of $S$ equal to the subgroup of $S_n$ generated by $X_k$.

If $S_k = S$, then $S$ is a subgroup, and we are done. Otherwise we proceed to Stage $k+1$, find an element $x_{k+1} \in S \setminus S_k$ and adjoin it to $X$, and define $S_{k+1}=S_k$. Then we compute all products of elements of $S_k$ with $x_{k+1}$ and adjoin any new elements found to $S_{k+1}$. The new elements found have to be multiplied by all elements of $X$, so we need to keep a record of which products have been calculated, but that is not difficult. Stage $k+1$ finishes when all products $sx$ with $s \in S_{k+1}$ and $x \in X_{k+1}$ have computed and adjoined to $S_{k+1}$ is necessary.

For the more general problem of testing whether $S$ is just a subgroup (not necessarily transitive) of $S_n$, the identification of elements of $S$ is not so straightforward. In practice this would be done using hashing, which would not add much time to the algorithm. But for hashing you can only realistically estimate an expected time, rather than a worst case time. Many of the best and useful algorithms for permutation groups use randomized techniques, and insisting on deterministic algorithms seems to be an unnecessary restriction.

Derek Holt
  • 98,484
  • Thank you so much. I took the liberty to link your answer here: https://mathoverflow.net/a/499738/495174. If anyhing is wrong/misunderstood on my side, I'll modify/delete. – Kan't Sep 01 '25 at 10:24
  • May I ask you if you know of any reference for this algorithm? – Kan't Sep 15 '25 at 17:40
  • 1
    @Kan't You can ask, but I am afraid that the answer is no, I just thought about it and wrote it down. But I am not claiming that there is no reference - most things of this type have appeared before somewhere. – Derek Holt Sep 15 '25 at 18:49