A matrix representation of the primitive residue classes (mod $2n$)