# Find two elementary matrices $E_1$ and $E_2$ such that $E_2E_1A=B$.

I have two matrices $$A$$ and $$B$$, and I need to find two matrices $$E_1$$ and $$E_2$$ that satisfy the question stated in the title.

\begin{align*} A&=\begin{bmatrix} 1&2&-1\\ 1&1&1\\ 1&-1&0\\ \end{bmatrix} & B&=\begin{bmatrix} 1&-1&0\\ 1&1&1\\ 4&-1&-1 \end{bmatrix}. \end{align*} I know I need to find two elementary row operations that will turn $$A$$ into $$B$$, I think the first operation is switching the first and third row in $$A$$, but I don't know what the second operation would be.

• You could compute $BA^{-1}$, and then try to recognize it as a product of two elementary matrices. Commented Nov 12, 2019 at 1:53
• $(4.-1,-1)-(1,2,-1)=(3,-3,0)=3(1,-1,0)$ Commented Nov 12, 2019 at 2:04

The aim is to find $$E_1$$ and $$E_2$$ such that $$B = E_2E_1A$$. The first thing is to interchange the first and the last row of the matrix $$A$$, so $$E_1 = \begin{bmatrix}0 & 0 & 1\\0 & 1 & 0\\ 1 & 0 & 0\end{bmatrix}, \quad A_1 := E_1A = \begin{bmatrix}1 & -1 & 0\\1 & 1 & 1\\ 1 & 2 & -1\end{bmatrix}.$$ Then, $$B$$ can be obtained by multiplying the first row of $$A_1$$ and adding it to the third row: $$E_2 = \begin{bmatrix}1 & 0 & 0\\0 & 1 &0\\3&0&1\end{bmatrix}, \quad B = E_2A_1.$$