<s>[INST] non-abelian group of order 27 If $K$ is a field and  $A= \begin{pmatrix} a & 0 &0 \\ 0 & b &0 \\ 0& 0& c \end{pmatrix}$ , $B=\begin{pmatrix} 0 & p &0 \\ 0 & 0 &q \\ r& 0& 0 \end{pmatrix}$ , $C=\begin{pmatrix} 0 & 0 &x \\ y & 0 &0 \\ 0& z& 0 \end{pmatrix}$ , 
where $a,b,c,p,q,r,x,y,z\in K$ are such that $S:=\{a,b,c,p,q,r,x,y,z\}$ is closed under multiplication , then I can show that $A^2,B^2,C^2,AB,BA,BC,CB,AC,CA \in \Bigg\{\ \begin{pmatrix} a'  & 0 &0 \\ 0 & b' &0 \\ 0& 0& c' \end{pmatrix}, \begin{pmatrix} 0 & p' &0 \\ 0 & 0 &q' \\ r'& 0& 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 &x' \\ y' & 0 &0 \\ 0& z'& 0 \end{pmatrix} : a',b',c',p',q',r',x',y',z' \in S \Bigg\}$ 
My question is:  Can we use this fact to construct a non-abelian group of order $27$ ?
The only way I know of constructing a non-abelian group of order $p^3$ for odd prime $p$ is using upper triangular $3\times3$ matrices or special kind of $2\times 2$ matrices with entries in $\mathbb Z/(p)$ or $\mathbb Z/(p^2)$, as given here http://www.math.uconn.edu/~kconrad/blurbs/grouptheory/groupsp3.pdf .
Please help.
Thanks in advance 
 [/INST] Yes, provided that $K$ contains a primitive cube root $\omega$ of $1$. The two nonabelian groups of order $27$ both have irreducible representations of degree $3$ that are induced from $1$-dimensional representations of elementary abelian subgroups of order $9$.
The nonabelian group of exponent $3$ $is$
$$\left\langle\,\left(\begin{array}{ccc}1&0&0 \\ 0&\omega&0 \\  0&0&\omega^2 \end{array}\right),\,
 \left(\begin{array}{ccc}0&0&1\\1&0&0\\0&1&0\end{array}\right)
\,\right\rangle$$
and the one of exponent $9$ is
$$\left\langle\,\left(\begin{array}{ccc}1&0&0 \\ 0&\omega&0 \\  0&0&\omega^2 \end{array}\right),\,
 \left(\begin{array}{ccc}0&0&\omega\\1&0&0\\0&1&0\end{array}\right)
\,\right\rangle.$$
To see that the first group has order $27$, call the two generators $a$ and $b$. Then $b$ is a permutation matrix, and $b^{-1}ab = \left(\begin{array}{ccc}\omega&0&0\\0&\omega^2&0\\0&0&1\end{array}\right)$, so $b^{-1}aba^{-1}$ is the scalar matrix $\omega I_3$, which commutes with $a$ and $b$.
So, putting $c=b^{-1}aba^{-1}$,  $a$, $b$ and $c$ satisfy the relations of the presentation $$\langle a,b,c \mid a^3=b^3=c^3=1, c=b^{-1}aba^{-1}, [a,c]=[b,c]=1\rangle,$$
which define a group of order $27$. It's not hard to see that the group generated by $a$ and $b$ has order greater than $9$, so it must have order $27$.
You can prove that the second group has order $27$ with a similar argument.
</s>