Next Article in Journal
Analytic Continuation of the Hurwitz Transform
Previous Article in Journal
Integrating Contextual Causal Deep Networks and LLM-Guided Policies for Sequential Decision-Making
Previous Article in Special Issue
A Spectral Approach to Solve High-Order Ordinary Differential Equations: Improved Operational Matrices for Exponential Jacobi Functions
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

On Invertibility of Large Binary Matrices

ZJU-UIUC Institute, Haining 314400, China
*
Author to whom correspondence should be addressed.
Mathematics 2026, 14(2), 270; https://doi.org/10.3390/math14020270
Submission received: 12 November 2025 / Revised: 6 January 2026 / Accepted: 9 January 2026 / Published: 10 January 2026
(This article belongs to the Special Issue Computational Methods for Numerical Linear Algebra)

Abstract

Many data processing applications involve binary matrices for storing digital information. At present, there are limited results in the literature about algorithms for inverting large binary matrices. This paper contributes the following three results. First, the divide-and-conquer methods for efficiently inverting large matrices over finite fields such as Strassen’s matrix inversion often fail on singular sub-blocks, even if the original matrix is non-singular. It is proposed to combine Strassen’s method with the PLU factorization at each recursive step in order to obtain robust pivoting, which correctly inverts all non-singular matrices over any finite field. The resulting algorithm is shown to maintain the sub-cubic time complexity. Second, although there are theoretical studies on how to systematically enumerate all invertible matrices over finite fields without redundancy, no practical algorithm has been reported in the literature that is easy to understand and also suitable for enumerating large matrices. The use of Bruhat decomposition has been proposed to enumerate all invertible matrices. It leverages the linear group-theoretic structure and defines an ordered sequence of invertible matrices, so that each matrix is generated exactly once. Third, large binary matrices have about 29% probability to be invertible. In some applications, it may be desirable to repair the singular matrices by performing a small number of bit-flips. It is shown that the minimum number of bit-flips is equal to the matrix rank deficiency, i.e., the minimum Hamming distance from the general linear group. The required bit-flips are identified by pivoting during the matrix inversion, so the matrix rank can be restored. The correctness and the time complexity of the proposed algorithms were verified both theoretically and empirically. The reference implementation of these algorithms in C++ is available on Github.

1. Introduction

In the era of big data, it is often necessary to consider algorithms involving operations with large matrices defined over finite fields. These matrices appear in many applications including cryptography [1] and topological data analysis [2]. Linear algebra over finite fields [3] involves matrix multiplication [4] and matrix inversion [2]. Matrix inversion by direct Gauss–Jordan elimination (GJE) is not harder than matrix multiplication, which has cubic time complexity [5]. A common strategy for efficiently inverting the matrices over finite fields is to exploit Krylov subspaces [3], and other matrix structures, including sparsity [2,6]. Sub-cubic matrix inversion can be also achieved by adopting various matrix decompositions, such as Cholesky, QR, and LU factorizations [1,2]. The factorization can be made more stable by first permuting the original matrix [7]. The invertibility of sub-matrices in non-singular matrices is investigated in [1,3,5].
The Schur complement is usually considered as a basis for blockwise recursive methods when inverting large matrices [8]. In recursive methods, the base case matrices of smaller size are more efficiently inverted using direct Gauss–Jordan elimination (GJE) [9]. The caveat is that sub-matrices created during the recursion must themselves be invertible. Unfortunately, for the matrices defined over finite fields, this cannot be guaranteed. This is also the key reason why the recursive methods for these matrices fails in practice. In [1], the authors propose to circumvent this problem by representing the matrix inversion as a recursive tree, such that every node of the tree represents the matrix split into four equal-size sub-matrices. Then, starting at the bottom of the tree, the invertible sub-matrices are inverted towards the root, which becomes the inverse of the given matrix. Even though at least one path reaching the root is guaranteed to always exist for all non-singular matrices, the number of these paths, and thus the amount of redundant computations, can be large. On the other hand, the singular sub-matrices can be either randomized or permuted deterministically, as proposed in this paper. Moreover, rather than optimizing the number of computations, the matrix inversion algorithms are usually designed to run in parallel on distributed computing systems [1,6,10].
The matrix inversion is closely related to matrix multiplication [2,3,5]. The 1969 paper by Strassen [11] showed that matrix multiplication can be performed with a sub-cubic complexity. More recent algorithms such as the method of Four Russians, Strassen–Winograd multiplication, and several bit-level parallelization strategies for multiplying the dense binary matrices are compared in [12]. Efficient multiplications of matrices defined over finite fields have been considered, for example, in [1,4,7,11,13]. However, only a few numerical software packages offer algebraic functions over finite fields. For example, Matlab, since version R2006a, allows defining and working with matrices over general Galois fields, GF ( 2 q ) , [14].
Some applications require efficiently enumerating all invertible matrices, which is only possible over finite fields. The invertible matrices of size ( n × n ) over a general finite field, F q , form the general linear group GL ( n , q ) [15]. The basic strategy is to define partial [16] or total ordering of the group elements [17]. In particular, the latter reference orders invertible matrices using a Grey encoding, so the subsequent matrices can be related by the row operations. The underlying group structure can be then studied using Cayley graphs [17]. However, these results are mainly theoretical. There seems to be no practical algorithms for systematically and efficiently enumerating large matrices over finite fields, which would also be easy to understand and validate.
Furthermore, the probability of a large binary matrix being invertible is about 29 % . This can be too restrictive if the matrix represents random measurements and the data processing algorithm requires solving an exact set of linear equations [3]. One solution is to repair the singular matrix defined over a finite field by finding the nearest matrix that is invertible. Such a problem is closely related to the matrix perturbation theory [18] and matrix rank updates [19,20]. There are efficient algorithms for computing the rank of finite-field matrices, for example, [2,3]. The bounds on the rank of random binary matrices and their construction can be found in [4].
The goal of this paper is to devise practical algorithms that can be used to solve large-scale linear systems over binary fields. The algorithms utilize known theoretical results from linear algebra. The first algorithm performs robust and fast inversion of binary matrices. It is a top-down divide-and-conquer method, which exploits the PLU factorization [9] at each recursive step. This guarantees that a chosen matrix sub-block is always invertible, so the bottom-up tree search and the redundant computations performed in [1] are avoided. The idea is to deterministically swap the dependent row with a row from the bottom block that has a pivot, provided that the top sub-block is detected as being singular. The algorithm is shown to always correctly invert all non-singular binary matrices while it maintains the sub-cubic complexity of Strassen’s method. The second algorithm efficiently enumerates all invertible binary matrices. The matrices are generated one at a time, and every unique invertible matrix is generated exactly once. The method exploits the Bruhat decomposition [21]. The third algorithm is used to repair large binary singular matrices, so they become non-singular by performing the minimum number of bit-flips. It is shown that the minimum number of required bit-flips is equal to the matrix rank-deficiency, and the bit-flips are identified by pivoting during matrix inversion.
The developed algorithms can be used for matrices defined over other finite fields. The reference implementation of the proposed algorithms in C++ is available from the Github repository [22]. The correctness and the time complexity of all the algorithms were validated both theoretically and empirically.
The rest of this paper is organized as follows. The sequel of this section summarizes the terminology and known key results from linear algebra, which are important in understanding the paper. The subsequent three sections first summarize the relevant theoretical results, which is then followed by the algorithm outline and the implementation details. In particular, Section 2 introduces a robust blockwise matrix inversion algorithm based on the PLU factorization. The algorithm for efficiently enumerating general linear groups is presented in Section 3. This algorithm is based on the Bruhat decomposition. An algorithm for repairing singular binary matrices to make them invertible by performing the minimum number of bit-flips is proposed in Section 4. The paper is concluded in Section 5. The examples illustrating the proposed algorithms are provided in Appendix A and Appendix B. It should also be noted that the proofs of lemmas and theorems are sketches, and they may not be fully rigorous from a strict mathematical point of view.

Preliminaries and Notations

Matrices are denoted by bold capital letters. The symbol A ( i , j ) represents the i-th row and j-th column element of the matrix, A . For binary matrices, a bit-flip at position ( i , j ) is defined as A ( i , j ) : = 1 A ( i , j ) .
The ( n × n ) permutation matrix P is created from the ( n × n ) identity matrix I n by permuting its rows and/or columns. There are n ! (n factorial) unique instances of such permutation matrices. The permutation matrices are orthogonal, i.e., P P T = P T P = I .
An ( n × n ) unit lower-triangular binary matrix, L , has all diagonal entries equal to 1, while all the entries above the main diagonal are 0. Similarly, an ( n × n ) upper-triangular binary matrix, U , has all diagonal entries equal to 1, and all the entries below the main diagonal are 0.
More generally, the invertible matrices can be considered over infinite fields of all integers, Z ; rational numbers, Q ; as well as real numbers, R , respectively. Here, our focus is on invertible matrices defined over finite fields, such as Z p , representing modulo p additions and multiplications, with p being a prime, and possibly extended Galois fields, GF ( p n ) . Note that GF ( p ) Z p (isomorphism). The modular arithmetic requires that modulo operation is always performed on the last outcome of all preceding arithmetic operations [13] (Sec. 31.3). For example, assuming integers a and, b, addition and multiplication in Z p , respectively, are defined as
( a ± b ) mod p = ( ( a mod p ) ± ( b mod p ) ) mod p ( a b ) mod p = ( ( a mod p ) ( b mod p ) ) mod p .
The finite (Galois) fields are constructed over non-negative integers and contain p n elements, where p is a prime. For example, the Galois field GF ( 2 ) Z 2 is a ring, { 0 , 1 } , with addition and multiplication. Over GF ( 2 ) , addition can be replaced with logical exclusive-or (XOR), and multiplication can be replaced with logical AND. Moreover, over GF ( 2 ) , addition is equivalent to subtraction, and division by the only non-zero element, which is the multiplicative unity, can be ignored.
The rank of an ( n × n ) matrix, A , is the maximum number of linearly independent rows (or, equivalently, columns). The matrix has a full rank if rank A = n . The square matrix is invertible, i.e., its inverse, A 1 , exists if and only if, it has a full rank; otherwise, it is said to be singular. The singular matrix has the rank deficiency d = n rank A . The rank deficiency represents how many linearly independent rows or columns are missing to have a full span of the n-dimensional vector space over a given field.
The matrix inverse can be defined over any finite or infinite field, and even over a ring [23] (Theorem 4, p. 160). If the inverse matrix exists, i.e., the matrix determinant is non-zero, then its inverse is unique. A general linear group GL ( n , q ) is the set of all invertible ( n × n ) matrices defined over a finite field, F q , that is closed under matrix multiplication. The unit element of the group is the identity matrix, I n . The group has order (i.e., the cardinality)
| GL ( n , q ) | = k = 0 n 1 ( q n q k ) .
The matrix determinant to check whether the matrix is invertible is computed as [23]
det ( A ) = σ S n sign ( σ ) a 1 , σ ( 1 ) a n , σ ( n )
where S n is a symmetric group of all permutations of n integers. The multiplications and summations in (3) are defined by the underlying field operations [13].
The ( n × n ) matrix, where n is even, can be partitioned into four equal-sized sub-matrices (sub-blocks) as
A = A 11 A 12 A 21 A 22 .
Provided that A 11 is invertible (which is not guaranteed for matrices defined over finite fields, even if A is invertible), its Schur complement is defined as S = A 22 A 21 A 11 1 A 12 .

2. Accelerated Inversion of Binary Matrices

The objective is to devise a fast algorithm for the robust inversion of large binary matrices. The proposed algorithm relies on the following crucial techniques. The pivoted PLU factorization enables the proper factorization of any invertible matrix. Importantly, it avoids the fundamental limitation of simpler blockwise inversion methods that often fails at singular sub-matrices for matrices defined over finite fields. The recursive blockwise inversion can be further optimized for speed by considering sub-cubic Strassen’s algorithm for matrix multiplication in order to improve the asymptotic time complexity. However, for smaller matrices, the recursion overhead exceeds the complexity of the direct GJE.
The GJE assumes the augmented matrix, [ A | I ] , and performs the row operations until it arrives at the matrix, [ I | A 1 ] . In GF ( 2 ) , this only involves swapping and XOR-ing the rows. If the matrix is found to be singular, i.e., there is no pivot for a given matrix column, the algorithm must report a failure. The cubic time complexity of the GJE is acceptable for smaller matrices.
For larger matrices, other algorithmic strategies, such as divide-and-conquer and dynamic programming, are required. These strategies provide much better control over the time complexity as the problem size increases. In this paper, we first consider a standard blockwise recursive inversion involving the Schur complement to show that it is fundamentally flawed when considering matrices over finite fields. This will motivate a much more robust block-recursive inversion method that is based on the PLU factorization. Note also that, in this paper, the presentation assumes binary matrices; generalizing the presented methods to other finite fields should be straightforward by modifying the underlying arithmetic operations.
The standard blockwise inversion of matrices assumes the Schur complement to reduce the ( n × n ) problem into the four sub-problems, each of size ( n / 2 ) × ( n / 2 ) . In particular, assuming that both A 11 and its Schur complement S are non-singular, the inverse A 1 is computed recursively using its Schur complement. The Schur complement requires two matrix multiplications, and its inverse, S 1 , is again computed recursively. The inverse matrix is then constructed as
A 1 = B 11 B 12 B 21 B 22
where
B 22 = S 1 , B 12 = A 11 1 A 12 S 1 , B 21 = S 1 A 21 A 11 1 ,   and ,   B 11 = A 11 1 + B 12 A 21 A 11 1 .
Thus, computing the matrices in (6) requires at most six matrix multiplications.
Furthermore, in order to improve the asymptotic time complexity of the standard matrix blockwise inversion, the six required matrix multiplications can be efficiently performed using Strassen’s technique, which has a sub-cubic time complexity. Subsequently, only seven rather than eight matrix multiplications are required in computing each sub-problem in the divide-and-conquer matrix inversion method described above; the asymptotic time complexity is then reduced from O n 3 to O n log 2 7 . However, and importantly, for GF ( 2 ) and other finite fields, the sub-matrices A 11 and S frequently become singular, which terminates the algorithm, even though the original matrix, A , is non-singular. The solution is to combine the Schur complement with the PLU factorization in performing the blockwise matrix inversion, as will be described next. We also prove the correctness of this approach and analyze its time complexity.

2.1. Blockwise Inversion with PLU Factorization

The PLU factorization can be used to achieve a fast matrix inversion, as originally proposed in [24]. Specifically, the PLU factorization theorem asserts that, for any non-singular matrix, A , there exists a permutation matrix P , such that P A = L U , where L and U are the unit lower-triangular and upper-triangular matrices, respectively, representing the LU factorization [9]. The key idea is to first recursively compute the PLU factorization of the matrix, A , to facilitate its fast inversion, since inverting a triangular matrix amounts to solving a set of linear equations being already in the reduced row echelon form [9].
In particular, the first step is to recursively compute the PLU factorization of the sub-matrix, A 11 . Thus, provided that, P 1 A 11 = L 1 U 1 , then the inverse, A 1 , is straightforward to obtain. The Schur complement can be inverted similarly using its PLU factorization, P 2 S = L 2 U 2 . The inverse matrix, A 1 , is then obtained using the structure (5) and (6). Most importantly, the PLU factorization is guaranteed to always yield the correct result for all non-singular binary matrices, A .
The matrix bisection that is performed repeatedly at each recursive step of the blockwise matrix inversion and Strassen’s multiplication implicitly assume that the original matrix A has the size n = 2 i for some integer i 1 . Even though the power-of-two size cannot be guaranteed, the original matrix can always be padded with zeros to such a size, i.e.,
A ˜ = A 0 0 I p n
where p = 2 log 2 n and · denotes the ceiling function. The inverse of the ( p × p ) matrix, A ˜ , can be then written as
A ˜ 1 = A 1 0 0 I p n .
Once the complete factorization, P A = L U , is obtained, the matrix inverse is computed as
A 1 = U 1 L 1 P = ( L U ) 1 P .

2.2. Complexity and Correctness of Matrix Inversion via PLU Factorization

Lemma 1 
(Correctness of the PLU-based matrix inversion). The non-singular matrices over finite Galois fields can be correctly inverted using the PLU factorization at each step of the blockwise matrix decomposition. Moreover, the singular matrices are always correctly detected, and the algorithm terminates.
Proof Outline. 
The GJE, which is adopted for inverting the base cases, is guaranteed to find the inverse or to correctly detect that the sub-matrix is singular. The PLU factorization theorem guarantees that any non-singular matrix, A , can be factored as P A = L U [9]. Hence, and importantly, the sub-matrices P 1 A 11 = L 1 U 1 and the Schur complements P 2 S = L 2 U 2 at each step of the blockwise recursion are always invertible by the PLU factorization theorem. The PLU factorization P A = L U can always be correctly obtained by properly combining the sub-matrices { P i , L i , U i } i = 1 , 2 . The unit triangular matrices are always invertible [9]. Consequently, the non-singular matrix, A , can be inverted as A 1 = U 1 L 1 P . Moreover, the singular matrix is always detected when inverting the base case sub-matrices as the GJE fails to find all pivots.    □
It should be noted that Lemma 1, and its proof are independent of the specific field. Thus, Lemma 1 is valid for the matrices defined over all finite fields, and even infinite fields including, for example, the field of real numbers.
Theorem 1  
(Complexity of blockwise matrix inversion with PLU factorization). The blockwise recursive inversion of ( n × n ) matrices with the PLU factorization and Strassen’s matrix multiplication has the complexity O n log 2 7 .
Proof. 
Let I ( n ) be the time to invert an ( n × n ) matrix, and M ( n ) be the time to multiply two ( n × n ) matrices. The complexity is dominated by the operations performed at the first blockwise decomposition, i.e., by the PLU factorization and the inversion of the ( n / 2 ) × ( n / 2 ) sub-matrix, A 11 , and its Schur complement, S . The seven required multiplications of sub-matrices has the complexity O n 2 . Consequently, the overall complexity is dominated by the two recursive calls, and the matrix multiplications, i.e.,
I ( n ) = 2 I ( n / 2 ) + c · M ( n / 2 ) + O ( n 2 )
where c 6 is the total number of required sub-matrix multiplications. Strassen’s algorithm for matrix multiplication has the complexity M ( n ) = O n log 2 7 . The recursion (10) can be solved by the Master Theorem [13], which yields the total complexity I ( n ) = O n log 2 7 . Moreover, since the base cases are assumed to be sufficiently small, they do not affect the overall asymptotic complexity.    □
The following theorem considers the invertibility of a given ( n × n ) matrix over different fields, Z 2 Z p Z Q R , where p is a prime. (Note that these are, generally, subsets, and not sub-fields.)
Theorem 2  
(Invertability of a matrix over different fields). If the matrix, A , defined over a field, Z p 1 , is invertible, then there exist infinitely many primes, p p 1 , such that A is also invertible over the fields Z p .
Proof. 
It suffices to examine the determinant of A with respect to modular arithmetic (1). In particular, the determinant of A over Z p 1 is computed as det A = D mod p 1 , where D is the value of the sum in (3). Consequently, the matrix A is non-singular over all fields Z p , for which, D mod p 0 , for example, all primes, p > D .    □
Corollary 1.
The matrix A , which is invertible over a finite field Z p , is also invertible over the fields Z and, R .

2.3. Implementation

The blockwise matrix inversion with the PLU factorization and Strassen’s matrix multiplication is outlined as Algorithm 1 on the next page. It was implemented in C++ language [22]. The implementation adopts several optimizations in order to improve the actual runtime. In particular, the low-level C++ data structure, std::bitset<N>, is used to store the rows of binary matrices. This encourages the compiled code to exploit single-instruction, multiple-data (SIMD) CPU instructions, which provides the bit-level parallelism involving the bit arrays. In turn, this offers a substantial speed-up of adding and multiplying the rows of binary matrices on a single-core CPU. On the other hand, std::bitset<N> must be statically allocated at the compile time, so its size is fixed. For dynamic allocation of binary matrices at runtime, the alternative data structures std::vector<bool> and boost::dynamic\_bitset can be considered.
The size of sub-matrices that are treated as base cases and for which the GJE instead of the blockwise recursion is used is a hyper-parameter which can be optimized to achieve a faster inversion by providing better data locality and avoiding the overhead of recursive function calls.
The matrix to be inverted is instantiated at a compile time using the C++ template, template<size_t N>. It provides the type safety and also reduces the runtime overhead. In addition, the singular matrices, for which the GJE fails to find a pivot when inverting one of the base case sub-matrices, are detected using the function signature with the std::optional parameter. This has the benefit that it avoids the complexities of exception handling.
The empirical measurements of the runtime and memory usage for inverting the binary matrices of size 2 n , n 11 , are shown in Figure 1 and Figure 2, respectively. Both metrics appear to have asymptotically linear growths on the log-log scale plots, suggesting asymptotic complexity, O 2 n log 2 . Furthermore, the empirical runtimes of the proposed blockwise matrix inversion method are compared with the runtimes of the inversion performed using the standard GJE in Figure 3. It can be observed that the proposed method achieves a clear speedup for sufficiently large matrices, and the speedup grows further with the size of the matrix to be inverted. In particular, utilizing Strassen multiplications of sub-blocks reduces the time complexity from O n 3 to O n 2.81 . It is not as good as the state-of-the art method reported in [2] with O n 2.21 , but it is still better than the method of Four Russians, which has the time complexity, O n 3 / log n . Moreover, the peak memory usage is under 7 MB when processing the matrices of a size as large as N = 1400 . Such a memory efficiency can be attributed to the use of the std::vector<bool> data structure for storing the binary matrices.
Algorithm 1: Robust blockwise inversion of a large binary matrix
  • Input: matrix A F 2 n × n
  • Output: inverse matrix A 1 , or ⊥ if A is singular
  • Parameters: base case cutoff N 0
1:
function  BinaryInvert( A , N 0 )
2:
     n rows ( A )
3:
    if  n N 0  then
4:
        return GaussJordanInverse(A)    // Base cases
5:
    end if
6:
    Step 1: Search for pivots
7:
    Find index ( r , c ) :   A r , c = 1
8:
    if no such index exists then return ⊥    // Matrix is singular
9:
    end if
10:
  Step 2: Permute to move pivot to ( 0 , 0 )
11:
    A P A Q    // P , Q are permutation matrices to swap row 0 r , and col 0 c
12:
   Partition  A    // rank-1 decomposition
A = 1 b T c D
13:
   Step 3: Schur complement & recursion
14:
     T StrassenMul ( c , b T )
15:
     S D + T    // Addition in F 2 is XOR
16:
     S 1 BinaryInvert ( S , N 0 )    // Recursive call
17:
    if [ then0.5] S 1   =    return ⊥
18:
    end if[0.5]
19:
    Step 4: Reconstruct A 1
20:
        t StrassenMul ( S 1 , c )
21:
        u StrassenMul ( b T , S 1 )
22:
        v StrassenMul ( b T , t )
23:
        α 1 + v 0 , 0
24:
       Construct
A 1 = α u T t S 1
25:
    Step 5: Revert permutation
26:
        A 1 Q A 1 P
27:
       return  A 1
28:
end function
29:
  Input : matrices X , Y
30:
Output: product C = X Y
31:
function StrassenMul( X , Y )    // Strassen matrix multiplication
32:
     n rows ( X )
33:
    if  n N 0  or n is odd then
34:
        return Mul( X , Y )    // standard O n 3 multiplication
35:
    end if
36:
    Partition  X , Y    // ( n / 2 × n / 2 ) sub-blocks
X = X 11 X 12 X 21 X 22 , Y = Y 11 Y 12 Y 21 Y 22
37:
    Compute 7 products
38:
        M 1 StrassenMul ( X 11 + X 22 , Y 11 + Y 22 )
39:
          ...    // similarly for M 2 through M 7
40:
       combine M i to form C 11 , C 12 , C 21 , C 22 , and then form C
41:
    return C
42:
end function
Note also that the results shown in Figure 3 suggest that the GJE is as effective as the blockwise recursion for the binary matrices of dimensions up to about n = 100 due to the overhead of the recursive calls. Hence, the base case sub-matrices can be considered to be relatively large.
Even though the reference implementation in C++ considers specifically the matrices over GF ( 2 ) , the blockwise recursive inversion with the PLU factorization can be readily modified to other fields. Note also that only the computations over finite fields are exact, whereas the algorithms involving the floating point arithmetic operations suffer from the numerical instabilities and numerically ill-conditioned problems. For example, the pivoting used in the GJE must be made more robust for inverting the real-valued matrices. Moreover, the bit-level parallelization can be much more easily exploited for the finite fields than for the real numbers, which has a noticeable impact on the practical runtime and the memory usage of the implemented algorithms.
The matrix multiplications in Strassen’s algorithm can be parallelized to support inverting very large matrices on multi-core computing platforms. For such matrices, the data structures could be further optimized to improve the data locality and to exploit the fast memory-caching mechanisms. Moreover, there can be multiple implementations that are optimized for different matrix sizes, 2 n . Similar considerations can be assumed for the high-throughput inversions of large matrices that are performed in hardware, for example, using the FPGAs.

3. Enumerating GL(n,2) Groups

The objective now is to exhaustively enumerate the unique elements of the linear group GL ( n , 2 ) . A naive approach may again exploit the PLU factorization assumed in the previous section. The caveat is how to avoid a considerable redundancy by removing the generated matrix duplications. Ideally, every unique invertible matrix of a given size is generated exactly once. The proposed solution is to consider the Bruhat decomposition theorem to define a unique factorization of every invertible matrix [21]. The key idea is that every invertible matrix can be reduced to exactly one permutation pattern of pivots using the GJE. The theorem can be specifically restated for general linear groups as follows.
Theorem 3  
(Bruhat decomposition of general linear groups). The general linear group, GL ( n , q ) , is a disjoint union of double cosets of the subgroup of upper triangular invertible matrices, B , i.e.,
GL ( n , q ) = P S n B P B
where S n is the symmetric group of ( n ! ) permutation matrices anddenotes the disjoint union.
Theorem 3 allows for partitioning the group GL ( n , 2 ) into the disjoint subgroups called Bruhat cells, which are indexed by the permutation matrices. More importantly, every invertible matrix, A , has a unique factorization, A = L P U , where P is a permutation matrix, and L and U are the lower and the upper triangular matrices, respectively, having non-zero elements that are strictly constrained by the structure of P . The uniqueness of this decomposition enables the effective non-redundant enumeration of all invertible matrices of a given size.
In particular, the matrix, L , is defined by the so-called inversions of the permutation, π , of a given permutation matrix, P . The inversion is an index pair, ( i , j ) , such that, i < j , whereas π ( i ) > π ( j ) . The matrix L is only allowed to have the non-zero entries at positions ( i , j ) . The number of inversions of permutation π is denoted as ( π ) = inv ( π ) . Thus, there are ( π ) elements of matrix L that can be freely selected from a given field, whereas other elements must be zero.
There are ( n ! ) disjoint cells corresponding to one permutation matrix, P . The order of each cell is a function of the number of inversions in P . For the field of cardinality, q, the cell is a triangular matrix group having the order
| C P | = ( q 1 ) n q ( π ) = q = 2 2 n ( n 1 )
where ( π ) is the cell order. The cell order is a product of the number of unconstrained upper-triangular matrices, U , and the number of constrained lower-triangular matrix, L .
The enumeration algorithm proceeds by systematically enumerating all permutations, π , which define the unique permutation matrices, P . For P , all invertible matrices in the cell, C P , are generated. Assuming that the two matrix multiplications to construct a matrix, A , have the complexity O n 3 and noting that the double co-sets are disjoint and cover the whole GL group, which has the order given by (2), the overall complexity of the complete enumeration is
O n 3 P S n | C P | = O n 3 | GL ( n , 2 ) | = O n 3 k = 0 n 1 ( 2 n 2 k ) = O n 3 2 n 2 .
For comparison, the naive enumeration of the GL ( 2 , n ) group using the PLU factorization generates all combinations of the products between n ! permutation matrices, and 2 n ( n 1 ) lower and upper triangular matrices, respectively. The corresponding overall complexity is dominated by the number of these products, each having O n 3 complexity. In addition, each resulting matrix must be checked for whether it has already been generated previously, which has complexity O n 2 . Thus, the total complexity of the naive enumeration via the PLU factorization is O n ! 2 n ( n 1 ) / 2 n 3 = O n ! n 3 2 n 2 . Consequently, even though the complexity of the Bruhat-based enumeration is still exponential, it avoids the factorial scaling of the PLU based enumeration, and at the same time, it is guaranteed to systematically produce a sequence of unique invertible matrices.

Implementation

The proposed algorithm for enumerating all invertible binary matrices is outlined as Algorithm 2 on the next page. The reference C++ implementation again stores the rows of binary matrices in std::vector<int> or in more efficient std::bitset<N> data structures, which encourages the compiled C++ code to use the low-level SIMD instructions. The C++ code is available in [22]. For complexity comparison, the inefficient PLU-based enumeration has also been implemented, and it can be validated only for matrices of size n 5 . In the PLU-based implementation and for small n, the uniqueness of the generated matrices can be automatically enforced by exploiting the std::set data structure with hashing or tree-based indexing. For larger values of n, more advanced data structures are required such as the hash-tries. Even though the complete sets of all lower and upper triangular matrices can be pre-generated, it results in a large memory footprint but faster generation.
The PLU-based enumeration is attractive, since it is already “embarrassingly parallel”, allowing for distributed implementations. There could be other strategies for modifying the PLU-based enumeration so that only unique matrices are implicitly or explicitly generated. It should also be emphasized that the exhaustive enumeration of general linear groups is only feasible for invertible matrices over finite fields, since the group order becomes infinite over infinite fields. Moreover, deciding whether the two real-valued matrices are identical is problematic, as it depends on the floating-point representation of numerical values.
Algorithm 2: Enumeration of GL ( n , 2 ) via Bruhat decomposition
  • Input: integer n > 1
  • Output: elements of GL ( n , 2 )
1:
function GenGL(n)
2:
     N U 2 n ( n 1 ) / 2    // # unit upper triangular matrices
3:
    for all  π P  do    // loop over all n ! permutations of ( 0 , 1 , , n 1 ) in set P
4:
         P PermutationMatrix ( π )    // create permutation matrix corresponding to π
5:
        Step 1: Identify allowed lower inversions
6:
         K
7:
        for  i 1  to  n 1  do
8:
           for  j 0  to  i 1  do
9:
               if  π [ j ] > π [ i ]  then    // standard inversion condition
10:
                    K K { ( i , j ) }
11:
               end if
12:
           end for
13:
        end for
14:
         N L 2 | K |
15:
        Step 2: Iterate over constrained lower matrices
16:
        for  mask L 0  to  N L 1  do
17:
            L I n    // identity matrix
18:
           map bits of mask L to positions in K of L
19:
           Step 3: Iterate over all upper matrices
20:
            M partial P T L    // pre-compute
21:
           for  mask U 0  to  N U 1  do
22:
                U GenerateUnitUpper ( n , mask U )
23:
                A M partial U
24:
               return A
25:
           end for
26:
        end for
27:
    end for   // loop over permutations
28:
end function
29:
  Input : dimension n and parameter   mask
30:
Output: unit upper triangular matrix U
31:
function GenerateUnitUpper( n , mask )
32:
     U I n , b 0
33:
    for  i 0  to  n 1  do
34:
        for  j i + 1  to  n 1  do
35:
            U i , j ( mask b ) & 1    // right bit-shift
36:
            b b + 1
37:
        end for
38:
    end for
39:
    return  U
40:
end function
41:
  Input : permutation π
42:
Output: permutation matrix P corresponding to π
43:
function PermutationMatrix( π )
44:
     P 0 n × n    // all-zeros matrix
45:
    for  i 0  to  n 1  do
46:
         P i , π [ i ] 1
47:
    end for
48:
    return  P
49:
end function

4. Repairing Singular Matrices to Become Invertible

In many scenarios, large binary matrices may be nearly invertible; however, they are strictly singular by definition. Such a case can be practically resolved by finding a “closest” invertible matrix that is non-singular. The problem can be formulated as follows.
Problem 1.
Given an ( n × n ) binary matrix A , find the binary matrix A GL ( n , 2 ) with the minimal Hamming distance, D H A , A .
Solution 1.
A = A , A GL ( n , 2 ) arg min A GL ( n , 2 ) D H A , A , o t h e r w i s e .
In particular, in the first step, the rank deficiency, d = n rank A , is computed to decide whether A is invertible. If A is already invertible, i.e., d = 0 , the algorithm terminates. Otherwise, the invertible matrix A , consisting of the Hamming distance precisely, D H A , A = d , is obtained by flipping exactly d bits in A at defined positions, as explained below.
Note that the matrix repair problem stated above is a variation of the more general maximum rank matrix completion problem studied, for example, in [19]. The rank (i.e., also the rank deficiency) can be computed by the standard GJE. The matrix rank is equal to the number of pivots [9]. Specifically, when transforming the matrix into a row-echelon form, the j-th column does not have a pivot, if there is no row i j such that the element A ( i , j ) = 1 . The columns without a pivot are referred to as being pivot-free. Equivalently, the row-echelon form contains exactly d all-zero rows. At the same time, it is important to record which rows are swapped during the GJE process. The rows that were swapped and subsequently zeroed are referred as dependent rows, since they are linear combinations of the other rows. The identified pivot-free columns and the dependent rows define the bit positions, which need to be flipped in order to make the original matrix invertible.
Lemma 2  
(Rank change due to single bit-flip). A single bit-flip changes the rank of a binary matrix by at most one.
Proof. 
Let A be a square binary matrix obtained by flipping the ( i , j ) entry of A , so that, over GF ( 2 ) , A = A + E i j and E i j = e i e j T have exactly one non-zero element at position ( i , j ) . Considering the combined rows and columns of the matrices A and E i j , i.e., span { A E i j } = rank ( A + E i j ) = rank A + rank E i j rank { A E i j } = rank A + 1 r , where r = { 0 , 1 , 2 } , depending on whether the non-zero row and column of E i j appears in the span of A , we must conclude that | rank A rank A | 1 .    □
Assuming Lemma 2, the task now is to find the set of d bit-flips that reduce the rank deficiency of A to zero so it becomes invertible. These bit-flips are defined by the following theorem.
Theorem 4  
(Minimal bit-flips to make binary matrix invertible). The binary square matrix A with the rank deficiency d > 0 can be made invertible by performing no less than d bit-flips at the intersection of the dependent rows and the pivot-free columns. These bit-flips can be represented as any of the ( d ! ) permutation matrices of size ( d × d ) .
Proof. 
The inverse matrix can be obtained by the GJE, which produces the row-echelon form
GJE A = B C 0 1 0 2
where B is a ( r × r ) invertible sub-matrix r = rank A and 0 2 is a ( d × d ) all-zero matrix. The last d all-zero rows are dependent swapped rows, and the last d columns are pivot-free columns [9]. The matrix A becomes invertible if 0 2 in the GJE is replaced by a non-singular matrix; such a matrix must have at least d non-zero elements. For instance, matrix 0 2 can be replaced with a ( d × d ) permutation matrix P d . The non-zero elements of P d corresponds to the d bit-flips in A , so the GJE of the corresponding perturbed matrix A is
GJE A = B C 0 1 P d .
Consequently, rank A = rank B + rank P d = r + d = n , so A is non-singular. Furthermore, by Lemma 2, such a matrix has the minimal possible Hamming distance, D H A , A = d , which is equal to a rank deficiency of A .    □
By Lemma 2, every bit-flip can increase the matrix rank by at most one, so the minimum number of bit-flips required to make the matrix invertible is equal to its rank deficiency, d.
Since Theorem 4 allows multiple solutions, the natural question is whether additional constraints could be adopted to narrow down the choices. For instance, it may be desirable to maximize the sparsity by zeroing as many elements as possible, minimize the maximum weight of columns and rows, or make the sub-matrices also invertible.
Note also that Theorem 4.1 in [19] asserts that changing the matrix element at a position corresponding to the basis-avoidable row and column, respectively, increases the matrix rank. Note that in Theorem 4 above, the element positions to increase the matrix rank are referred to as dependent rows and pivot-free columns instead. Such an element change is referred to as rank-one update, and it can be expressed as the product of a column and a row vector. In particular, for binary matrices, there is only one value for how the matrix element can be changed, so the rank-one update can be expressed as
A = A + e i e j T = A + E i j .
For the matrices over other fields, the maximum rank updates are more evolved, since the element values, in addition to their positions, must also be determined [19].

Implementation

The proposed algorithm for repairing singular binary matrices is outlined as Algorithm 3 on the next page. The C++ implementation again uses the std::bitset<N> data structure to store the matrix rows and to allow the compiler to utilize the SIMD instructions for the bit-level parallelism on a single CPU [22]. For example, a binary matrix of size n = 3000 bits requires approximately 1.13 MB of memory. The time complexity of making the matrix invertible is dominated by the GJE, which has complexity O n 3 . The GJE computations can be at least partially distributed, which is important in high-throughput applications requiring the repair and then inversion of very large binary matrices, such as forward error correction coding, cryptography, and quantized algorithms in machine learning. Moreover, the GJE arithmetic operations for the matrices defined over GF ( 2 ) are amenable to the fast hardware implementations including, for example, the FPGAs.
Algorithm 3: Singular matrix repair via GJE
  • Input: matrix A F 2 n × n
  • Output: non-singular matrix A = arg min d ( A , A ) , set of bit-flips F
1:
function RepairMatrix( A , n )
2:
     F
3:
     ( r , C pivots , π rows )   GaussianElimination ( A , n )
4:
    if  r = n  then return  A    // matrix already full-rank
5:
    end if
6:
    Identify dependent rows:
7:
     I dep { π rows [ i ] r i < n }    // rows permuted to the bottom are dependent
8:
    Identify free columns:
9:
     J free { j { 0 , , n 1 } j C pivots }
10:
     d n r    // matrix deficiency (nullity)
11:
    Perform minimal bit-flips:
12:
    for  k 0  to  d 1  do
13:
         r o w I dep [ k ]
14:
         c o l J free [ k ]
15:
         A row , col A row , col + 1
16:
         F F { ( row , col ) }
17:
    end for
18:
    return  A
19:
end function
20:
  Input : matrix M   to check and its dimension   n
21:
Output: matrix rank r, set of pivots C pivots , rows pivoted π rows
22:
function GaussianElimination( M , n )
23:
     M M    // work on a copy
24:
     π rows [ 0 , 1 , , n 1 ]    // track row permutations
25:
     C pivots , r 0    // current rank
26:
    for  j 0  to  n 1  do    // iterate over columns
27:
        if  r = n  then break
28:
        end if
29:
        Step 1: Pivot search
30:
        Find smallest p r such that M p , j = 1
31:
        if no such p exists then
32:
           continue    // column j is free variable
33:
        end if
34:
        Step 2: Swap rows    // move pivot to diagonal
35:
        SwapRows ( M , r , p )
36:
        SwapElements ( π rows , r , p )
37:
         C pivots C pivots { j }
38:
        Step 3: Elimination
39:
        for  i 0  to  n 1  do
40:
           if  i r  and  M i , j = 1  then
41:
                M i M i + M r
42:
           end if
43:
        end for
44:
         r r + 1
45:
    end for
46:
    return  ( r , C pivots , π rows )
47:
end function
The empirical runtimes and the memory requirements for repairing randomly generated binary matrices to become invertible are shown in Figure 4 and Figure 5, respectively. Note that a binary random matrix is invertible with the probability | GL ( n , 2 ) | / 2 n 2 28.9 % , for n 1 .
It is unclear whether the required bit-flips to make the binary matrix invertible could be found more directly in order to reduce the cubic cost of the GJE. The complexity of the GJE itself can be reduced by adopting faster matrix multiplications, for example, using the Method of Four Russians and other Strassen-like algorithms [12].

5. Conclusions

This paper investigated three related problems of inverting large binary matrices. Specifically, a robust blockwise matrix inversion was proposed that is based on PLU factorization. The time complexity of this algorithm was evaluated both theoretically and empirically. Surprisingly, the base cases can be assumed to be relatively large when achieving sub-cubic scaling in complexity. Next, it was shown that the enumeration of general linear groups can be carried out much more efficiently by assuming Bruhat decomposition rather than PLU factorization in order to only generate unique invertible matrices. Finally, we showed how to find an invertible binary matrix that is closest to a given singular binary matrix by performing the minimum number of bit-flips at the determined positions. The number of these bit-flips is equal to the rank deficiency of the original matrix. All proposed algorithms were validated to show their correctness. The reference C++ implementation is available in a public Github repository.
The proofs of theorems and lemmas provided in this paper are sketches and not fully rigorous arguments. It is likely that these proofs could be deduced from other known results in linear algebra. It should also be noted that the focus of this paper is on computational and algorithmic problems, and this paper makes no attempts to contribute any fundamental theoretical results in linear algebra. Furthermore, the presented algorithms can be used, in principle, for matrices defined over any finite fields. The implementation for specific fields can be highly optimized, which has a significant impact on the constants used in time and space complexity expressions and which are not shown explicitly in the big-O complexity notation. The single-thread implementation of the algorithms presented in this paper are provided as a reference. This implementation can be further optimized, for example, to support dynamic data structures allocated during the runtime and to allow multi-threaded and multi-processor parallel executions. In general, it would be very desirable to provide low-level highly optimized implementations of the numerical libraries for linear algebra over specific as well as general finite fields, since the number of relevant computing applications is steadily growing.

Author Contributions

Conceptualization, I.M., P.L. and T.H.; Formal analysis, I.M., P.L. and T.H.; Investigation, all; Supervision, P.L. and T.H.; Project administration, P.L.; Writing—original draft, I.M.; Writing—review and editing, P.L.; Visualization, I.M.; Software, I.M.; Resources, P.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by a research grant from Zhejiang University.

Data Availability Statement

The data presented in this study are openly available in https://github.com/1brahim74/Inverting-GF2-matrixes (accessed on 12 December 2025).

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. Example of Matrix Inversion via PLU Factorization

Consider inverting the binary matrix A of size n = 4 ,
A = 1 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0
over field GF ( 2 ) . The ( 2 × 2 ) sub-matrices are already sufficiently small, so they represent the base cases that can be inverted by the GJE. However, the sub-matrix A 11 is clearly singular, so its inversion fails. When such a singularity is detected, it can be resolved by first permuting the rows of A . In particular, swapping the rows 2 and 3, the matrix to be actually inverted becomes,
P = 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 A = P A = 1 1 0 1 1 0 0 0 0 0 1 0 0 1 0 0 .
The sub-matrix A 11 is now invertible, and the singularity is removed.
The pivoted factorization P 1 A 11 = L 1 U 1 yields the matrices
P 1 = 1 0 0 1 , L 1 = 1 0 1 1 , and , U 1 = 1 1 0 1 .
The Schur complement of A is computed using the inverse matrices L 1 1 and U 1 1 , so that S = I 2 . Since the size of S is sufficiently small, it is treated as the base case and factored directly as P 2 S = L 2 U 2 , where P 2 = L 2 = U 2 = I 2 .
The final step is to construct the inverse matrix A 1 using (9). The overall permutation matrix P consists of the products of sub-matrices P 2 P 1 that were used at the intermediate steps of the algorithm. The overall triangular matrices L and U are constructed similarly from the sub-matrices L 1 , U 1 , L 2 , and U 2 .

Appendix B. Three Examples of Making the Binary Singular Matrix Invertible

Appendix B.1. Example A1

Consider the ( 4 × 4 ) binary matrix:
A = 1 0 1 0 0 1 1 0 1 1 0 0 0 0 0 1 .
The matrix A is singular over field GF ( 2 ) , since the third row is the sum of the first and the second rows.
The row reduction by GJE is used to find the matrix rank and to identify possible row-dependencies. In particular, let A ( 1 , 1 ) be the first pivot. Other 1’s in the first column are eliminated by simple row operations. This process is repeated assuming the pivot, A ( 2 , 2 ) , which yields the row-echelon form:
GJE A = 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 .
The final pivot is the element at position ( 3 , 4 ) . Consequently, the rank is rank A = 3 , and the third column is the only column without a pivot. In this process, the third row of the original matrix A is identified as the source of linear dependency, which reduces the matrix rank by one.
Since the rank deficiency is d = 1 , exactly one bit-flip in A is required to recover the full rank. The position of this bit is determined by the dependent row and the pivot-free column, i.e., the bit-flip must be performed at position ( 3 , 3 ) . The resulting matrix,
A = A + E 33 = 1 0 1 0 0 1 1 0 1 1 ( 1 ) 0 0 0 0 1
has a full rank, and thus, it is invertible.

Appendix B.2. Example A2

Consider the ( 4 × 4 ) singular binary matrix:
A = 0 1 1 0 1 0 1 1 1 1 0 1 1 1 0 0 .
The GJE performed over field GF ( 2 ) identifies the third row as being linearly dependent on the other rows and the third column as being pivot-free. Consequently, the rank deficiency is d = 1 , and a single bit-flip at position ( 3 , 3 ) makes the modified matrix A invertible.

Appendix B.3. Example A3

Consider the ( 5 × 5 ) singular binary matrix defined over field GF ( 2 ) , i.e.,
A = 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 0 0 1 1 0 1 .
The first and the fourth rows are identical, and so are the second and the fifth rows. Performing the GJE, the rank deficiency is found to be d = 2 . The fourth and the fifth columns are pivot-free. The fourth and the fifth rows are linearly dependent. Consequently, exactly two bit-flips are required. There are two possibilities for these bit-flips, i.e., two unique permutation matrices, P 2 . For example, the dependent rows and the pivot-free columns can be paired to make the bit-flips at positions ( 4 , 4 ) and ( 5 , 5 ) . The resulting matrix,
A = 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 ( 0 ) 0 0 1 1 0 ( 0 )
has a full rank, and thus, it is invertible.

References

  1. Wang, H.; Guo, Y.; Zhang, H. A Method of Ultra-Large-Scale Matrix Inversion Using Block Recursion. Information 2020, 11, 523. [Google Scholar] [CrossRef]
  2. Casacuberta, S.; Kyng, R. Faster Sparse Matrix Inversion and Rank Computation in Finite Fields. arXiv 2022, arXiv:2106.09830. [Google Scholar] [CrossRef]
  3. Kaltofen, E. On Wiedemann’s Method of Solving Sparse Linear Systems. In Proceedings of the 9th International Symposium on Applied Algebra, Algebraic Algorithms and ECC, New Orleans, LA, USA, 7–11 October 1991; Volume 539, pp. 29–38. [Google Scholar] [CrossRef]
  4. Gola, A.; Shinkar, I.; Singh, H. Matrix Multiplication Reductions. arXiv 2024, arXiv:2404.08085. [Google Scholar] [CrossRef]
  5. Petković, M.D.; Stanimirović, P.S. Generalized matrix inversion is not harder than matrix multiplication. J. Comput. Appl. Math. 2009, 230, 270–282. [Google Scholar] [CrossRef]
  6. Riahi, M.K. Combinatorial and Recurrent Approaches for Efficient Matrix Inversion: Sub-cubic algorithms leveraging Fast Matrix products. arXiv 2023, arXiv:2307.07611. [Google Scholar] [CrossRef]
  7. Coppersmith, D.; Winograd, S. On the Asymptotic Complexity of Matrix Multiplication. SIAM J. Comput. 1982, 11, 472–492. [Google Scholar] [CrossRef]
  8. Zhang, F. The Schur Complement and Its Applications; Springer: New York, NY, USA, 2005. [Google Scholar]
  9. Golub, G.H.; Loan, C.F.V. Matrix Computations, 4th ed.; Johns Hopkins University Press: Baltimore, MD, USA, 2013. [Google Scholar]
  10. Amestoy, P.R.; Duff, I.S.; L’Excellent, J.-Y.; Rouet, F.H. Parallel Computation of Entries of A-1; [Research Report] RR-8142; INRIA: Rocquencourt, France, 2012. [Google Scholar]
  11. Strassen, V. Gaussian Elimination is Not Optimal. Numer. Math. 1969, 13, 354–356. [Google Scholar] [CrossRef]
  12. Albrecht, M.; Bard, G.; Hart, W. Efficient Multiplication of Dense Matrices Over GF(2). arXiv 2013, arXiv:0811.1714. [Google Scholar]
  13. Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 4th ed.; MIT Press: Cambridge, MA, USA, 2022. [Google Scholar]
  14. The MathWorks Inc. Matlab R2024a; The MathWorks Inc.: Natick, MA, USA, 2024; Available online: https://www.mathworks.com/ (accessed on 12 December 2025).
  15. Dummit, D.S.; Foote, R.M. Abstract Algebra, 3rd ed.; John Wiley & Sons: Hoboken, NJ, USA, 2004. [Google Scholar]
  16. Huang, J.; Lewis, J.B.; Reiner, V. Absolute Order in General Linear Groups. arXiv 2015, arXiv:1506.03332. [Google Scholar] [CrossRef]
  17. Gregor, P.; Hoang, H.P.; Merino, A.; Mička, O. Generating all invertible matrices by row operations. arXiv 2024, arXiv:2405.01863. [Google Scholar] [CrossRef]
  18. Stewart, G.W.; Sun, J.G. Matrix Perturbation Theory, 1st ed.; Academic Press, Inc.: Cambridge, MA, USA, 1990. [Google Scholar]
  19. Berdan, M. Matrix Rank Problem. Master’s Thesis, University of Waterloo, Waterloo, ON, Canada, 2003. [Google Scholar]
  20. Hager, W.W. Updating the inverse of a matrix. SIAM Rev. 1989, 31, 221–239. [Google Scholar] [CrossRef]
  21. Lusztig, G. Bruhat decomposition and applications. arXiv 2010, arXiv:1006.5004. [Google Scholar] [CrossRef]
  22. Mammadov, I. Inverting Large Binary Matrices. 2025. Available online: https://github.com/1brahim74/Inverting-GF2-matrixes (accessed on 12 December 2025).
  23. Hoffman, K.; Kunze, R. Linear Algebra, 2nd ed.; Prentice Hall: Upper Saddle River, NJ, USA, 1971. [Google Scholar]
  24. Bunch, J.R.; Hopcroft, J.E. Triangular Factorization and Inversion by Fast Matrix Multiplication. Math. Comput. 1974, 28, 231–236. [Google Scholar] [CrossRef]
Figure 1. The empirical runtimes of inverting the binary matrices of size 2 n , n 11 .
Figure 1. The empirical runtimes of inverting the binary matrices of size 2 n , n 11 .
Mathematics 14 00270 g001
Figure 2. The empirical memory usage (in kB) when inverting the binary matrices of size 2 n , n 11 .
Figure 2. The empirical memory usage (in kB) when inverting the binary matrices of size 2 n , n 11 .
Mathematics 14 00270 g002
Figure 3. The empirical runtimes comparing the proposed method and the standard GJE for inverting random binary matrices of size up to 2 10 .
Figure 3. The empirical runtimes comparing the proposed method and the standard GJE for inverting random binary matrices of size up to 2 10 .
Mathematics 14 00270 g003
Figure 4. The empirical runtimes of finding the nearest invertible binary matrix of size n 10 4 .
Figure 4. The empirical runtimes of finding the nearest invertible binary matrix of size n 10 4 .
Mathematics 14 00270 g004
Figure 5. The empirical memory requirements for finding the nearest invertible binary matrix of size n 10 4 .
Figure 5. The empirical memory requirements for finding the nearest invertible binary matrix of size n 10 4 .
Mathematics 14 00270 g005
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Mammadov, I.; Loskot, P.; Honold, T. On Invertibility of Large Binary Matrices. Mathematics 2026, 14, 270. https://doi.org/10.3390/math14020270

AMA Style

Mammadov I, Loskot P, Honold T. On Invertibility of Large Binary Matrices. Mathematics. 2026; 14(2):270. https://doi.org/10.3390/math14020270

Chicago/Turabian Style

Mammadov, Ibrahim, Pavel Loskot, and Thomas Honold. 2026. "On Invertibility of Large Binary Matrices" Mathematics 14, no. 2: 270. https://doi.org/10.3390/math14020270

APA Style

Mammadov, I., Loskot, P., & Honold, T. (2026). On Invertibility of Large Binary Matrices. Mathematics, 14(2), 270. https://doi.org/10.3390/math14020270

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop