# Number of orthogonal matrices with same absolute value of elements

A simple group-theoretic argument shows that there are always many orthogonal matrices that have the same absolute value, when the absolute value of a matrix $O = (o_{ij})$ is defined by

$\DeclareMathOperator{\Abs}{Abs}$ $$\Abs(O) = \pmatrix{|o_{11}| & \cdots & |o_{1n}|\\ \vdots & \ddots & \vdots\\ |o_{n1}| & \cdots & |o_{nn}|}.$$

Namely, let $O$ be some orthogonal matrix of order $n\geq 1$ and let $D_1$ and $D_2$ be diagonal matrices such that each of their $n$ diagonal elements is restricted to be either $1$ or $-1$. They are clearly orthogonal. Then $\Abs(O)=\Abs(D_1 O D_2)$ and the matrix product $D_1 O D_2$ is orthogonal since orthogonal matrices of the same order form a group over matrix multiplication.

Now that we know that for any orthogonal matrix $O$, other matrices with the same absolute value exist, we can ask how many there are in total. To make things a bit easier, we might want to assume that $O$ has no $0$ elements.

To begin with, notice that while there are $2^{2n}$ combinations of different matrices $D_1$ and $D_2$, not all of them give a distinct result: one flips the signs of rows and the other those of columns, and since two flips cancel out, there is some redundancy in running over all combinations. In fact, some experimenting suggests that there are $2^{2n-1}$ distinct results. Second, exhaustive search over small orthogonal matrices shows that in general, products of the type $D_1 O D_2$ does not cover all possible cases - the total number seems to be some higher power of $2$.

An answer as a function of $n$ would be ideal. The answer could perhaps also shed some light to a related old question of mine.

The answer is just $2^{2n-1}$. The redundancy is because $D_1OD_2$ is equal to $(-D_1)O(-D_2)$. Assume $O$ has no zero elements and the absolute value of no two elements are equal. Also assume that only the signs of elements $O$ can be changed. The orthogonality of the column vectors of $O$ is maintained iif the column vectors are scaled by $\pm1$ which is what $OD_2$ does. The orthogonality of the row vectors of $OD_2$ is maintained iif the row vectors are scaled by $\pm1$ which is what $D_1(OD_2)$ does.
I used MATLAB to test all $2^{n^2}$ combinations of the signs of the elements of $O$ for $n = 2\ldots5$. In all cases, exactly $2^{2n-1}$ unique combinations satisfied the requirements of the question. All valid combinations could be factored as $D_1OD_2$.