Heisenberg group over a commutative ring (source code)

= Heisenberg group over a commutative ring
{c}
{title2=$H_3(R)=UT_3(R)$}

For a <commutative ring> $R$ with an <identity element>, use coordinates
$$
A(x,y,z)=\begin{pmatrix}1&x&y\\0&1&z\\0&0&1\end{pmatrix}.
$$
These matrices form a <group> under multiplication, with
$$
A(x,y,z)A(x',y',z')=A(x+x',y+y'+xz',z+z'),\qquad A(x,y,z)^{-1}=A(-x,xz-y,-z).
$$
These formulas require no division, so they remain valid over <rings> with <zero divisors>. The <center of a group> is $\{A(0,y,0):y\in R\}$: the <commutator> has only central coordinate $xz'-x'z$, and testing $x'=0,z'=1$ and $x'=1,z'=0$ forces $x=z=0$. For finite $R$, its <group order> is $|R|^3$. This includes real, integer and modular versions of the <Heisenberg group>; the <ring> $\mathbb Z/4\mathbb Z$ must not be confused with the <finite field> of four elements.