Modules

Abelian groups

Every finitely generated abelian group is a product of cyclic groups, in exactly one standard way. Finding that product from generators and relations is integer linear algebra: the Smith normal form.

The structure theorem

A finitely generated abelian group is isomorphic to

Z/d1×Z/d2×⋯×Z/dk×Zr,d1∣d2∣⋯∣dk, di>1, \mathbb Z/d_1 \times \mathbb Z/d_2 \times \cdots \times \mathbb Z/d_k \times \mathbb Z^r, \qquad d_1 \mid d_2 \mid \cdots \mid d_k,\ d_i > 1,

and the invariant factors did_i and the rank rr are determined by the group. Splitting each did_i into prime powers gives the other standard form, by elementary divisors: Z/12≅Z/4×Z/3\mathbb Z/12 \cong \mathbb Z/4 \times \mathbb Z/3 by the Chinese remainder theorem. So the abelian groups of order n=∏piain = \prod p_i^{a_i} correspond to choosing a partition of each aia_i, and there are ∏p(ai)\prod p(a_i) of them: six of order 72=233272 = 2^3 3^2.

import { abelianGroup, cyclicProduct, abelianGroups } from "@ratmath/structures";

String(cyclicProduct([4, 6]));                       // "Z/2 × Z/12"
cyclicProduct([4, 6]).toString({ primary: true });   // "Z/2 × Z/4 × Z/3"
cyclicProduct([3, 5]).isCyclic;                      // true: Z/3 × Z/5 ≅ Z/15
abelianGroups(72).map(String);
// ["Z/72", "Z/3 × Z/24", "Z/2 × Z/36", "Z/6 × Z/12", "Z/2 × Z/2 × Z/18", "Z/2 × Z/6 × Z/6"]
abelianGroup([2, 4]).order;                          // 8n

From generators and relations

Write the group additively, with generators x1,…,xnx_1, \dots, x_n and relations ∑jrijxj=0\sum_j r_{ij}x_j = 0. It is Zn/L\mathbb Z^n / L, where LL is spanned by the rows of the relation matrix RR. Row operations on RR (with integer multipliers, and swaps) change the relations but not LL; column operations change the generators. The Smith normal form uses both to reach

URV=diag⁡(d1,d2,… ),d1∣d2∣⋯ , U R V = \operatorname{diag}(d_1, d_2, \dots), \qquad d_1 \mid d_2 \mid \cdots,

with UU, VV integer matrices of determinant ±1\pm 1. The new generators y=V−1xy = V^{-1}x then satisfy just diyi=0d_i y_i = 0: the structure theorem, computed. The algorithm brings the smallest entry to the corner, divides it into its row and column, and if it fails to divide some other entry, adds that row in and goes again; the corner entry gets smaller each time, so it stops.

import { fromRelations, smithForm } from "@ratmath/structures";

// three generators, three relations
const R = [[2, 4, 4], [-6, 6, 12], [10, -4, -16]];
smithForm(R).diagonal;              // [2n, 6n, 12n]
const G = fromRelations(R);
String(G);                          // "Z/2 × Z/6 × Z/12"
G.order;                            // 144n
G.generators.map((g) => `${g.order}: ${g.vector}`);   // ["2: 1,2,2", "6: 0,3,4", "12: 0,1,1"]

String(fromRelations([[2, 0, 0]], 3));   // "Z/2 × Z^2": no relation on two of the generators

The last line reads: the element x1+2x2+2x3x_1 + 2x_2 + 2x_3 has order 2, 3x2+4x33x_2 + 4x_3 has order 6, x2+x3x_2 + x_3 has order 12, and together they generate the group as a direct product. The tests check the Smith forms against @ratmath/linalg's own, and that each listed generator has exactly the stated order.

Abelianising a group

For any group, G/G′G/G' is abelian, the largest abelian quotient. Given a presentation, it is the abelian group with the same generators and the relators read additively (count how many times each generator appears, with signs). So abelianInvariants works for infinite groups too, and for a finite group (through a presentation of it) it agrees with G.quotient(G.derivedSubgroup()).

import { abelianInvariants, presentation, GL, symmetric } from "@ratmath/structures";

String(abelianInvariants(GL(2, 3)));                            // "Z/2"
String(abelianInvariants(presentation("a, b | a^2, b^3, (ab)^3")));   // "Z/3"
String(abelianInvariants(presentation("a, b | [a, b]")));       // "Z^2"
Try itEdit the code and run it with @ratmath/structures and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs