The dihedral group $D\_8$ can be presented as $(\mathbb{Z}\_2\times \mathbb{Z}\_2)\rtimes \_{\rho}\mathbb{Z}\_2$, where the last factor acts on $\mathbb{Z}\_2\times \mathbb{Z}\_2$ as
$$
\rho\_1(a,b)=(b,a) \ .
$$
I am interested in explicit 3-cocycle of the group cohomology $H^3(D\_8,\mathbb{R}/\mathbb{Z})$. Let me be more explicit about the presentation I would like to see, and which part of the group-cohomology I want to represent. Given a manifold $X$ a class in $H^1(X,\mathbb{D}\_8)$ (the $H^1$ is the only one existing with non-abelian coefficients) can be decomposed into classes $A\in H^1(X,\mathbb{Z}\_2)$ and $(B\_1,B\_2)\in H\_{\rho}^1(X,\mathbb{Z}\_2\times \mathbb{Z}\_2)$ (this denotes the cohomology with local coefficients, understanding $\mathbb{Z}\_2\times\mathbb{Z\_2}$ as a $\mathbb{Z}\_2$ module for $\rho$). I know that there exist a (unique) order-two class in $H^3(D\_8,\mathbb{R}/\mathbb{Z})$ which when pulled back using $A, (B\_1,B\_2)$ produces
$$
A\cup B\_1\cup B\_2
$$
where the cup product is the standard one for $\mathbb{Z}\_2$. I think this is essentially the class corresponding to the subgroup $H^1\_{\rho}(\mathbb{Z}\_2,H^2(\mathbb{Z}\_2\times \mathbb{Z}\_2,\mathbb{R}/\mathbb{Z}))\cong \mathbb{Z}\_2$. Does this make sense?


I look for a generalization replacing $\mathbb{Z}\_n\times \mathbb{Z}\_n$ with $n$ even. $\rho$ still acts as $\rho\_1(a,b)=(b,a)$ and there is a group $(\mathbb{Z}\_n\times \mathbb{Z}\_n)\rtimes \_{\rho}\mathbb{Z}\_2$. A natural guess is to take the $\mathbb{Z}\_2\times \mathbb{Z}\_2$ subgroup and thus write something like
$$
A\cup(n/2) B\_1\cup (n/2)B\_2
$$
but I think this is not correct, since this is actually the pull back of a class of the direct product $\mathbb{Z}\_n\times \mathbb{Z}\_n\times \mathbb{Z}\_2$.


If it would be easier it is also fine to provide the class algebraically in group-cohomology.



Explicit 3-cocycle of group cohomology of dihedral group and generalization to other semidirect products
I think I found a solution to my question for any semidirect product $G\_1\rtimes \_{\rho}G\_2$, $G\_1,G\_2$ abelian. Essentially I was looking for the class of $H^3(B G\_1\rtimes \_{\rho}G\_2,\mathbb{R}/\mathbb{Z})$ corresponding to the subgroup $H^1\_{\rho}(BG\_2,H^2(BG\_1,\mathbb{R}/\mathbb{Z}))$. A class in this group is a twisted homomorphsim $\mu: G\_1\rightarrow H^2(BG\_1,\mathbb{R}/\mathbb{Z})$, where the target can be understood as the group of alternating bicharacters on $G\_1$. Given $A\in H^1(X,G\_2)$ one can check that $\mu(A) \in H^1\_{\rho}(X,H^2(BG\_1,\mathbb{R}/\mathbb{Z}))$, and it can be used to construct a sensible cup product which gives a class $\mu(A)\cup B\cup B\in H^3(X,\mathbb{R}/\mathbb{Z})$ for any $B\in H^1\_{\rho}(X,G\_1)$


