Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given an $n \times n$ matrix whose entries are pairwise distinct, how many different matrices can you generate by:

  • exchanging columns $i$ and $n-i+1$
  • exchanging rows $i$ and $n-i+1$
  • mirroring the matrix along the main diagonal
  • mirroring the matrix along the antidiagonal
  • rotating the matrix clockwise (90°, 180°, 270°)

I'm not sure if my ideas and calculations are correct, so I'd be grateful if you could look over it and see if you can spot any blatant mistakes.

My idea was that the only three 'atomic' operations are exchanging columns/rows and mirroring across one diagonal. All the other operations can be produced by a combination of these three.

That leaves me with the two cases of $n$ being odd or even.

  • $n$ is even: you can exchange $n/2$ pairs of rows (and columns, respectively), and you can mirror along the diagonal. So the amount of different matrices is $2^{n/2} \cdot 2^{n/2} \cdot 2 = 2^{n+1}$
  • $n$ is odd: you have $(n-1)/2$ pairs of rows/columns. Makes $2^{(n-1)/2} \cdot 2^{(n-1)/2} \cdot 2 = 2^{n}$

Are the formulas correct? I checked by drawing all possible $2 \times 2$ and $3 \times 3$ matrices but I don't know how to verify for $n > 3$.

Maybe this is better suited to be proven by induction?

share|cite|improve this question
@Listing, you're right, the assumption is that the entries are pairwise distinct. Alternatively, you could consider it the maximum amount of different matrices that could be produced. – pezcode Dec 14 '11 at 21:56
Your analysis is right. The non-central columns can be ordered in $2^{\lfloor{n/2}\rfloor}$ ways, the non-central rows can be ordered in $2^{\lfloor{n/2}\rfloor}$ ways, and finally the columns and rows can be swapped for an additional factor of $2$. No additional freedom is given by the remaining operations. The result is $2^{2\lfloor{n/2}\rfloor+1}$, or $2^{n+1}$ for even $n$ and $2^{n}$ for odd $n$, as you said. By the way, if you insist that the row and column swaps occur simultaneously (and with the same $i$), then this is the symmetry group of a magic square . – mjqxxxx Dec 14 '11 at 22:02
@mjqxxxx Thanks. If you write up an answer I can accept it. – pezcode Dec 14 '11 at 22:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.