I recently took an algebra test, and one of the questions was like this (apologise upfront because I don't remember the exact matrix elements, but the idea is essentially the same):

Let $A$ and $B$ be two square matrices. We know that: $$AB=\begin{bmatrix}1 & 2 \\ 3&4\end{bmatrix}, \quad BA=\begin{bmatrix}3 & a \\b &2\end{bmatrix}$$ What can be said about values $a$ and $b$? What possible values can they have?

The real exam problem gave me only 4 options and only 1 was correct (it was a multiple-choice test question). The first 3 of the answers suggested possible values for $a$ and $b$, whereas the last answer stated $\text{(d)Nothing can be said about a and b}$.

How would you proceed? I spent like 10 minutes trying several things to no avail. No further conditions were given on A nor B. We only know they are square and 2x2.

What I tried:

I stablished: $$AB=X, \quad BA=Y$$ Then I multiplied by the inverse of $B$ (assuming it has an inverse), to reach: $$A=XB^{-1}=B^{-1}Y$$ $$B=A^{-1}X=YA^{-1}$$ But I really don't know where this will lead me.


Nothing can be said besides the fact that $a\neq0$ and that $b=\frac 8a$ (which means that both matrices $\left(\begin{smallmatrix}1&2\\3&4\end{smallmatrix}\right)$ and $\left(\begin{smallmatrix}3&a\\b&2\end{smallmatrix}\right)$ have the same determinant). Indeed, if you take$$A=\begin{pmatrix}0&\frac a4\\1&\frac a8\end{pmatrix}\text{ and }B=\begin{pmatrix}\frac52&3\\\frac4a&\frac8a\end{pmatrix},$$then$$AB=\begin{pmatrix}1&2\\3&4\end{pmatrix}\text{ and }BA=\begin{pmatrix}3&a\\\frac8a&2\end{pmatrix}.$$

  • $\begingroup$ Thank you, I don't remember the exact matrix elements but I'm sure they met $\text{tr}(AB)=\text{tr}(BA)$. I modified the question. What can be said now? $\endgroup$ – Jose Lopez Garcia Jun 27 '18 at 9:26
  • $\begingroup$ PD: Can you please point me to an article where they demonstrate that $\text{tr}(AB)=\text{tr}(BA)$ always need to be true? $\endgroup$ – Jose Lopez Garcia Jun 27 '18 at 9:28
  • $\begingroup$ It is not true. What I wrote was that $\operatorname{tr}(AB)=\operatorname{tr}(BA)$. $\endgroup$ – José Carlos Santos Jun 27 '18 at 9:29
  • $\begingroup$ Sorry that's what I meant, it was a Latex typo. $\endgroup$ – Jose Lopez Garcia Jun 27 '18 at 9:31
  • 1
    $\begingroup$ There's an answer here. $\endgroup$ – José Carlos Santos Jun 27 '18 at 9:32

Answer on the same lines, typed it too slowly...

First of all we have the two conditions $$ \begin{aligned} \det(AB) &=\det(BA)\ ,\\ \operatorname{tr}(AB) &=\operatorname{tr}(BA)\ , \end{aligned} $$ the trace condition is fulfilled, the determinant condition becomes $$ab=8\ .$$ We consider only such values of $a,b$, show that each matrix can be realized (in many ways). For this, we search for a general $B$ in the form $$ B=\begin{bmatrix}x&y\\z&t\end{bmatrix}\ . $$ Then the condition $AB=BA$ can be equivalently rewritten $ (AB)^{-1}=(BA)^{-1}$, so we get both $$ \begin{aligned} A^{-1} &= B(B^{-1}A^{-1})=\frac 1{-2} \begin{bmatrix}x&y\\z&t\end{bmatrix} \begin{bmatrix}4&-2\\-3&1\end{bmatrix}\ , \\ A^{-1} &= (A^{-1}B^{-1})B=\frac 1{-2} \begin{bmatrix}2&-a\\-b&3\end{bmatrix} \begin{bmatrix}x&y\\z&t\end{bmatrix} \ . \end{aligned} $$ This leads to an algebraic system in $x,y,z,t$ with parameters $a,b$, $$ \left\{ \begin{aligned} 4x-3y &= 2x-az\\ -2x+y &= 2y-at\\ 4z-3t &= -bx+3z\\ -2z+t &= -by+3t\\ ab &= 8 \end{aligned} \right. $$ and the solution is simplest (found and) typed using a computer algebra system, here sage:

sage: var( 'x,y,z,t,b' );
sage: a = 8/b
sage: AB = matrix( 2, 2, [1,2,3,4] ) 
sage: BA = matrix( 2, 2, [3,a,b,2] )
sage: B  = matrix( 2, 2, [x,y,z,t] )
sage: Ainverse1 = B * AB.inverse() 
sage: Ainverse2 = BA.inverse() * B
sage: solve( [ Ainverse1[j,k] == Ainverse2[j,k] for j in [0,1] for k in [0,1] ], [x,y,z,t] ) 
[[x == r4, y == r3, z == 1/8*b*(3*r3 - 2*r4), t == 1/8*b*(r3 + 2*r4)]]

so any choice of r3, r4 above leads to a solution. My choice is $y=r_3=0$, $x=r_4=4$, so $$ B = \begin{bmatrix}4&0\\-b&b\end{bmatrix} \ , \qquad A = \begin{bmatrix}3/4&2/b\\7/4&4/b\end{bmatrix} \ . $$ Code and check:

sage: B = matrix( 2, 2, [4,0,-b,b] )
sage: B
[ 4  0]
[-b  b]
sage: A = AB * B.inverse()
sage: A
[3/4 2/b]
[7/4 4/b]
sage: A*B
[1 2]
[3 4]
sage: B*A
[  3 8/b]
[  b   2]
  • $\begingroup$ Good answer, thank you ;) $\endgroup$ – Jose Lopez Garcia Jun 27 '18 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.