It is a well known theorem that $2$-cocycle are in bijection with Group extensions.
Suppose if I have group extension, say, for example, $$1\rightarrow C_2 \rightarrow D_{16}\rightarrow D_8\rightarrow 1 $$
Is there a way to find $2$-cocycle corresponding to this extension using GAP?
There are two implementations. One specific for solvable group (using
TwoCohomology) and a newer one that also works for non-solvable groups (but whose implementation will work for solvable groups only in the next release). The generic algorithm used is describe in section 7 of the paper [Dietrich, H, Hulpke, A., Universal covers of finite groups. J. Algebra 569 (2021), 681–712].Note that in either case, the 2-cocycle is given as a vector whose entries correspond to a presentation of the factor group, so just looking at the entries of the vector might be less informative.
For example:
Now calculating cohomology using the PC-group only code:
This is in position 4, so the vector
cohom[4]corresponds to the group $D_{16}$.For completeness, let me also describe how to use the code that can handle non-solvable groups. (Alas, it will only be able to handle solvable groups in the next (4.12) release, which I'm using here):
In fact one can use compatible pairs to reduce on certain isomorphisms: