0

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

John Selvakumar
  • 13
  • 1
  • 1
  • 3
  • 2
    You must be doing something wrong, since you are getting the wrong answer. Exactly what you are doing wrong is impossible for us to tell, since you haven't shown us what you have done. But presumably you just made some arithmetical mistake somewhere, and you just have to go over your work carefully to find it. – Gerry Myerson Jan 05 '14 at 04:18
  • I got an inverse $$\left(\begin{array}{cccc}0&0&0&1\0&0&1&0\1&1&0&1\0&1&1&0 \end{array}\right)$$ – peterwhy Jan 05 '14 at 04:22
  • peterwhy can you tell me how you arrived at the result did you use the the identity matrix modification or any other method – John Selvakumar Jan 05 '14 at 05:00
  • How? The same augmented identity matrix, like what you have done. Post your steps here so that others can know what you did wrong. – peterwhy Jan 05 '14 at 05:37

1 Answers1

1

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)$

peterwhy
  • 22,930
  • 1
    Ya the problem is i wrote a program in java to perform the matrix operations i might used 44 matrix as an example but i need it done for 3232.So i cant give the steps i did. The program will work like this it starts in the first diagonal element if it is 1 then it will search the rows below if 1 it will add the first row with the it and make it 0. if it is not 1 it will search a column or row which when the added makes diagonal element 1 and proceed. then a upper triangular matrix will be there and same way make it identity matrix – John Selvakumar Jan 05 '14 at 13:27
  • anyway thanks for the explanation – John Selvakumar Jan 05 '14 at 13:29
  • @JohnSelvakumar I don't understand your first comment. Did you mean you tried to use your program to find the inverse of a $4\times4$ matrix and failed, and the above was what the program gave? – peterwhy Jan 05 '14 at 14:32
  • 1
    Yes that is exactly what i meant so i don't know the steps for it. – John Selvakumar Jan 06 '14 at 15:39
  • 1
    I think I see the problem here. All the descriptions of the process that I've found (with my notoriously weak Google-fu) seem to rely on human pattern matching to work forward to a solution. I haven't yet seen a description that can be simply transcribed to code. I may have to resort to figuring it out for myself. – sh1 Sep 14 '16 at 21:32