Lesson 2 of 15
Groups
Groups
A group is a set with a binary operation satisfying four axioms:
- Closure: For all ,
- Associativity:
- Identity: There exists such that for all
- Inverse: For each , there exists such that
Example: under Addition
The set with addition modulo forms a group:
- Identity:
- Inverse of : (mod )
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: . The group has order .
Your Task
Implement verify_group(table) that takes a Cayley table (list of lists using elements ) 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.