# Determining matrix $A$ and $B$, rectangular matrix

Let $A$ be a $3\times 2$ matrix and $B$ be a $2\times 3$ be matrices satisfying $$AB=\begin{pmatrix} 8 & 2 & -2\\ 2 & 5 & 4\\ -2 & 4 & 5\end{pmatrix}$$ Calculate $BA$. How would you go for this problem? Do we start by noticing the matrix is symmetric? Any hints/ideas? Thanks

• Start with this: given your symmetric $C,$ you can find a very nice $P$ such that $P^T C P$ is diagonal. math.stackexchange.com/questions/395634/… Nov 22, 2015 at 4:59
• Huh. Never done this problem this way before. You can demand $B = A^T.$ Nov 22, 2015 at 5:13

This is a strange problem. In general, the quesiton would not be well posed. As observed in the comment by @JohnMa it is neccesary that the given $3\times 3$-matrix has rank two. This is satisfied, but even then, the question would not be well posed in gerneral. Namely, if $A$ and $B$ are such that $AB$ is your given matrix, then for any invertible $2\times 2$ matrix $T$ also $AT$ and $T^{-1}B$ have the same property. In that way $BA$ gets replaced by $T^{-1}BAT$, which is different from $BA$ in general. Hence the only case in which the question is well posed is if $BA$ is a multiple of the identity matrix, and with the given $3\times 3$-matrix, you indeed get $BA=9I$.

EDIT: I have rewritten and extended the next paragraph a bit, following the remark by @CarlosMendoza:

The way to prove this, is as follows. You first compute the eigenvalues of $AB$ and find that they are $0$ (multiplicity one) and $9$ (multiplicity two). In particular $AB$ has rank two, and viewing it as a linear map $\mathbb R^3\to\mathbb R^3$ its kernel is given by the $0$-eigenspace and its image is given by the $9$-eigenspace. (The first equality holds by definition, while for the second, the eigenspace is obviously contained in the image and has the same dimension.) Now the matrices $A$ and $B$ correspond to linear maps $\mathbb R^2\to\mathbb R^3$ and $\mathbb R^3\to \mathbb R^2$, respectively, so they both have rank at most two. By definition, the kernel of $B$ is contained in the kernel of $AB$ and the image of $AB$ is contained in the image of $A$. Since the kernel of $B$ has at least dimension one and the image of $A$ has at most dimension two, both these inclusions must be equalities. In particular, the image of $A$ is the $9$--eigenspace of $AB$, and calling this $V$, $A$ must define a linear isomorphism $\mathbb R^2\to V$. But this immediately implies that $(AB)A=9A$ since $AB$ is multiplication by $9$ on $V$. Rewriting the left hand side as $A(BA)$, you get $A(BAx)=A(9x)$ for all $x\in\mathbb R^2$, and since $A$ is injective, this implies $BAx=9x$ for all $x\in\mathbb R^2$.

• The reasoning you did in the first paragraph about why $BA$ has to be a multiple of the identity matrix is really elegant and powerful (in just four lines you were the first one to get the main form of the solution!). Unfortunately, it gets a little obscure to me (an inexpert that wants to learn more) in the second paragraph when you want to prove why it must be $9$ the integer multiple. Could you extend a little more that proof such that it gets a little more readable for newbies? Also, some references (links) that support your thoughts would be helpful. Nov 23, 2015 at 12:54
• Thanks for the answer, this clarfies
– nerd
Nov 24, 2015 at 7:06
• @CarlosMendoza: I have edited the answer. I am not sure about references, I think that I have not used anything special, mainly the general philosophy to think about linear maps rather than matrices ... Nov 24, 2015 at 9:45

I'm sorry I don't have time to develop al the exercise, but I think I can give you some hints. After that I think is more or less straight-forward. Consider $$A=\left(\begin{array}{ccc} a & c & e\\ b & d & f\\ 0 & 0 & 0 \end{array}\right)$$ $$B=\left(\begin{array}{ccc} g & h & 0\\ i & l & 0\\ m & n & 0 \end{array}\right)$$ So we have $$BA=\left(\begin{array}{ccc} u & v & 0\\ w & z & 0\\ 0 & 0 & 0 \end{array}\right)$$ Some invariants are: $$trAB=trBA$$ And from this we have
$$u+z=18$$ Since AB is simmetric so is BA $$v=w$$ The Binet formula shouldn't be so useful because detAB=detBA=0 Anyway I think that from here more or less You can proceed with direct calculation.Let me know.

• It isn't necessarily true that $\det AB = \det BA$ when dealing with non-square matrices. For example, if $v$ is a non-zero real vector, $v^Tv$ is a $1\times 1$ non-zero matrix, while $vv^T$ is a rank one matrix. If $v\in \mathbb R^n$ with $n>0$, then one of the determinants is zero and the other is not. However, this is this is all that can go wrong: up to a factor of $t^k$, $AB$ and $BA$ have the same characteristic polynomial. Nov 22, 2015 at 14:46

Using the suggestion of @WillJagy and the direct approach suggested by @Dac0, we have $$A = \begin{bmatrix} a & b\\ c & d\\ e & f\\ \end{bmatrix}\qquad B = \begin{bmatrix} a & c & e\\ b & d & f\\ \end{bmatrix}$$

and from $AB$ we get the following set of equations

\begin{align} a^2 + b^2 &= 8\\ c^2 + d^2 &= 5\\ e^2 + f^2 &= 5\\ ac + bd &= 2\\ ae + fb &= -2\\ ec + fd &= 4\\ \end{align}

I solved this in WolframAlpha and tested with this particular solution(out of infinite solutions):

$$A = \begin{bmatrix} -2 & -2\\ -2 & 1\\ -1 & 2\\ \end{bmatrix}\qquad B = \begin{bmatrix} -2 & -2 & -1\\ -2 & 1 & 2\\ \end{bmatrix}$$

Interestingly enough,

$$BA = \begin{bmatrix} 9 & 0\\ 0 & 9\\ \end{bmatrix}$$

which corresponds to the solution proposed by @AndreasCap. It's also interesting to note that the columns of $A$ are orthogonal and their squared length are equal to $9$, the non-zero eigenvalue of $AB$ with multiplicity $2$.

I gave importance to @WillJagy suggestion because somehow it remembered me of the covariance matrix. I am not saying is the same, but there are nice similarities.

• Having $B=A^T$ was possible because the given three by three symmetric matrix was positive semidefinite. Once you make that decision, even though rectangular, the trace of $AA^T$ equals the trace of $A^T A,$ the sum of the squares of all entries of $A.$ Nov 22, 2015 at 19:20
• Posted an answer entirely from the viewpoint of integer quadratic forms, traditional Hermite reduction. Nov 22, 2015 at 20:43
• Thanks for your answer, this was the most straightforward way hoever, this question is not well posed
– nerd
Nov 24, 2015 at 7:06
• Your welcome nerd, although I would say that the problem is well posed under some special conditions, as was analyzed by Andreas Cap, and derived by Will Jagy and me :) Nov 24, 2015 at 12:53

Afterthought: Hermite reduction, which is nothing worse than "completing the square" a few times, works for indefinite quadratic forms as well; the resulting diagonal matrix then has some negative entries. Since the quadratic form in this problem is positive semidefinite, it is possible to continue, in the end I found $W^T W = C,$ where $C$ is the given 3 by 3 matrix and $W$ is 2 by 3.

Given that the matrix (I am calling it $C$) has integer entries and is symmetric, it is natural to investigate "congruence" diagonalization of it, that is finding a rational matrix $P$ of determinant $1,$ such that $$P^T C P = D$$ is diagonal. I am actually going to save some time by going directly to Hermite reduction, finding a rational matrix $R$ of determinant $1,$ such that $$R^T D R = C,$$ where we construct $D$ diagonal. Note $R= P^{-1}.$

Take a column vector $$\left( \begin{array}{c} x \\ y \\ z \end{array} \right)$$

With $$C=\begin{pmatrix} 8 & 2 & -2\\ 2 & 5 & 4\\ -2 & 4 & 5\end{pmatrix}$$ we get $$v^T C v = 8 x^2 + 5 y^2 + 5 z^2 + 8 y z - 4 z x + 4 x y$$ Hermite reduction says to start with $8 (x+ \mbox{stuff})^2$ to get rid of all the $x$ terms, those being $8x^2 - 4 zx+ 4 x y.$ And we find $$8 (x + \frac{y}{4} - \frac{z}{4})^2 = 8 x^2 + \frac{y^2}{2}+ \frac{z^2}{2} - y z - 4 z x + 4 x y$$ You really can do this by hand! $$v^T C v - 8 (x + \frac{y}{4} - \frac{z}{4})^2 = \frac{9y^2}{2} + \frac{9z^2}{2} + 9 y z.$$

Second step: get rid of $y^2$ and $yz$ terms, with $(9/2)(y + ??)^2$ And $$\frac{9}{2} (y+z)^2 = \frac{9y^2}{2} + \frac{9z^2}{2} + 9 y z.$$ Hermite's method ends early, because $$v^T C v = 8 \left(x + \frac{y}{4} - \frac{z}{4} \right)^2 + \frac{9}{2} (y+z)^2$$

So far, we have found (this becomes quick if you do quadratic forms all day) $$D = \left( \begin{array}{ccc} 8 & 0 & 0 \\ 0 & \frac{9}{2} & 0 \\ 0 & 0 & 0 \end{array} \right)$$ $$R = \left( \begin{array}{ccc} 1 & \frac{1}{4} & -\frac{1}{4} \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{array} \right)$$ such that $$R^T D R = C.$$ Check!

Now, can we write $D$ as $H^T H?$ Yes, of course, it is positive semidefinite, we could use

$$H = \left( \begin{array}{ccc} \sqrt 8 & 0 & 0 \\ 0 & \sqrt {\frac{9}{2}} & 0 \\ 0 & 0 & 0 \end{array} \right)$$ However, $8 \cdot (9/2) = 36$ is a square; it is much prettier if we note that both $8$ and $9/2$ can be expressed as $u^2 + v^2$ with rational $u,v.$ Indeed, both are $2 u^2,$ in that $2 \cdot 2^2 = 8$ and $2 \cdot \left( \frac{3}{2}\right)^2 = 9/2.$

I thought of a nicer way to put this bit. $$2 \left(8 u^2 + \frac{9}{2} v^2 \right) = 16 u^2 + 9 v^2 = (4u)^2 + (3v)^2.$$ In general, $$2 \left(A^2 + B^2 \right) = (A-B)^2 + (A+B)^2,$$ $$\frac{1}{2} \left(A^2 + B^2 \right) = \left( \frac{A-B}{2} \right)^2 + \left( \frac{A+B}{2} \right)^2,$$ $$\frac{1}{2} \left((4u)^2 + (3v)^2 \right) = \left( \frac{4u-3v}{2} \right)^2 + \left( \frac{4u+3v}{2} \right)^2,$$ $$8 u^2 + \frac{9}{2}v^2 = \left( \frac{4u-3v}{2} \right)^2 + \left( \frac{4u+3v}{2} \right)^2.$$ This means we can take

$$H = \left( \begin{array}{ccc} 2 & -\frac{3}{2} & 0 \\ 2 & \frac{3}{2} & 0 \\ 0 & 0 & 0 \end{array} \right)$$ In the language of integral quadratic forms, we say that $8 u^2 + \frac{9}{2}v^2$ is rationally represented by $s^2 + t^2;$ we have written $$\left( 2 u -\frac{3}{2} v \right)^2 + \left( 2 u +\frac{3}{2} v \right)^2 = 8 u^2 + \frac{9}{2}v^2$$

Now, we don't want to keep $H$ 3 by 3, we get the same $K^T K = D$ with $K$ 2 by 3 with

$$K = \left( \begin{array}{ccc} 2 & -\frac{3}{2} & 0 \\ 2 & \frac{3}{2} & 0 \end{array} \right)$$ by simply deleting the final row of zeroes.

We have $K^T K = D$ and $R^T D R = C.$ Put them together, $$C = R^T (K^T K) R = R^T K^T K R = (R^T K^T) K R = (KR)^T (KR).$$ We make a new matrix name, $$W = K R$$ which is 2 by 3 and solves $$W^T W = C.$$

$$\color{blue}{ W = \left( \begin{array}{ccc} 2 & -1 & -2 \\ 2 & 2 & 1 \end{array} \right)}$$

They want the reversed product,

$$W W^T = \left( \begin{array}{cc} 9 & 0 \\ 0 & 9 \end{array} \right)$$

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Similar:

reference for linear algebra books that teach reverse Hermite method for symmetric matrices

Find the transitional matrix that would transform this form to a diagonal form.

Writing an expression as a sum of squares