[Math] Inverse of binary matrix

binaryinversematrices

I have tried creating an inverse of a binary matrix using the identity matrix method. Have an identity matrix alongside the square matrix and perform all the operations to convert the square matrix to identity matrix on the identity matrix.

1111 1000
0101 0100
0100 0010
1000 0001

It gives

1000 1111
0100 0101
0010 1101
0001 0110

but multiplying the square matrix with the result is not giving an identity matrix

what is the problem am i doing something wrong

Best Answer

Let $A=\left(\begin{array}{cccc}1&1&1&1\\0&1&0&1\\0&1&0&0\\1&0&0&0\end{array}\right)$.

You said you have transformed, using elementary row operations, $$\left(\begin{array}{cccc|cccc}1&1&1&1&1&0&0&0\\0&1&0&1&0&1&0&0\\0&1&0&0&0&0&1&0\\1&0&0&0&0&0&0&1\end{array}\right) \to\cdots\not\to \left(\begin{array}{cccc|cccc}1&0&0&0&1&1&1&1\\0&1&0&0&0&1&0&1\\0&0&1&0&1&1&0&1\\0&0&0&1&0&1&1&0\end{array}\right)$$

But the first two rows must be wrong. Take the second resultant row as example, the row is the sum of initial rows 2 and 4, the only linear combination that can produce columns 5-8 of the resultant row; however $$\begin{align*}& R_2+R_4\\ =&\left(\begin{array}{cccc|cccc}0&1&0&1&0&1&0&0\end{array}\right) + \left(\begin{array}{cccc|cccc}1&0&0&0&0&0&0&1\end{array}\right)\\ =&\left(\begin{array}{cccc|cccc}1&1&0&1&0&1&0&1\end{array}\right)\\ \ne&\left(\begin{array}{cccc|cccc}\color{red}0&\color{red}1&\color{red}0&\color{red}0&\color{green}0&\color{green}1&\color{green}0&\color{green}1\end{array}\right)\text{ in your answer} \end{align*}$$

Similarly, your first resultant row is the sum of all 4 initial rows, as shown in columns 5-8. But if you add up the 4 initial rows together,

$$\begin{align*} R_1+R_2+R_3+R_4 =&\left(\begin{array}{cccc|cccc}0&1&1&0&1&1&1&1\end{array}\right)\\ \ne&\left(\begin{array}{cccc|cccc}\color{red}1&\color{red}0&\color{red}0&\color{red}0&\color{green}1&\color{green}1&\color{green}1&\color{green}1\end{array}\right)\text{ in your answer} \end{align*}$$


Back to the beginning. If you see carefully, the first and second rows of $\left(\begin{array}{c|c}I&A^{-1}\end{array}\right)$ should actually come from the fourth and third rows of $\left(\begin{array}{c|c}A&I\end{array}\right)$ respectively. Perform row swaps $R_4\leftrightarrow R_1$ and $R_3\leftrightarrow R_2$ first should give you a good start. But this is not the only way to start.

And I got the inverse as $A^{-1} = \left(\begin{array}{cccc}0&0&0&1\\0&0&1&0\\1&1&0&1\\0&1&1&0\end{array}\right)$