Is it a group? (Group theory, Abstract algebra)
Description:
Is it a group?
In abstract alegbra a group is a set and a binary operation. Our sets will contain non-integers and we are just going to deal with finite groups. The binary operation will be a function that takes in two elements of the set and returns a single value.
Your task in this kata is to create a group object and a function that decides if the group is valid.
In order for a set and binary operation to be a group it must satisfy four conditions:
Let a,b,c
be elements in our set and * our binary operation (function)
The set must be closed under the binary operation:
a*b
is an element of the set.
(The output fromgiven_function(a,b)
is an element of the set)The set must be associative under the binary operation:
(a*b)*c=a*(b*c)
(given_function(given_function(a,b),c) = given_function(a, given_function(b,c)) )
There must be an identity element
i
so that for any other element of the seta
:
i*a=a=a*i
(given_function(i,a)=a=given_function(a,i)
)For each element
a
there must be an inverse elementa^-1
in the set, such that:a*a^-1=i=a^-1*a
(given_function(a,a^-1)=identity
)
The wikipedia page is really useful for a clearer/thorougher understanding. I would also reccomend looking up Cayley tables and designing a function to create one for a group object, makes it much easier to see where you have gone wrong.
https://en.wikipedia.org/wiki/Group_(mathematics)#Definition_and_illustration
Similar Kata:
Stats:
Created | Mar 26, 2020 |
Published | Mar 26, 2020 |
Warriors Trained | 63 |
Total Skips | 1 |
Total Code Submissions | 180 |
Total Times Completed | 31 |
Python Completions | 31 |
Total Stars | 7 |
% of votes with a positive feedback rating | 89% of 22 |
Total "Very Satisfied" Votes | 18 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 20 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |