# Convert from one matrix to another

I have this 4x4 matrix A:

a, b, c, 0,
e, f, g, 0,
i, j, k, 0,
0, 0, 0, 1


And I want to convert it to this matrix B:

a, c, b, 0,
i, k, j, 0,
e, g, f, 0,
0, 0, 0, 1


What matrix do I multiply A to get B? And what is the general approach I could use to "divide" B by A?

Are you familiar with the notion of the matrix inverse?

That is, corresponding to "most" (but not all) square matrices $$A$$ there is some unique matrix $$M$$ (which we name $$A^{-1}$$) such that $$A A^{-1} = A^{-1} A = I$$ whher $$I$$ is the identity matrix (ones on the diagonal, zeros elsewhere). The exception is that if the determinant of $$A$$ is zero, then it will not have an inverse.

It is straightforward but messy to find the inverse of a matrix such as your given $$A$$. Look up Gaussian elimination for one easily understood technique. The answer for your case will be something like $$A^{-1} = \frac1{\det A} \pmatrix{fk-gj & gi-ek & ce - ag &0 \\ cj-bk & af-eb & ce-ag & 0 \\ cj-eb & ja-ib & ak-ic & 0 \\ 0&0&0&1 }$$

Now use the fact that $$(BA^{-1}) A = B$$ so that $$(BA^{-1})$$ is the matrix you are looking for if you wand to multiply from the left. From the right it would be $$(A^{-1}B)$$ and in general those are not the same.

• Thanks this is helpful! In my particular case the values are just swapped around. The second and the third row and columns are swapped. I thought that I could multiply A by a given matrix with 0 and 1 values (identity matrix with swapped values) to get the matrix B. Is this not the case? – Lenny White Aug 14 at 18:49