Abelianization of the square symmetry group (source code)

= Abelianization of the square symmetry group
{title2=$D_8^{\mathrm{ab}}\cong C_2\times C_2$}

Let $D_8$ denote the <dihedral group> of <group order> eight acting on a <square>. Here the subscript specifies <group order>; the same <group> is called $D_4$ in the convention that counts <vertices of a polygon>, as in the <group action> example. Let $r$ be a counterclockwise quarter-turn <rotation> and $s$ a <reflection> in a diagonal. Then
$$
D_8=\{e,r,r^2,r^3,s,rs,r^2s,r^3s\},\qquad r^4=s^2=e,\quad srs=r^{-1}.
$$
Products act rightmost first. The <group commutator> of the <generators of a group> is
$$
[r,s]=r^{-1}s^{-1}rs=r^{-1}(srs)=r^{-2}=r^2.
$$
It is a half-turn <rotation>, so forcing $r$ and $s$ to commute must identify a half-turn with $e$.

\Image[/square-group-abelianization.png]
{title=The eight <square> symmetries become four elements under <abelianization>}
{description=Each column is a <coset> of the <commutator subgroup> $N=\{e,r^2\}$ in the <dihedral group> of <group order> eight. Vertex labels show where each original vertex goes. The map $r^is^j\mapsto(i\bmod2,j)$ retains quarter-turn <integer parity> and the presence of a <reflection>. The table adds the two bits separately modulo two, giving the <Klein four-group> $C_2\times C_2$.}

More concretely, write each element uniquely as $r^is^j$, with $0\leq i<4$ and $j\in\{0,1\}$. The <function>
$$
\phi:D_8\longrightarrow C_2\times C_2,\qquad \phi(r^is^j)=(i\bmod2,j)
$$
is a <surjective group homomorphism>. Indeed, $srs=r^{-1}$ gives
$$
(r^is^j)(r^ks^\ell)=r^{i+(-1)^jk}s^{j+\ell},
$$
where the exponents are reduced modulo four and two. Modulo two, $-k$ and $k$ agree, so $\phi$ adds the two coordinates separately. Its <group kernel> is $N=\{e,r^2\}$. Since the target is an <abelian group>, $D_8'\subseteq N$; since $[r,s]=r^2$, also $N\subseteq D_8'$. Thus
$$
D_8'=\{e,r^2\},\qquad D_8^{\mathrm{ab}}\cong C_2\times C_2.
$$
The four <cosets> are $\{e,r^2\}$, $\{r,r^3\}$, $\{s,r^2s\}$, and $\{rs,r^3s\}$. Each <coset> forgets the difference of a half-turn. The <quotient group> still distinguishes <rotations> from <reflections>, and even from odd numbers of quarter-turns; the two surviving choices are independent. This is the <Klein four-group>, rather than the <cyclic group> $C_4$, because each nonidentity element squares to the <identity element>. For the general <dihedral group> calculation, see https://kconrad.math.uconn.edu/blurbs/grouptheory/dihedral.pdf[Conrad, Dihedral groups I, theorem A.1]; that source uses the vertex-count convention and $xyx^{-1}y^{-1}$ for individual <group commutators>.