> < ^ Date: Sun, 28 Mar 1999 16:53:52 +0100
> < ^ From: Steve Linton <sal@dcs.st-and.ac.uk >
> < ^ Subject:

Dear Devon,

I am new to the gap language. I just want to verify if I have group
G, generated by say 5 elements say {a,b,c,d,e} and I want to find the
subgroup of this group G, generated by 2 elements say {a,b} would H :=
Subgroup(G,[a,b]); be ok.

The basic answer to this question is "yes". Subgroup is the function to
construct subgroups, and one passes to it the group, and a list of
subgroup generators. If this seems to work then it is working and you

There is one possibly subtle point might be involved in what you say:
GAP must actually have the generators stored in variables called a,b,
etc. It is not enough for them merely to print that way. The following
short session (in GAP4, something similar would be possible in GAP3)
displays the problem and the solution:

```gap> g := FreeGroup("a","b","c","d","e");
<free group on the generators [ a, b, c, d, e ]>
gap> a;
Variable: 'a' must have a value
gap> h := Subgroup(g,[a,b]);
Variable: 'a' must have a value
gap> a := g.1;
a
gap> b := g.2;
b
gap> h := Subgroup(g,[a,b]);
Group([ a, b ])
```

One final point. You will notice that I used lower case g and h in my
example. This is good practice. Global variables whose names begin with
an upper case letter may be used by the library as the names of library
functions. Overwriting them with different values can have very strange
effects. In fact, and at present, G and H are safe (unlike C,E,X and Z,
for instance) but using a lower case is a good habit to get into.

Steve Linton