# Finding double cosets of a group

I am new to Mathematica, and I would love to know if there is a function that that returns the double cosets of a group $$G$$ w.r.t a subgroup $$H$$, where a double coset is defined as $$HxH=\{h_1xh_2,\forall h_1,h_2\in H\}$$, for some $$x$$ in $$G$$. In particular, I am mostly concerned with the the number of such cosets, so it is also satisifiying if there is a function for such countings. If there's no such general functions, is there special cases for $$G$$ a symmetric group?

• Arguments about the votes to close this question and opinions about leaving it open are discussed here. May 17, 2022 at 9:32

Of course MMA don't have any of the functions you need, but we can get the double cosets of a group $$G$$ w.r.t a subgroup $$H$$ by it. Such as $$S_5$$. As we know, $$D_5$$ is a subgroup of it. Then we can get its double cosets like:

G = SymmetricGroup[5];
H = DihedralGroup[5];

Sort[DeleteDuplicates[Flatten[Outer[PermutationProduct, GroupElements[H],
GroupElements[G], GroupElements[H]]]], Less]
TemplateApply["The order of H is <*Length[%]*>"]


In particular, I am mostly concerned with the number of such cosets

I'm not sure I understand this statement of yours. If by definition, any subgroup of G can generate double cosets, so you're actually asking how many subgroups of G are there? For the $$S_5$$:

FiniteGroupData[{"SymmetricGroup", 5}, "Subgroups"]


{Trivial,{CyclicGroup,2},{CyclicGroup,3},{CyclicGroup,4},Vierergruppe,{CyclicGroup,5},{CyclicGroup,6},{SymmetricGroup,3},{DihedralGroup,4},{DihedralGroup,5},{AlternatingGroup,4},{DihedralGroup,6},{SemidirectProduct,{{CyclicGroup,4},{CyclicGroup,5}}},{SymmetricGroup,4},{AlternatingGroup,5},{SymmetricGroup,5}}