# GAP:IsDirectFactor

From Groupprops

This article is about a GAP function.

This GAP function takes as input two groups, both having a common parent group. See other GAP functions like this.

This GAP function outputs a Boolean variable, i.e., it returns either true or false. View other GAP functions with Boolean output

## Definition

### Function type

The function takes as input two arguments, both of which are groups living inside a common parent group, and outputs a boolean (true/false).

### Behavior

The function behaves as follows:

- If the two groups are subgroups of a common parent group, and the second group is not a subgroup of the first, the function returns false.
- If the two groups are subgroups of a common parent group, and the second group is a direct factor of the first, the function returns false.
- If the two groups are subgroups of a common parent group, and the second group is a subgroup of the first but not a direct factor, the function returns true.
- If the two groups do not live as subgroups of a common parent group, GAP returns a NoMethodFound error.

### Typical use

The typical use is as follows:

IsDirectFactor(group,subgroup);

## Method

### Code

IsDirectFactor := function(G,H) return (IsSubgroup(G,H) and IsNormal(G,H) and ForAny(NormalSubgroups(G),L -> Order(L) * Order(H) = Order(G) and IsTrivial(Intersection(H,L)))); end;;