# Homomorphisms

Homomorphisms are an important part of group theory, and Magma supports homomorphisms between groups. Many useful homomorphisms are returned by constructors and intrinsic functions. Examples of these are the `quo` constructor, the `sub` constructor and intrinsic functions such as `OrbitAction` and `FPGroup`, which are described in more detail elsewhere in this chapter. In this section we describe how the user may create their own homomorphisms with domain a matrix group.

## `hom<G -> H | L>: GrpMat, Grp, List -> Map`

Given the matrix group $G$ and a group $H$, construct the homomorphism $f : G \to H$ given by the generator images in $L$. The clause $L$ may be any one of the following types:

**(a)**
A list of elements of $H$, giving images of the generators of $G$;

**(b)**
A list of pairs, where the first in the pair is an element of $G$ and the second its image in $H$, where pairs may be given in either of the (equivalent) forms `<g,h>` or `g -> h`;

**(c)**
A sequence of elements of $H$, as in (a);

**(d)**
A set or sequence of pairs, as in (b);

Each image element specified by the list must belong to the *same* group $H$. In the cases where pairs are given the given elements of $G$ must generate $G$.

## `Domain(f): Map -> Grp`

The domain of the homomorphism $f$.

## `Codomain(f): Map -> Grp`

The codomain of the homomorphism $f$.

## `Image(f): Map -> Grp`

The image or range of the homomorphism $f$. This will be a subgroup of the codomain of $f$. The algorithm computes the image and kernel simultaneously (see [[Leedham-Green *et al.*, 1991](../../references.md#cite-grp-homs)]).

## `Kernel(f): Map -> Grp`

The kernel of the homomorphism $f$. This will be a normal subgroup of the domain of $f$. The algorithm computes the image and kernel simultaneously (see [[Leedham-Green *et al.*, 1991](../../references.md#cite-grp-homs)]).

## `IsHomomorphism(G, H, Q): GrpMat, GrpMat, SeqEnum[GrpMatElt] -> Bool, Map`

Return the value `true` if the sequence $Q$ defines a homomorphism from the group $G$ to the group $H$. The sequence $Q$ must have length `Ngens(G)` and must contain elements of $H$. The $i$-th element of $Q$ is interpreted as the image of the $i$-th generator of $G$ and the function decides if these images extend to a homomorphism. If so, the homomorphism is also returned.

## `Example: Homomorphism (ex-868ec0)`

We construct the usual degree 2 matrix representation of the dihedral group of order 20, and a homomorphism from it to the symmetric group of degree 5.

```magma
> K<z> := CyclotomicField(20);
> zz := RootOfUnity(10, K);
> i := RootOfUnity(4, K);
> cos := (zz+ComplexConjugate(zz))/2;
> sin := (zz-ComplexConjugate(zz))/(2*i);
> gl := GeneralLinearGroup(2, K);
> M := sub< gl | [cos, sin, -sin, cos], [-1,0,0,1]>;
> #M;
20
> S := SymmetricGroup(5);
> f := hom<M->S |[S|(1,2,3,4,5), (1,5)(2,4)]>;
> Codomain(f);
Symmetric group S acting on a set of cardinality 5
Order = 120 = 2^3 * 3 * 5
> Image(f);
Permutation group acting on a set of cardinality 5
Order = 10 = 2 * 5
  (1, 2, 3, 4, 5)
  (1, 5)(2, 4)
> Kernel(f);
MatrixGroup(2, K) of order 2
Generators:
  [-1  0]
  [ 0 -1]

```

## `PermutationRepresentation(G): GrpMat -> Map, GrpPerm, GrpMat`

```magma
ModScalars: BoolElt                    Default: false
```

Given a finite matrix group $G$, return a homomorphism $f$, a permutation group $P$ and a matrix group $K$. If the parameter `ModScalars` is `false` (the default), then $f : G\to P$ is a faithful permutation representation of $G$, and $K$ is the trivial group. If `ModScalars` ie `true`, then $f : G \to P$ is a homomorphism whose kernel $K$ is the subgroup of scalars in $G$.

## `Example: Perm Rep (ex-2bcb12)`

Construct a homomorphism from the special linear matrix group SL(4,5) onto the projective permutation group PSL(4,5).

```magma
> S := SL(4,5);
> f, P, K := PermutationRepresentation(S : ModScalars);
> #K;
4
$$a> assert $1 eq 4;
> Degree(P);
156
$$a> assert $1 eq 156;
> L := PSL(4,5);
> ok, phi := IsIsomorphic(P,L);
> ok;
true
> phi:Minimal;
Homomorphism of GrpPerm: P, Degree 156, Order 2^7 * 3^2 * 5^6 * 13 * 31 into
GrpPerm: L, Degree 156, Order 2^7 * 3^2 * 5^6 * 13 * 31

```

## Construction of Extensions

### `DirectProduct(G, H): GrpMat, GrpMat -> GrpMat`

Given two matrix groups $G$ and $H$ of degrees $m$ and $n$ respectively, construct the direct product of $G$ and $H$ as a matrix group of degree $m + n$.

### `DirectProduct(Q): [ GrpMat ] -> GrpMat`

Given a sequence $Q$ of $n$ matrix groups, construct the direct product $Q[1] \times Q[2] \times \ldots \times Q[n]$ as a matrix group of degree equal to the sum of the degrees of the groups $Q[i]$, $(i = 1, \ldots, n)$.

### `SemiLinearGroup(G, S): GrpMat, FldFin -> GrpMat`

Given a matrix group $G$ over the finite field $K$ and a subfield $S$ of $K$, construct the semilinear extension of $G$ over the subfield $S$.

### `TensorWreathProduct(G, H): GrpMat, GrpPerm -> GrpMat`

Given a matrix group $G$ and a permutation group $H$, construct action of the wreath product on the tensor power of $G$ by $H$, which is the (image of) the wreath product in its action on the tensor power (of the space that $G$ acts on). The degree of the new group is $d^k$ where $d$ is the degree of $G$ and $k$ is the degree of $H$.

### `WreathProduct(G, H): GrpMat, GrpPerm -> GrpMat`

Given a matrix group $G$ and a permutation group $H$, construct the wreath product $G \wr H$ of $G$ and $H$.

### `Example: Constructions (ex-112242)`

We define $G$ to be ${\operatorname{SU}}(3, 4)$ and $H$ to be the symmetric group of order $6$. We then proceed to form the direct product of $G$ with itself and the tensor and wreath products of $G$ and $H$.

```magma
> K<w> := FiniteField(4);
> G := SpecialUnitaryGroup(3, K);
> D := DirectProduct(G, G);
> D;
MatrixGroup(6, GF(2, 2))
Generators:
[  1   w   w   0   0   0]
[  0   1 w^2   0   0   0]
[  0   0   1   0   0   0]
[  0   0   0   1   0   0]
[  0   0   0   0   1   0]
[  0   0   0   0   0   1]

[w 1 1 0 0 0]
[1 1 0 0 0 0]
[1 0 0 0 0 0]
[0 0 0 1 0 0]
[0 0 0 0 1 0]
[0 0 0 0 0 1]

[  1   0   0   0   0   0]
[  0   1   0   0   0   0]
[  0   0   1   0   0   0]
[  0   0   0   1   w   w]
[  0   0   0   0   1 w^2]
[  0   0   0   0   0   1]

[1 0 0 0 0 0]
[0 1 0 0 0 0]
[0 0 1 0 0 0]
[0 0 0 w 1 1]
[0 0 0 1 1 0]
[0 0 0 1 0 0]
> Order(D);
46656
> H := SymmetricGroup(3);
> E := WreathProduct(G, H);
> Degree(E);
9
> Order(E);
60466176
> F := TensorWreathProduct(G, H);
> Degree(F);
27
> Order(F);
6718464

```
