I want to know, for any $n$, how many $n \times n$ permutation matrices are their own transpose/inverse. For example, for n=3, the matrix below is it's own inverse; when multiplied by itself, you get the identity. \begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0\\ 0 & 0 & 1 \end{bmatrix} This could also be described as being symetrical over the diagonal. For $n=3$, 4 out of the 6 possible matrices have this property. For $n=4$, 10 out of the 24 have it, if I'm not mistaken. For $n=4$, the matrices that work can be put into three 'categories':
- The identity matrix
- Matrices that switch two elements from the identity, like the below, in which the first and second rows are switched: \begin{bmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1 \end{bmatrix} (There are 4 choose 2 of these, choosing the two to switch.)
- Matrices that switch two pairs of two elements from the identity, like the below, which switches rows 1+3 and 2+4: \begin{bmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0 \end{bmatrix} (There are $2 \choose 4$$/2$) ways of doing this; similar to the above, dividing by 2 for double counting.)
$1+6+3=10$ possible $4 \times 4$ matrices. Anyway, it'd be great to know if there's a good way to find this number for any given value of n. For any number after 4, there are a lot more possibilities to consider.