# Construction of Elements

## Construction of an Element

Throughout this subsection we shall assume that the carrier set for the group $G$ is a subset of the set $S$. Thus, if $G$ is a permutation group on the set $X$, its carrier set will be a subset of ${\operatorname{Sym}}(X)$.

### `elt< G | L >: Grp, List(Elt) -> GrpElt`

Given a group $G$ whose elements are a subset of the set $S$, and a list $L$ of objects $a_1, a_2, \ldots, a_n$ defining an element of $S$, construct this element $g$ of $S$. Then, the element $g$ will be tested for membership of $G$, and if $g$ is not an element of $G$, the function will fail. If $g$ does lie in $G$, $g$ will be returned with $G$ as its parent.

### `G ! Q: Grp, [ Elt ] -> GrpElt`

Given a group $G$ whose elements are a subset of the set $S$, and a sequence $Q=[ a_1, a_2, \ldots, a_n ]$ defining an element of $S$, construct this element $g$ of $S$. Then, the element $g$ will be tested for membership of $G$, and if $g$ is not an element of $G$, the function will fail. If $g$ does lie in $G$, $g$ will be returned with $G$ as its parent.

### `Identity(G): Grp -> GrpElt`

### `Id(G): Grp -> GrpElt`

Construct the identity element in the group $G$.

## Coercion

### `G ! g: Grp, GrpElt -> GrpElt`

Given a group $G$ and an element $g$ of $H$, where $G$ and $H$ are subgroups of some common over-group and $g$ is contained in $G$, embed $g$ in $G$. Thus this operator changes the parent of $g$ into $G$. The coercion may fail for groups in the category `GrpFP`.

## Homomorphisms

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

Return the group homomorphism $\phi\ : G \rightarrow H$ defined by extending the map of the generators of $G$, as given by the list $L$ on the right side of the constructor. Suppose that the generators of $G$ are $g_1, \dots, g_n$, and that $\phi(g_i)=h_i$ for each $i$. Then $L$ must be one of the following:

**(a)**
a list of the $n$ 2-tuples $< g_i, h_i >$ (order not important);

**(b)**
a list of the $n$ arrow-pairs $g_i$ `->` $h_i$ (order not important);

**(c)**
$h_1, \dots, h_n$ (order is important).

For its computations, Magma often assumes that the mapping so defined is a homomorphism without attempting to verify this.

For certain categories of groups, e.g. `GrpGPC`, the homomorphism constructor provides some additional functionality. See the chapter on the appropriate category for further information.

### `hom< G -> H | x :-> e(x) >: Grp, Grp -> Map`

Return the group homomorphism $\phi : G \rightarrow H$ defined by the rule $\phi(x)=e(x)$, where $x$ is a general element of $G$ and $e(x)$ is an expression in $x$. The symbol $x$ may be any identifier name, and has local scope. For its computations, Magma assumes the expression defines a homomorphism, but does not verify this.

### `IdentityHomomorphism(G): Grp -> Map`

Return the identity homomorphism $\phi: G\rightarrow G: x\mapsto x$.

### `Example: Homomorphisms (ex-c624be)`

Construction of an isomorphism from the cyclic group of order 15 to the abelian group isomorphic to ${\mathbb{Z}}/15{\mathbb{Z}}$, by giving the image of the generator:

```magma
> C15 := CyclicGroup(15);
> C15;
Permutation group C15 acting on a set of cardinality 15
Order = 15 = 3 * 5
    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
> A15 := AbelianGroup([15]);
> A15;
Abelian Group isomorphic to Z/15
Defined on 1 generator
Relations:
    15*A15.1 = 0
> iso11 := hom< C15 -> A15 | C15.1 -> 11*A15.1 >;
> A15 eq iso11(C15);
true
> forall{ <c, d> : c, d in C15 | iso11(c * d) eq iso11(c) * iso11(d) };
true

```

### `Example: Homomorphisms 2 (ex-7e66d9)`

An endomorphism of the same cyclic group, defined using an expression. The image is cyclic of order 5.

```magma
> C15 := CyclicGroup(15);
> h := hom< C15 -> C15 | g :-> g^3 >;
> forall{ <c, d> : c, d in C15 | h(c * d) eq h(c) * h(d) };
true
> im := h(C15);
> im;
Permutation group im acting on a set of cardinality 15
Order = 5
    (1, 4, 7, 10, 13)(2, 5, 8, 11, 14)(3, 6, 9, 12, 15)
> IsCyclic(im);
true

```

## Arithmetic with Elements

### `g * h: GrpElt, GrpElt -> GrpElt`

Product of element $g$ and element $h$, where $g$ and $h$ belong to the same generic group $U$. If $g$ and $h$ both belong to the same proper subgroup $G$ of $U$, then the result will be returned as an element of $G$; if $g$ and $h$ belong to subgroups $H$ and $K$ of a subgroup $G$ of $U$, then the product is returned as an element of $G$. Otherwise, the product is returned as an element of $U$. The product in abelian groups is called the sum and is written `g + h` instead.

### `g ^ n: GrpElt, RngIntElt -> GrpElt`

The $n$-th power of the group element $g$, where $n$ is a positive, negative or zero integer. In abelian groups, this is written as a scalar product `n * g` instead.

### `g / h: GrpElt, GrpElt -> GrpElt`

Product of the group element $g$ by the inverse of the group element $h$, i.e., the element $gh^{-1}$. Here $g$ and $h$ must belong to the same generic group $U$. The rules for determining the parent group of $g / h$ are the same as for $gh$. In abelian groups, this is written additively as `g - h`.

### `g ^ h: GrpElt, GrpElt -> GrpElt`

Conjugate of the group element $g$ by the group element $h$, i.e., the element $h^{-1}gh$. Here $g$ and $h$ must belong to the same generic group $U$. The rules for determining the parent group of $g^h$ are the same as for $gh$. In abelian groups, this operation does not exist.

### `(g, h): GrpElt, GrpElt -> GrpElt`

Commutator of the group elements $g$ and $h$, i.e., the element $g^{-1}h^{-1}gh$. Here $g$ and $h$ must belong to the same generic group $U$. The rules for determining the parent group of $(g, h)$ are the same as those for $gh$.

### `(g₁, ..., gᵣ): GrpElt, ..., GrpElt -> GrpElt`

Given $r$ elements $g_1, \ldots, g_r$ belonging to a common group, return their commutator. Commutators are *left-normed*, so they are evaluated from left to right.

### `g eq h: GrpElt, GrpElt -> BoolElt`

Given elements $g$ and $h$ belonging to the same generic group, return `true` if $g$ and $h$ are the same element, `false` otherwise.

### `g ne h: GrpElt, GrpElt -> BoolElt`

Given elements $g$ and $h$ belonging to the same generic group, return `true` if $g$ and $h$ are distinct elements, `false` otherwise.

### `IsId(g): GrpElt -> BoolElt`

### `IsIdentity(g): GrpElt -> BoolElt`

Returns `true` if the group element $g$ is the identity element.

### `Order(g): GrpElt -> RngIntElt`

The order of the group element $g$.

### `Example: Arithmetic (ex-7b16a3)`

We illustrate the arithmetic operations by applying them to some elements of ${\operatorname{Sym}}(9)$.

```magma
> G := Sym(9);
> x := G ! (1,2,4)(5,6,8)(3,9,7);
> y := G ! (4,5,6)(7,9,8);
> x*y;
(1, 2, 5, 4)(3, 8, 6, 7)
> x^-1;
(1, 4, 2)(3, 7, 9)(5, 8, 6)
> x^2;
(1, 4, 2)(3, 7, 9)(5, 8, 6)
> x / y;
(1, 2, 6, 9, 8, 4)(3, 7)
> x^y;
(1, 2, 5)(3, 8, 9)(4, 7, 6)
> (x, y);
(1, 7, 3, 6)(4, 5, 9, 8)
> x^y eq y^x;
false
> CycleStructure(x^2*y);
[ <6, 1>, <2, 1>, <1, 1> ]
> Degree(y);
6
> Order(x^2*y);
6

```
