# Constructing Coxeter Groups

For many of the intrinsics that construct Coxeter groups it is possible to specify the category of the group as the first argument: either `GrpMat` (a reflection group), `GrpFPCox`, `GrpFP` (a finitely presented group), `GrpPermCox` or `GrpPerm` (a permutation group). If the category is not supplied, a permutation group of type `GrpPermCox` is returned for finite groups and a finitely presented group of type `GrpFPCox` is returned for infinite groups. If `GrpPermCox` is specified for an infinite group, an error is signalled.

## `CoxeterGroup(grpcat, N): Cat, MonStgElt -> grpcat`

The finite or affine Coxeter group of type `grpcat` with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](../CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

There are variations of this signature (see below). The second argument can be a Coxeter matrix, a Cartan matrix, a Coxeter graph, a Dynkin digraph, a root system, a root datum or, as in this case, a Cartan name given by a string.

## `CoxeterGroup(N): MonStgElt -> Grp`

The finite Coxeter group of type `GrpPermCox` or the affine Coxeter group of type `GrpFPCox` with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](../CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

## `IrreducibleCoxeterGroup(grpcat, X, n): Cat, MonStgElt, RngIntElt -> grpcat`

## `IrreducibleCoxeterGroup(X, n): MonStgElt, RngIntElt -> .`

The finite or affine irreducible Coxeter group of type `grpcat` with Cartan name $X_n$, or $I_2(n)$ if $X=$`"I"` (see Section [Finite and Affine Coxeter Groups](../CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

## `Example: Construct By Name (ex-fcfb78)`

```magma
> CoxeterGroup(GrpFPCox, "B3");
Coxeter group: Finitely presented group on 3 generators
Relations
    $.1 * $.2 * $.1 = $.2 * $.1 * $.2
    $.1 * $.3 = $.3 * $.1
    ($.2 * $.3)^2 = ($.3 * $.2)^2
    $.1^2 = Id($)
    $.2^2 = Id($)
    $.3^2 = Id($)
> CoxeterGroup("A2B2");
Coxeter group: Permutation group acting on a set of cardinality 14
Order = 48 = 2^4 * 3
    (1, 8)(2, 5)(9, 12)
    (1, 5)(2, 9)(8, 12)
    (3, 10)(4, 6)(11, 13)
    (3, 7)(4, 11)(10, 14)

```

Note that if the category is not supplied, a permutation group of type `GrpPermCox` is returned for finite groups and a finitely presented group of type `GrpFPCox` is returned for infinite groups.

## `CoxeterGroup(grpcat, M): Cat, AlgMatElt -> grpcat`

The Coxeter group of type `grpcat` with Coxeter or Cartan matrix $M$ (see Chapter [Coxeter Systems](../CoxeterSystems/index-coxeter-systems.md#chapcartan)).

## `CoxeterGroup(grpcat, G): Cat, GrphUnd -> grpcat`

The Coxeter group of type `grpcat` with Coxeter graph $G$ (see Chapter [Coxeter Systems](../CoxeterSystems/index-coxeter-systems.md#chapcartan)).

## `CoxeterGroup(grpcat, D): Cat, GrphDir -> grpcat`

The Coxeter group of type `grpcat` with Dynkin digraph $D$ (see Chapter [Coxeter Systems](../CoxeterSystems/index-coxeter-systems.md#chapcartan)).

## `CoxeterGroup(M): AlgMatElt -> Grp`

The Coxeter group of type `GrpPermCox` or `GrpFPCox` with Coxeter or Cartan matrix $M$ (see Chapter [Coxeter Systems](../CoxeterSystems/index-coxeter-systems.md#chapcartan)).

## `CoxeterGroup(G): GrphUnd -> Grp`

The Coxeter group of type `GrpPermCox` or `GrpFPCox` with Coxeter graph $G$ (see Chapter [Coxeter Systems](../CoxeterSystems/index-coxeter-systems.md#chapcartan)).

## `CoxeterGroup(D): GrphDir -> Grp`

The Coxeter group of type `GrpPermCox` or `GrpFPCox` with Dynkin digraph $D$ (see Chapter [Coxeter Systems](../CoxeterSystems/index-coxeter-systems.md#chapcartan)).

## `Example: Construct From Matrix (ex-2b7d19)`

```magma
> M := SymmetricMatrix([ 1, 4,1, 3,4,1 ]);
> G<a,b,c> := CoxeterGroup(M);
> G;
Coxeter group: Finitely presented group on 3 generators
Relations
    (a * b)^2 = (b * a)^2
    a * c * a = c * a * c
    (b * c)^2 = (c * b)^2
    a^2 = Id($)
    b^2 = Id($)
    c^2 = Id($)
> M := SymmetricMatrix([ 1, 3,1, 2,3,1 ]);
> G<a,b,c> := CoxeterGroup(M);
> G;
Coxeter group: Permutation group G acting on a set of cardinality 12
Order = 24 = 2^3 * 3
    (1, 7)(2, 4)(5, 6)(8, 10)(11, 12)
    (1, 4)(2, 8)(3, 5)(7, 10)(9, 11)
    (2, 5)(3, 9)(4, 6)(8, 11)(10, 12)
> G<a,b,c> := CoxeterGroup(GrpFPCox, M);
> G;
Coxeter group: Finitely presented group on 3 generators
Relations
    a * b * a = b * a * b
    a * c = c * a
    b * c * b = c * b * c
    a^2 = Id($)
    b^2 = Id($)
    c^2 = Id($)

```

Note that a Coxeter group does not have a unique Cartan matrix.

```magma
> C := CartanMatrix("G2");
> W := CoxeterGroup(GrpFPCox, C);
> CartanMatrix(W);

>> CartanMatrix(W);
               ^
Runtime error in 'CartanMatrix': Bad argument types
Argument types given: GrpFPCox

```

## `CoxeterGroup(grpcat, R): Cat, RootStr -> grpcat`

The finite Coxeter group of type `grpcat` with root system or root datum $R$ (see Chapters [Root Systems](../RootSystems/index-root-systems.md#chaprootsys) and [Root Data](../RootData/index-root-data.md#chaprootdtm)).

## `CoxeterGroup(R): RootStr -> GrpPermCox`

The finite Coxeter group of type `GrpPermCox` with root system or root datum $R$ (see Chapters [Root Systems](../RootSystems/index-root-systems.md#chaprootsys) and [Root Data](../RootData/index-root-data.md#chaprootdtm)).

## `CoxeterGroup(A, B): Mtrx, Mtrx -> GrpPermCox`

The permutation representation (or, if the group is infinite) the FP representation of the Coxeter group with simple roots given by the rows of the matrix $A$ and simple coroots given by the rows of the matrix $B$. The matrices $A$ and $B$ must have the following properties:

1. $A$ and $B$ must have the same number of rows and the same number of columns; they must be defined over the same field, which must be the rational field, a number field, or a cyclotomic field; the entries must be real;

2. the number of columns must be at least the number of rows; and

3. $AB^t$ must be the Cartan matrix of a Coxeter group.

## `CoxeterGroup(grpcat, A, B): Cat, Mtrx, Mtrx -> grpcat`

The Coxeter group of type `grpcat` where `grpcat` is `GrpMat`, `GrpPermCox`, `GrpPerm` or `GrpFPCox`. As above, the rows of $A$ are the simple roots and the rows of $B$ are the simple coroots.

## `Example: Construct By Root (ex-af5154)`

```magma
> R := RootDatum("A3" : Isogeny := 2);
> CoxeterGroup(R);
Coxeter group: Permutation group acting on a set of cardinality 12
Order = 24 = 2^3 * 3
    (1, 7)(2, 4)(5, 6)(8, 10)(11, 12)
    (1, 4)(2, 8)(3, 5)(7, 10)(9, 11)
    (2, 5)(3, 9)(4, 6)(8, 11)(10, 12)

```
