Finding generators for matrix subgroup with GAP Let $ G $ be finite groups of $ n \times n $ matrices. I am aware of various interesting subgroups of $ G $, which I have verified the existence of using commands like
NormalSubgroups
IsomorphicSubgroups
RepresentativesPerfectSubgroups
RepresentativesSimpleSubgroups
ConjugacyClassesMaximalSubgroups
ConjugacyClassesPerfectSubgroups
How to I find a generating set for a subgroup found this way?
I think this question is clear, but to give a very concrete example: I have a group $ G $ of $ 46080 $ $ 4 \times 4 $ matrices with a subgroup isomorphic to $ SL(2,9) $. How do I find generators for this $ SL(2,9) $ subgroup?
 A: The command GeneratorsOfGroup can be used to obtain a generating set of a subgroup:
# Let G be a matrix group
gap> G := Group([
>     [ [ -1, -1, 0, 1 ], [ 0, -1, -1, 1 ], [ 0, 0, 0, -1 ], [ -1, -1, -1, 1 ] ],
>     [ [ 0, 1, 0, 0 ], [ 1, 0, 0, 0 ], [ 0, 0, -1, 0 ], [ 0, 0, -1, 1 ] ]
> ]);

# Pick H to be some subgroup isomorphic to D24
gap> CCS := List( ConjugacyClassesSubgroups( G ), Representative );;
gap> H := First( Filtered(CCS, H -> IsomorphismGroups( H, DihedralGroup(24) ) <> fail ) );
gap> GeneratorsOfGroup( H );
[ [ [ -1, 0, 0, 0 ], [ 0, -1, 0, 0 ], [ 0, 0, -1, 0 ], [ 0, 0, 0, -1 ] ],
  [ [ 1, 1, 1, -2 ], [ 0, -1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 1, -1 ] ],
  [ [ -1, -1, -1, 1 ], [ 1, 0, 0, -1 ], [ 0, 0, -1, 1 ], [ 0, 0, -1, 0 ] ],
  [ [ -1, -1, -1, 2 ], [ 0, 0, 1, 0 ], [ 0, -1, 0, 0 ], [ -1, -1, 0, 1 ] ] ]

It may also be worth looking at GAP Manual: 39.22 Special Generating Sets. In particular SmallGeneratingSet can be very useful, both for effiency and for readability.
As for you comment, which I'll treat as a second part of your question: you can take a PreImagesRepresentative of the EpimorphismFromFreeGroup. Or you use Factorization, which does the same but tries to find a short word. In both cases you will get a word in the free group with $n$ generators, where $n$ is the size of the generating set of $G$. More information can be found in  GAP Manual: 39.5 Expressing Group Elements as Words in Generators.
# Expressing first generator of H in terms of generators of G
gap> epi := EpimorphismFromFreeGroup( G );;
gap> h := GeneratorsOfGroup( H )[1];
[ [ -1, 0, 0, 0 ], [ 0, -1, 0, 0 ], [ 0, 0, -1, 0 ], [ 0, 0, 0, -1 ] ]
gap> x := PreImagesRepresentative( epi, h );
(x1^-1*x2)^2*x1*x2*x1*(x2^-1*x1^-3)^2*x2^-1
gap> y := Factorization( G, h );
(x2*x1^2)^4
gap> ( G.2 * G.1^2 )^4 = h;
true
gap> Image( epi, y ) = h;
true

