---
title: "Construction of a Finitely Presented Abelian Group and its Elements"
canonical: "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/creation.html"
source: "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/creation.md"
part: "Finitely Presented Groups"
chapter: "Abelian Groups"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Finitely Presented Groups", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/index-finitely-presented-groups.md"}
  - {"title": "Abelian Groups", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/index-abelian-groups.md"}
prev: {"title": "Introduction", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/introduction.md"}
next: {"title": "Construction of a Generic Abelian Group", "source": "https://docs.magma-maths.org/v2.30-1/FinitelyPresentedGroups/AbelianGroups/generic-abelian.md"}
intrinsics:
  - {"name": "FreeAbelianGroup", "signature": "FreeAbelianGroup(n): RngIntElt -> GrpAb"}
  - {"name": "=", "signature": "w₁ = w₂: GrpAbElt, GrpAbElt -> Rel"}
  - {"name": "r", "signature": "r[1]: GrpAbRel, RngIntElt -> GrpAbElt"}
  - {"name": "LHS", "signature": "LHS(r): Rel -> GrpAbElt"}
  - {"name": "r", "signature": "r[2]: GrpAbRel, RngIntElt -> GrpAbElt"}
  - {"name": "RHS", "signature": "RHS(r): Rel -> GrpAbElt"}
  - {"name": "Parent", "signature": "Parent(r): RelElt -> GrpAb"}
  - {"name": "AbelianGroup", "signature": "AbelianGroup< X | R >: List(Var), List(GrpAbRel) -> GrpAb, Hom(GrpAb)"}
  - {"name": "AbelianGroup", "signature": "AbelianGroup([n₁,...,nᵣ]): [ RngIntElt ] -> GrpAb"}
  - {"name": ".", "signature": "A . i: GrpAb, RngIntElt -> GrpAbElt"}
  - {"name": "Generators", "signature": "Generators(A): GrpAb -> { GrpAbElt}"}
  - {"name": "NumberOfGenerators", "signature": "NumberOfGenerators(A): GrpAb -> RngIntElt"}
  - {"name": "Ngens", "signature": "Ngens(A): GrpAb -> RngIntElt"}
  - {"name": "Parent", "signature": "Parent(u): GrpAbElt -> GrpAb"}
  - {"name": "Relations", "signature": "Relations(A): GrpAb -> [ Rel ]"}
  - {"name": "RelationMatrix", "signature": "RelationMatrix(A): GrpAb -> Mtrx"}
examples:
  - "ex-c01eb3"
  - "ex-0f1824"
  - "ex-bd5820"
  - "ex-ea4c01"
---

# Construction of a Finitely Presented Abelian Group and its Elements

## The Free Abelian Group

<a id="function-freeabeliangroup-rngintelt"></a>
### `FreeAbelianGroup(n): RngIntElt -> GrpAb`

Construct the free abelian group $F$ on $n$ generators, where $n$ is a positive integer. The $i$-th generator may be referenced by the expression `F.i`, $i = 1, \ldots, n$. Note that a special form of the assignment statement is provided which enables the user to assign names to the generators of $F$. In this form of assignment, the list of generator names is enclosed within angle brackets and appended to the variable name on the *left hand side* of the assignment statement.

<a id="example-ex-c01eb3"></a>
### `Example: Free Abelian Group (ex-c01eb3)`

The statement

```magma
> F := FreeAbelianGroup(2);
```

creates the free abelian group on two generators. Here the generators may be referenced using the standard names, $F.1$ and $F.2$.

The statement

```magma
> F<x, y> := FreeAbelianGroup(2);
```

defines $F$ to be the free abelian group on two generators and assigns the names $x$ and $y$ to the generators.

## Relations

<a id="operation-op-grpabelt-grpabelt"></a>
### `w₁ = w₂: GrpAbElt, GrpAbElt -> Rel`

Given words $w_1$ and $w_2$ over the generators of an abelian group $A$, create the relation $w_1 = w_2$. Note that this relation is not automatically added to the existing set of defining relations $R$ for $S$. It may be added to $R$, for example, through use of the `quo`-constructor (see below).

<a id="indexed-indexed-r-grpabrel-rngintelt-grpabelt"></a>
### `r[1]: GrpAbRel, RngIntElt -> GrpAbElt`

<a id="function-lhs-rel"></a>
### `LHS(r): Rel -> GrpAbElt`

Given a relation $r$ over the generators of $A$, return the left hand side of the relation $r$. The object returned is a word over the generators of $A$.

<a id="indexed-indexed-r-grpabrel-rngintelt-grpabelt-2"></a>
### `r[2]: GrpAbRel, RngIntElt -> GrpAbElt`

<a id="function-rhs-rel"></a>
### `RHS(r): Rel -> GrpAbElt`

Given a relation $r$ over the generators of $A$, return the right hand side of the relation $r$. The object returned is a word over the generators of $A$.

<a id="function-parent-relelt"></a>
### `Parent(r): RelElt -> GrpAb`

Group over which the relation $r$ is taken.

<a id="example-ex-0f1824"></a>
### `Example: Relations in a Free Abelian Group (ex-0f1824)`

We may define a group and a set of relations as follows:

```magma
> F<x, y> := FreeAbelianGroup(2);
> rels := { 2*x = 3*y, 4*x + 4*y = Id(F)} ;
```

To replace one side of a relation, the easiest way is to reassign the relation. So for example, to replace the relation $2 x = 3 y$ by $2 x = 4 y$:

```magma
> r := 2*x = 3*y;
> r := LHS(r) = 4*y;
```

## Specification of a Presentation

An abelian group with non-trivial relations is constructed as a quotient of an existing abelian group, possibly a free abelian group.

<a id="constructor-constructor-abeliangroup-list-var-list-grpabrel-grpab-hom-grpab"></a>
### `AbelianGroup< X | R >: List(Var), List(GrpAbRel) -> GrpAb, Hom(GrpAb)`

Given a list $X$ of variables $x_1, \ldots, x_r$, and a list of relations $R$ over these generators, let $F$ be the free abelian group on the generators $x_1, \ldots, x_r$. Then construct (a) an abelian group $A$ isomorphic to the quotient of $F$ by the subgroup of $F$ defined by $R$, and (b) the natural homomorphism $\phi : F \rightarrow A$.

Each term of the list $R$ is either a *word*, a *relation*, a *relation list*, or a *subgroup* of $F$.

- A *relation* consists of a pair of words, separated by ‘=’.
- A *word* $w$ is interpreted as a *relator*, that is, it is equivalent to the relation $w = 0$. (See above).
- A *relation list* consists of a list of words, where each pair of adjacent words is separated by ‘=’: $w_1 = w_2 = \cdots = w_r$. This is interpreted as the set of relations $w_1 = w_r, \ldots, w_{r - 1} = w_r$. Note that the relation list construct is only meaningful in the context of the `quo`-constructor.

A *subgroup* $H$ appearing in the list $R$ contributes its generators to the relation set for $A$, i.e., each generator of $H$ is interpreted as a relator for $A$. The group $F$ may be referred to by the special symbol `$` in any word appearing to the right of the ‘`|`’ symbol in the `quo`-constructor. Also, in the context of the `quo`-constructor, the identity element (empty word) may be represented by the digit $0$.

The function returns:

**(a)**
The quotient group $A$;

**(b)**
The natural homomorphism $\phi : F \rightarrow A$.

<a id="example-ex-bd5820"></a>
### `Example: Abelian Group from a Presentation (ex-bd5820)`

We create the abelian group defined by the presentation $< a, b, c\ |\ 7a + 4b + c, 8a + 5b + 2c, 9a + 6b + 3c >$.

```magma
> F<a, b, c> := FreeAbelianGroup(3);
> A := quo< F | 7*a + 4*b + c, 8*a + 5*b + 2*c, 9*a + 6*b + 3*c >;
> A;
AbelianGroup isomorphic to Z_3 + Z
Defined on 2 generators
Relations:
    3*A.1 = 0
```

A simple way of specifying an abelian group is as a product of cyclic groups.

<a id="function-abeliangroup-rngintelt"></a>
### `AbelianGroup([n₁,...,nᵣ]): [ RngIntElt ] -> GrpAb`

Construct the abelian group defined by the sequence $[n_1,\ldots,n_r]$ of non-negative integers as an abelian group. The function returns the direct product of cyclic groups $C_{n_1} \times C_{n_2} \times \cdots \times C_{n_r}$, where $C_0$ is interpreted as an infinite cyclic group.

<a id="example-ex-ea4c01"></a>
### `Example: Abelian Group from Cyclic Factors (ex-ea4c01)`

We create the abelian group $Z_2 \times Z_3 \times Z_4 \times Z_5 \times Z_6 \times Z \times Z$.

```magma
> G<[x]> := AbelianGroup([2,3,4,5,6,0,0]);
> G;
Abelian Group isomorphic to Z/2 + Z/6 + Z/60 + Z + Z
Defined on 7 generators
Relations:
    2*G.1 = 0
    3*G.2 = 0
    4*G.3 = 0
    5*G.4 = 0
    6*G.5 = 0
```

## Accessing the Defining Generators and Relations

The functions described here provide access to basic information stored for an abelian group $A$.

<a id="operation-operation-grpab-rngintelt-grpabelt"></a>
### `A . i: GrpAb, RngIntElt -> GrpAbElt`

The $i$-th defining generator for $A$.

<a id="function-generators-grpab"></a>
### `Generators(A): GrpAb -> { GrpAbElt}`

A set containing the generators for $A$.

<a id="function-numberofgenerators-grpab"></a>
### `NumberOfGenerators(A): GrpAb -> RngIntElt`

<a id="function-ngens-grpab"></a>
### `Ngens(A): GrpAb -> RngIntElt`

The number of generators for $A$.

<a id="function-parent-grpabelt"></a>
### `Parent(u): GrpAbElt -> GrpAb`

The parent group $A$ of the word $u$.

<a id="function-relations-grpab"></a>
### `Relations(A): GrpAb -> [ Rel ]`

A sequence containing the defining relations for $A$.

<a id="function-relationmatrix-grpab"></a>
### `RelationMatrix(A): GrpAb -> Mtrx`

A matrix where each row corresponds to one of the defining relations of $A$.
