# Find matrices $P$ and $Q$ to check if matrices $A$ and $B$ are equivalent( $Q^{-1}AP = B$ )?

\begin{align}&A=\begin{pmatrix} 6 & -3 & -6 & -12 & 9 & 9 & 0 & 3 & -6 & 9 \\ 12 & 4 & 8 & -4 & 8 & -12 & 4 & 4 & 8 & -4\\ \end{pmatrix} \\\\ & B = \begin{pmatrix} 4 & -4 & 0 & -8 & -12 & 8 & -4 & -8 & 4 & -12 \\ -9 & -3 & -6 & 3 & -6 & 9 & -3 & -3 & -6 & 3\\ \end{pmatrix} \end{align}

I need to find out if $A$ and $B$ are equivalent or not. To do that I have rearranged the definition of matrix equivalence:

\begin{align} Q^{-1}AP & = B \\\\ AP & = QB \end{align}

So now I have

$\begin{pmatrix} 6 & -3 & -6 & -12 & 9 & 9 & 0 & 3 & -6 & 9 \\ 12 & 4 & 8 & -4 & 8 & -12 & 4 & 4 & 8 & -4\\ \end{pmatrix} \cdot \begin{pmatrix} x_{1,1} & \cdots & x_{1,2} \\ \vdots & & \vdots \\ x_{10,1}& \cdots & x_{10,2} \end{pmatrix} = \begin{pmatrix} y_{1,1} & \cdots & y_{1,2} \\ \vdots & & \vdots \\ y_{10,1}& \cdots & y_{10,2} \end{pmatrix} \cdot \begin{pmatrix} 4 & -4 & 0 & -8 & -12 & 8 & -4 & -8 & 4 & -12 \\ -9 & -3 & -6 & 3 & -6 & 9 & -3 & -3 & -6 & 3\\ \end{pmatrix}$

Question: How can I solve that big equation system with two variables $x$ and $y$ and get the matrices $P$ and $Q$? Is there an easier (and hopefully more safe) way to solve that task?

• $Q$ and $P$ size doesn't match $A$ and $B$ size Jun 8, 2017 at 10:37
• @stity I have updated my post Jun 8, 2017 at 10:46

If you only want to know if $A$ and $B$ are equivalent or not, you only need to show whether they have the same rank. A short explanation of this is that applying invertible square matrix on the left is just applying multiple elementary row operations, and applying invertible square matrix on the right is just applying multiple elementary column operations.

For this case, since there are only two rows in the matrices, the fastest way is to look at their column spaces.

• Thank you for your answer. Just for the case of interest: What if I would like to find out about the matrices $P$ and $Q$? What is the common technique here? Jun 8, 2017 at 11:32
• @jublikon Given a matrix $A$, by applying some row operations, you can transform it into its reduced row echelon form. The row operations are represented by left multiplication of several matrices $E_1,...,E_n$, so that the reduced row echelon form of $A$ is the matrix $R=E_n...E_2E_1A$. Then apply column operations to transform $R$ into its reduced column echelon form $R'$, which has all entries zero except possibly on the main diagonal, and when an entry on the main diagonal is nonzero, it must be one...
– edm
Jun 8, 2017 at 14:34
• @jublikon Again, the column operations are represented by right multiplication of several matrices $F_1,...,F_m$. So $R'=E_n...E_1AF_1...F_m=RF_1...F_m=PAQ$, where $P=E_n...E_1$ and $Q=F_1...F_m$. Repeat the same method to find matrices $P',Q'$ such that $P'B$ is reduced row echelon form of $B$ and $P'BQ'$ is reduced column echelon form of $P'B$, so that $P'BQ'=PAQ$. Then we have $B=P'^{-1}PAQQ'^{-1}$.
– edm
Jun 8, 2017 at 14:39
• @jublikon Augment by the appropriately-sized identity matrix to form $\begin{bmatrix}A&\mid&I\end{bmatrix}$ and then row reduce. The result is $\begin{bmatrix}\cdots&\mid&E_n\dots E_1\end{bmatrix}$.
– amd
Jun 8, 2017 at 18:14