Lesson 2 of 15

Groups

Groups

A group (G,)(G, *) is a set GG with a binary operation * satisfying four axioms:

  1. Closure: For all a,bGa, b \in G, abGa * b \in G
  2. Associativity: (ab)c=a(bc)(a * b) * c = a * (b * c)
  3. Identity: There exists eGe \in G such that ea=ae=ae * a = a * e = a for all aa
  4. Inverse: For each aGa \in G, there exists a1a^{-1} such that aa1=a1a=ea * a^{-1} = a^{-1} * a = e

Example: Zn\mathbb{Z}_n under Addition

The set {0,1,,n1}\{0, 1, \ldots, n-1\} with addition modulo nn forms a group:

  • Identity: 00
  • Inverse of aa: nan - a (mod nn)
def identity(n):
    return 0

def inverse(a, n):
    return (n - a) % n

Verifying Group Axioms

We can check whether a given Cayley table satisfies the group axioms computationally:

def has_identity(table):
    n = len(table)
    for e in range(n):
        if all(table[e][a] == a and table[a][e] == a for a in range(n)):
            return e
    return -1

Order of a Group

The order of a group is the number of elements: G|G|. The group Zn\mathbb{Z}_n has order nn.

Your Task

Implement verify_group(table) that takes a Cayley table (list of lists using elements {0,1,,n1}\{0, 1, \ldots, n-1\}) and returns True if it defines a group. Check closure (all entries in range), associativity, identity, and inverses.

Pyodide loading...
Loading...
Click "Run" to execute your code.