Find Matrix $P$ so $B=PA$

I have this problem.

$$A = \left(\begin{array}{ccc} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 1 & 2 & 3 \end{array}\right)$$

$$B = \left(\begin{array}{ccc} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right)$$

Find matrix $P$ invertible so $B=PA$.

It's pretty clear in this case.

But I wonder is there a way to find such a matrix in general case, when it's not obvious.

Any help will be appreciated.

• Notice that the second and third row are linear combination of the other. Thus, there exists $E_2E_1$ (of elementary matrices) such that $A$ can be row reduced to $B$, then $E_2E_1$ is the matrix $P$ you need. In other words, start row reducing. – IAmNoOne Dec 3 '14 at 19:12
• @Nameless Ok, in this case I found $E_2E_1$ and then I use the $E_2E_1$ on identity matrix and this is matrix $P$? – JaVaPG Dec 3 '14 at 19:26
• What do you mean...? Any matrix times the identity is the same matrix... – IAmNoOne Dec 3 '14 at 19:27
• @Nameless I'm not so sure I got what you meant, lets take this case as an example, we have two elementary matrices $E_1E_2$ in order for $A \implies B$, I don't understand what I should do with these two elementary matices – JaVaPG Dec 3 '14 at 19:32
• See Omnomnomnom's answer on how to put the matrices together – IAmNoOne Dec 3 '14 at 19:33

By row reducing, you can find matrices $P_1,P_2$ such that $P_1A$ and $P_2B$ are in the same row-echelon form. From there, we can say that $$P_1A = P_2B \implies B = (P_2^{-1}P_1)A$$ This will work whenever such a $P$ exists.

For your example: note that $B$ is in row-echelon form. So, in this case, we have $P_2 = I$. For $A$, we have $$\pmatrix{ 1&2&3&&1&0&0\\ 2&4&6&&0&1&0\\ 1&2&3&&0&0&1} \mathop{\leadsto}^{R_3\to R_3-R_1}\cdots \mathop{\leadsto}^{R_2\to R_2-2R_1}\\ \pmatrix{ 1&2&3&&1&0&0\\ 0&0&0&&-2&1&0\\ 0&0&0&&-1&0&1}$$ So, $$P_1 = \pmatrix{ 1&0&0\\ -2&1&0\\ -1&0&1 }$$

• I don't quite understand can you show the process on the example please? – JaVaPG Dec 3 '14 at 19:35
• @JaVaPG, as I said before row reduce and record your reduction in the matrix $P_i$. – IAmNoOne Dec 3 '14 at 19:39
• @JaVaPG See my edit. – Omnomnomnom Dec 3 '14 at 19:46

Let's say you wanted to find such $P$ that $$B = AP\text{.}$$ Let $p_1$, $p_2$ and $p_3$ be the columns of the matrix $P$, i. e. $P = [p_1\quad p_2 \quad p_3]$. Do the same for $B$. The upper linear system is equivalent to the following systems: $$Ap_1 = b_1,\quad Ap_2 = b_2\quad\text{and}\quad Ap_3 = b_3\text{.}$$

You should be able to solve those three. From $p_j$'s you can reconstruct $P$.

Since you have to solve $B = PA$, you can transpose that relation ($B^T = A^T P^T$) and reduce this problem to the previous one. Solve the system $B^T = A^T Q$. You may find multiple (or no) solutions $Q$ if $A$ (hance $A^T$) is not invertible.

If you want an invertible $P$, find an invertible solution $Q_i$ among $Q$'s and define $P = Q_i^T$.

when you row reducing a matrix $A$ by hand, it is much easier to keep track of the row operations, if we augment the matrix $A$ with a column like this: $\left( \begin{array}{lll|l} 1 & 2 & 3 & a\cr 2 & 4 & 6 & b\cr 1 & 2 & 3 & c\end{array} \right) \to \left( \begin{array}{lll|l} 1 & 2 & 3 & a\cr 0 & 0 & 0 & -2a + b\cr 0 & 0 & 0 & -a+c\end{array} \right)$ you decode this as multiplying by the matrix $E$ on the left where $E \pmatrix{a \cr b\cr c}=\pmatrix{1 & 0 & 0\cr-2 & 1 & 0\cr -1 & 0 & 1}\pmatrix{a\cr b\cr c\cr d} = \pmatrix{a &\cr-2a+b\cr -a+c}.$

that is $EA = U.$ of course, if you are calculator or computer matrix software, you augment by the identity matrix as suggested by others.