# Surjective mapping of matrices under rotational and reflection symmetries

Let me preface this by saying that I'm not a mathematician and that I'm having a hard time stating my problem in the proper terms. Nevertheless, I'm faced with a problem for which I think an elegant mathematical solution might exist and I'd appreciate any help.

I'm looking for a mapping for two-dimensinal binary matrices that maps elements that are equal under rotations of ${\pi\over{2}} \times n, n \in \mathbb{Z}$ and reflections to the same unique representation.

Example for a $2 \times 2$ matrix:

$A = \begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix} 0 & 1\\ 0 & 0 \end{bmatrix}$, $C = \begin{bmatrix} 0 & 0\\ 1 & 0 \end{bmatrix}$, $D = \begin{bmatrix} 0 & 0\\ 0 & 1 \end{bmatrix}$

should all map to the same element.

$M = f(A), M = f(b), M = f(c), M = f(d)$

Ideally, I would also like to have a second mapping, such that:

$N = g(f(A)), A = g(f(B)), A = g(f(B)), A = g(f(C))$

and

$N = A$ or $N = B$ or $N = A$ or $N = A$

In words, I would like to map every element in the group of symmetries to exactly one of the elements. It doesn't matter which one, as long as they all map to the same element.

After a bit of reading I think that my problem might be related to Dihedral groups, but I'm not sure.

You can choose some total order on the set of binary matrices, e.g. lexicographical order of the entries in reading order, and let $f(X)$ be the greatest of the $8$ transformed versions of $X$ under that order.