How to determine the period of a binary matrix? As a part of my research project, I encounter a difficulty to compute the period of a binary cat matrix $C$, which is a square matrix of dimension $n$ with the following properties


*

*$|\rm{det}(C)|=1$

*$\forall i,j\in[1,n], C(i,j)=0\,or\,1$


For example,
$\left[\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\\\end{array}\right]$ is of period 1.
$\left[\begin{array}{ccc}1&0&0\\1&1&0\\0&0&1\\\end{array}\right],\left[\begin{array}{ccc}1&0&0\\0&1&0\\0&1&1\\\end{array}\right],\left[\begin{array}{ccc}1&1&1\\0&0&1\\0&1&0\\\end{array}\right]$ are of period 2.
$\left[\begin{array}{ccc}1&0&0\\0&0&1\\1&1&1\\\end{array}\right],\left[\begin{array}{ccc}0&1&1\\1&1&0\\0&0&1\\\end{array}\right],\left[\begin{array}{ccc}0&1&1\\0&1&0\\1&1&1\\\end{array}\right]$ are of period 3.
$\left[\begin{array}{ccc}1&0&1\\1&1&0\\0&0&1\\\end{array}\right],\left[\begin{array}{ccc}1&1&0\\0&0&1\\0&1&0\\\end{array}\right],\left[\begin{array}{ccc}0&0&1\\1&1&0\\1&0&0\\\end{array}\right]$ are of period 4.
$\left[\begin{array}{ccc}1&1&1\\1&1&0\\1&0&0\\\end{array}\right],\left[\begin{array}{ccc}1&1&0\\0&0&1\\1&0&0\\\end{array}\right],\left[\begin{array}{ccc}0&0&1\\0&1&1\\1&1&1\\\end{array}\right]$ are of period 7.
Here the period of a cat matrix is defined as
$$T = \arg\min_{t\in\{1,2,\cdots\}} \{ \rm{mod}(C^t,2) = \mathbb{I}\} $$
where $\mathbb{I}$ is the identity matrix of dimension $n$. 
My question is " is there any better (faster) method to compute the period of a binary Cat matrix without using the above period definition? ". My intuition says this period should somewhat relate to the structure of a cat matrix, but I donot know how. Does anyone have any thoughts?
 A: You are trying to find the order of square matrices with entries in the field $\def\F{\Bbb F_2}\F$ with $2$ elements. I think the easiest way is to first find the minimal polynomial of your matrix: the lowest degree polynomial relation $P[A]=0$ with $P\in\F[X]$ (meaning $P$ is a polynomial with coefficients in$~\F$) that is satisfied by your matrix. The order of your matrix is entirely determined by this$~P$, since $A^n=I$ is equivalent to the fact that $P$ divides the polynomial $X^n-1\in\F[X]$. For instance your first matrix $M$ of listed in the row of order$~4$ has satisfies $M^3=I+M+M^2$ so it has minimal polynomial $1+X+X^2+X^3$, and the fact that $M$ has order$~4$ is reflected by the fact that this minimal polynomial divides $X^4+1$ (in $\F[X]$).
The advantage of this approach is most evident for elements of high order. The minimal polynomial of an $n\times n$ matrix has degree at most$~n$, and once you have found it, you can replace matrix multiplications by polynomial arithmetic over$~\F$, which is a lot easier. In case $P$ should have constant term$~0$, you can give up immediately because it means your matrix is not invertible.
Having an a priori idea of the orders that might arise is also helpful. This answer explicitly gives the exponent $e$ of $\mathrm{GL}(n,\F)$, the minimal positive integer such that $A^e=I$ whenever $A$ is invertible, as
$$
  e=2^{\lceil \lg n\rceil}\operatorname{lcm}(1,3,7,\ldots,2^n-1)
  =2^{\lceil \lg n\rceil}\prod_{i=1}^n\Phi_i[2]
$$
where $\Phi_i$ designates a cyclotomic polynomial. For instance for $n=12$ this gives 
$$\begin{align}
e&=2^4\times1\times3\times7\times5\times31\times3\times127\times17\times73\times11\times2047\times13
\\&=2^4\times3^2\times5\times7\times11\times13\times17\times23\times31
   \times73\times89\times127.
\end{align}
$$
One only needs to check divisors of this numbers, so one could try removing prime factors from this product$~N$ as long as the corresponding $X^N+1$ remains divisible in$~\F[X]$ by$~P$; if not then one cannot do without, the current power of that prime factor occurs in the order of your matrix.
However, that is still a lot of possibilities to check, and one can do better. If you can factor $P$ into a product of powers of irreducible polynomials, then the Chinese remainder theorem ensures that it suffices to find the orders associated to those powers, and take their least common multiple to obtain the order associated to$~P$ (the order of your matrix). Moreover, for an irreducible factor$~f$ of degree$~d$, the order associated to the power $f^i$ is $2^{\lceil \lg i\rceil}$ times the order associated to$~f$, and the latter order divides $2^d-1$ (see the linked answer). So finding the order is essentially reduced to finding and factoring$~P$ (for which good methods are available) and finding the orders associated to its irreducible factors (here explicit testing of divisors of $2^d-1$ seems feasible, or if $n$ is not too large even tabulation seems an option).
A: The invertible $n \times n$ matrices over the binary field ${\mathbb F}_2$ form a group of order $$N = 2^{n(n-1)/2}  \prod_{i=1}^n (2^i - 1)$$
(see OEIS sequence A002884), so the order is always a divisor of that.
For each prime factor $p$ of $N$, see whether your matrix to the power $N/p$ is
still $I$.  If so, replace $N$ by $N/p$ and continue...
