# Creating Elements of a Braid Group

This section describes the facilities for creating elements of a braid group.

## `Representative(B): GrpBrd -> GrpBrdElt`

## `Rep(B): GrpBrd -> GrpBrdElt`

Given a braid group $B$, return a representative of $B$.

## `Identity(B): GrpBrd -> GrpBrdElt`

## `Id(B): GrpBrd -> GrpBrdElt`

## `B ! 1: GrpBrd, RngIntElt -> GrpBrdElt`

Given a braid group $B$, return the identity element of $B$.

## `FundamentalElement(B: parameters): GrpBrd -> GrpBrdElt`

```magma
Presentation: MonStgElt                    Default: 
```

Return the fundamental element for the presentation of $B$ indicated by the parameter `Presentation`. Possible values for this parameter are `"Artin"` and `"BKL"`. If the parameter `Presentation` is not used, the fundamental element for the presentation currently selected for $B$ is returned.

## `Generators(B: parameters): GrpBrd -> [ GrpBrd ]`

```magma
Presentation: MonStgElt                    Default: 
```

Return a sequence containing the generators for the presentation of $B$ indicated by the parameter `Presentation`. Possible values for this parameter are `"Artin"` and `"BKL"`. If the parameter `Presentation` is not used, a sequence containing the generators for the presentation currently selected for $B$ is returned.

## `B . i: GrpBrd, RngIntElt -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and an integer $i$, where $0 < |i| < n$, return the $|i|$-th Artin generator $\sigma_i$, if $i>0$, or its inverse $\sigma_{|i|}^{-1}$, if $i<0$.

## `B . T: GrpBrd, Tup -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and a tuple $T = <r,t>$, where $1 \le |t| < |r| \le n$, return the BKL generator $a_{|r|,|t|}$, if $r,t>0$, or its inverse $a_{|r|,|t|}^{-1}$ otherwise.

## `B ! [ i₁, ..., iₖ ]: GrpBrd, [ RngIntElt ] -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and a sequence $[i_1, \cdots, i_k]$ of integers satisfying $0<|i_j|<n$ $(j=1,\dots,k)$, return the element of $B$ given by the product

$$
\sigma_{|i_1|}^{\hbox{sgn}(i_1)}\cdots\sigma_{|i_k|}^{\hbox{sgn}(i_k)}.
$$

## `B ! [ T₁, ..., Tₖ ]: GrpBrd, [ Tup ] -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and a sequence $[T_1, \cdots, T_k]$ of tuples satisfying $T_j = <r_j,t_j>$, $1 \le |t_j| < |r_j| \le n$ $(j=1,\dots,k)$, return the element of $B$ given by the product

$$
a_{|r_1|,|t_1|}^{e_1}\cdots a_{|r_k|,|t_k|}^{e_k}
$$

where $e_j = 1$ if $r_j,t_j > 0$ and $e_j = -1$ otherwise $(j=1,\dots,k)$.

## `B ! p: GrpBrd, GrpPermElt -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and a permutation $p$ on $n$ points, return the simple element defined by $p$ in the presentation currently selected for $B$ as new element of $B$. Note that the result in general depends on the presentation selected for $B$. Note further that in the BKL presentation, only permutations which are products of parallel descending cycles correspond to simple elements; attempting to coerce an invalid permutation will result in a runtime error. The function `GrpBrd:IsProductOfParallelDescendingCycles` can be used to test whether a given permutation corresponds to a BKL simple element.

## `B ! [ p₁, ...,pₖ ]: GrpBrd, [ GrpPermElt ] -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and a sequence $[p_1,\dots,p_k]$ of permutations on $n$ points, return the product $c_1\cdots c_k$ as new element of $B$, where $c_j$ is the simple element defined by $p_j$ in the presentation currently selected for $B$ $(j=1,\dots,k)$. Note that the result in general depends on the presentation selected for $B$. Note further that in the BKL presentation, only permutations which are products of parallel descending cycles correspond to simple elements; attempting to coerce a sequence containing an invalid permutation will result in a runtime error. The function `GrpBrd:IsProductOfParallelDescendingCycles` can be used to test whether a given permutation corresponds to a BKL simple element.

## `B ! T: GrpBrd, Tup -> GrpBrdElt`

Given a braid group $B$ on $n$ strings and a tuple $T = <s,l,S,r>$, where $s$ is either the string `"Artin"` or the string `"BKL"`, $l$ and $r$ are integers and $S$ is a sequence $[p_1,\dots,p_k]$ of permutations on $n$ points, return the product $D^l c_1\cdots c_k D^r$ as new element of $B$, where $D$ is the fundamental element and $c_j$ is the simple element defined by $p_j$ $(j=1,\dots,k)$ in the presentation indicated by $s$. Note that in the BKL presentation, only permutations which are products of parallel descending cycles correspond to simple elements; if $S$ contains an invalid permutation, a runtime error will result. Whether the elements of a given sequence $S$ correspond to BKL simple elements can be tested using the function `GrpBrd:IsProductOfParallelDescendingCycles`.

## `IsProductOfParallelDescendingCycles(p): GrpPermElt -> BoolElt`

Given a permutation $p$ on $n$ points, return whether $p$ is a product of parallel descending cycles, that is, whether $p$ defines a simple element in the BKL monoid on $n$ strings.

## `Random(B, r, s, m, n: parameters): GrpBrd, RngIntElt, RngIntElt, RngIntElt, RngIntElt -> GrpBrdElt`

## `RandomCFP(B, r, s, m, n: parameters): GrpBrd, RngIntElt, RngIntElt -> GrpBrdElt`

## `Random(B: parameters): GrpBrd -> GrpBrdElt`

## `RandomCFP(B: parameters): GrpBrd -> GrpBrdElt`

```magma
Presentation: MonStgElt                    Default: 
```

Given a braid group $B$ and integers $r,s,m,n$, satisfying $r\le s$ and $0\le m\le n$, a pseudo-random element of $B$ is constructed as follows. Let $D$ be the fundamental element and $C$ the set of simple elements for the presentation indicated by the parameter `Presentation`. First, integers $e\in [r,s]$ and $l\in [m,n]$ are chosen using uniform distributions on these sets. Then, for $i=1,\dots,l$, $c_i \in C$ is chosen using a uniform distribution on $C$ and the element $D^e c_1 \cdots c_l$ is returned. If no value is given for the parameter `Presentation`, the presentation selected for $B$ is used. The versions with a single argument are short for `Random(B, 0, 0, 0, 42)`.

## `Random(B, m, n: parameters): GrpBrd, RngIntElt, RngIntElt -> GrpBrdElt`

## `RandomWord(B, m, n: parameters): GrpBrd, RngIntElt, RngIntElt -> GrpBrdElt`

## `RandomWord(B: parameters): GrpBrd -> GrpBrdElt`

```magma
Presentation: MonStgElt                    Default: 
```

Given a braid group $B$ and two integers $0\le m\le n$, `Random(B, m, n)` returns a pseudo-random element of $B$ constructed as follows. First, a length $l\in [m,n]$ is chosen using a uniform distribution. Then, for $i=1,\dots,l$, $g_i \in X \cup X^{-1}\setminus \{g_{i-1}^{-1}\}$ is chosen using a uniform distribution on this set. Here, $X$ is the set of generators of the presentation indicated by the parameter `Presentation` and $X^{-1}$ is the set of generator inverses. If no value is given for the parameter `Presentation`, the presentation selected for $B$ is used. The signature `RandomWord(B)` is short for `RandomWord(B, 0, 42)`.

## `Example: Constructor (ex-ddc2bb)`

We construct the braid group $B$ on 6 strings and the symmetric group $S$ on 6 points.

```magma
> S := Sym(6);
> B := BraidGroup(6);
> B;
GrpBrd : B on 6 strings

```

By default, $B$ is created using the Artin presentation.

```magma
> GetPresentation(B);
Artin

```

We now define the fundamental element with respect to the BKL presentation of $B$ and print this element with respect to the presentation currently used for $B$, that is, with respect to the Artin presentation. Note that both a word in the Artin generators and a representation of the element in terms of Artin simple elements are printed.

```magma
> D_BKL := FundamentalElement(B : Presentation := "BKL");
> D_BKL;
B.5 * B.4 * B.3 * B.2 * B.1
<Artin, 0, [
    (1, 6, 5, 4, 3, 2)
], 0>
> GetElementPrintFormat(B);
Both

```

We print the BKL generator $a_{3,1}$.

```magma
> B.<3,1>;
B.2 * B.1 * B.2^-1
<Artin, 0, [
    (1, 3, 2),
    (1, 6)(2, 5, 3, 4)
], -1>

```

Next we change the format for printing elements of $B$ using the function [`SetElementPrintFormat`](braid-groups-construction.md#function-grpbrd-setelementprintformat) so that only a representation in terms of simple elements is printed.

```magma
> SetElementPrintFormat(~B, "CFP");

```

We now define and print several elements of $B$, illustrating the use of some of the functions described in the previous section. First we create a pseudo-random element of $B$ as product of 3 random simple elements for the Artin presentation.

```magma
> u := Random(B, 0, 0, 3, 3);
> u;
<Artin, 0, [
    (1, 6)(3, 5, 4),
    (1, 3)(2, 6)(4, 5),
    (2, 3)
], 0>

```

Next we define an element of $B$ by a product of simple elements for the BKL presentation using the coercion operator ‘[`*B* ! *T*`](#operation-grpbrd-coerce-tuple)’. Note that printing of this element is still done with respect to the Artin presentation.

```magma
> v := B ! <"BKL", 0, [ S | (1,6)(3,5,4), (1,3)(4,5)], 0>;
> v;
<Artin, 0, [
    (1, 6, 5, 4, 3, 2),
    (1, 2, 6)(3, 5),
    (2, 4, 5, 6),
    (1, 6)(2, 4, 3, 5)
], -2>

```

Finally, we look at the simple elements defined by the permutations $p = (1,3)(4,2)$ and $q = (1,4,3)$ on 6 points.

```magma
> p := S ! (1,3)(4,2);
> q := S ! (1,4,3);

```

Creating the simple elements for the Artin presentation defined by $p$ and $q$ is straightforward using the coercion operator ‘[`*B* ! *p*`](#operation-grpbrd-coerce-perm)’.

```magma
> p_Artin := B!p;
> p_Artin;
<Artin, 0, [
    (1, 3)(2, 4)
], 0>

> q_Artin := B!q;
> q_Artin;
<Artin, 0, [
    (1, 4, 3)
], 0>

```

We now change the presentation used for $B$ to the BKL presentation. Note that this also changes the presentation with respect to which elements are printed.

```magma
> SetPresentation(~B, "BKL");
> GetPresentation(B);
BKL

```

The attempt to define a simple element for the BKL presentation using the permutation $p$ fails.

```magma
> p_BKL := B!p;

>> p_BKL := B!p;
             ^
Runtime error in '!': Illegal coercion
LHS: GrpBrd
RHS: GrpPermElt

```

We should have been more careful: using the function `GrpBrd:IsProductOfParallelDescendingCycles` we see that $p$ is not a product of parallel descending cycles and hence does not define a simple element for the BKL presentation.

```magma
> IsProductOfParallelDescendingCycles(p);
false

```

$q$, on the other hand, does define a simple element for the BKL presentation and we can coerce $q$ to an element of $B$ using the operator ‘[`*B* ! *p*`](#operation-grpbrd-coerce-perm)’.

```magma
> IsProductOfParallelDescendingCycles(q);
true
> q_BKL := B!q;
> q_BKL;
<BKL, 0, [
    (1, 4, 3)
], 0>

```

Note however, that the simple element for the BKL presentation defined by $q$ and the simple element for the Artin presentation defined by $q$ are different elements of $B$! (The comparison operator [`*u* eq *v*`](braid-groups-elements.md#operation-grpbrd-eq) is described in Section [Boolean Predicates for Elements](braid-groups-elements.md#grpbrd-subsectionelementsboolean).)

```magma
> q_BKL eq q_Artin;
false

```

The representations of the Artin simple elements defined by $p$ and $q$ in terms of BKL simple elements have no obvious connection to $p$ and $q$, respectively.

```magma
> p_Artin;
<BKL, 0, [
    (1, 3, 2),
    (2, 4, 3)
], 0>

> q_Artin;
<BKL, 0, [
    (1, 4, 3, 2),
    (2, 3)
], 0>

```
