# Figuring out how to do elementary matrix row operations by multiplication of other matrices

I'm having trouble figuring out how to find matrices such that when I multiply on either side of a given matrix, I get some desired matrix out of it. For example using matrix $A$ find matrix $X$ and $Y$ such that $XAY=B$.

$$A= \begin{bmatrix} a&b&0&c\\ d&e&f&0\\ 0&r&s&t\\ u&0&v&w\\ \end{bmatrix} \qquad\qquad B=\begin{bmatrix} v&w&u&0\\ s&t&0&r\\ f&0&d&e\\ 0&c&a&b\\ \end{bmatrix}$$

I'm running in circles trying to find the correct matrix. Is there an easier way to do this other than just brute forcing it?

• Do mean mean "find matrices $X$ and $Y$ such that $XAY$ results in the second matrix"? It's much more common to take a matrix $A$ and transform in on the left by one matrix and on the right by another. – Mike Pierce Sep 28 '16 at 3:04

$$\begin{bmatrix} 0&0&0&1\\ 0&0&1&0\\ 0&1&0&0\\ 1&0&0&0\\ \end{bmatrix} \begin{bmatrix} a&b&0&c\\ d&e&f&0\\ 0&r&s&t\\ u&0&v&w\\ \end{bmatrix} \begin{bmatrix} 0&0&1&0\\ 0&0&0&1\\ 1&0&0&0\\ 0&1&0&0\\ \end{bmatrix} = \begin{bmatrix} v&w&u&0\\ s&t&0&r\\ f&0&d&e\\ 0&c&a&b\\ \end{bmatrix}\;.$$