Proving something is a square matrix

I don't want the solution. Please don't post the full solution. I just need a starting clue on how to do this.

1. Suppose $A$ and $B$ are matrices such that $AB$ and $BA$ are defined.

a) Show that $AB$ and $BA$ are both square matrices.

I actually have no idea where to start. But I note that a square matrix commutes if say:

A was defined as:

$\begin{pmatrix} a & b\\ b & a \end{pmatrix}$

B was defined as:

$\begin{pmatrix} c & d\\ d & c \end{pmatrix}$

Then $AB=BA$

I suppose I need to include this in my argument somehow but for a more general case?

• Hint: Do you know any relations between the dimensions of A and B? – Jacob Akkerboom May 9 '13 at 15:36
• When is the product $AB$ of two matrices $A$ and $B$ defined? What conditions on the number of rows and columns must hold? – k.stm May 9 '13 at 15:37
• Suppose $A$ is an $m\times n$ matrix and $B$ is a $p \times q$ matrix. The fact that $AB$ is defined means what in terms of $n$ and $p$. What happens when you consider $BA$? – Suugaku May 9 '13 at 15:37
• What about this guys? Well I observe that multiplication is only possible with $A$ having a dimension $m$ x $n$ and $B$ must have $n$ x $p$. Hence $AB$ has $m$ x $p$. If the reverse is true with $B$ having dimensions $n$ x $p$, $A$ has dimensions $m$ x $n.$ $BA$ now has dimensions $n$ x $n$. Which would imply $p = m.$ Hence I substitute that into dimensions of $AB$. Which $AB$ has $m$ x $m.$ Thus proving that they both must be square matrices? But then how would I prove that they are of same size? – Bobby May 9 '13 at 15:43
• @Bobby $AB$ and $BA$ are not necessary of same size. – user63181 May 9 '13 at 15:47

Commutativity is not needed. By definition, matrix multiplication of $A$ and $B$ can only be defined if the number of columns of $A$ matches the number of rows of $B$. In that case, if $A$ is an $n \times m$ matrix, and $B$ is an $m \times p$ matrix, then $AB$ will be an $n \times p$ matrix. The way I explain it to my linear algebra students is that you can multiply if the "inner" dimensions match, and the product has dimensions equal to the "outer" dimensions.

$$\underbrace{A}_{n \times m} \cdot \underbrace{B}_{m \times p} = \underbrace{C}_{n \times p}.$$

What can you say about the dimensions of $A$ and $B$ if both products $AB$ and $BA$ exist?

• @ Shaun. So continuing from your argument, $$\underbrace{B}_{m \times p} \cdot \underbrace{A}_{n \times m} = \underbrace{D}_{m \times m}.$$ If $n=p$ So substituting into your notation for rows and columns $$\underbrace{C}_{n \times n}.$$ Therefore we have C as a square matrix and so is D. – Bobby May 9 '13 at 15:55
• Correct. From this you get both $AB$ and $BA$ square --- though not necessarily the same size of square. – Shaun Ault May 9 '13 at 15:56
• Could I ask if your underlining with a curly braces is a valid notation (universally accepted?) – Bobby May 9 '13 at 15:57
• It's not really a notation... but a way for me to highlight the dimensions of these matrices. In fact, it is standard to simply write $A$, $B$, $C$, .... for matrices without notating their respective dimensions at all. – Shaun Ault May 9 '13 at 15:59
• Thanks this notation is much clearer than the way I was taught to write it. So that would mean they would be both equal in dimensions (size) if $AB=BA$ because we get: $$\underbrace{A}_{n \times m} \cdot \underbrace{B}_{m \times p} = \underbrace{C}_{n \times n}.$$ $$\underbrace{B}_{m \times p} \cdot \underbrace{B}_{n \times m} = \underbrace{D}_{m \times m}.$$ If $AB=BA$ implies $C=D$, therefore $m = n$ by implication? Hence both square and equal in size? – Bobby May 9 '13 at 16:03

Hint To multiply a matrix $A\in\mathcal{M}_{n,p}(\mathbb{F})$ by a matrix $B\in\mathcal{M}_{q,m}(\mathbb{F})$: and get $AB\in\mathcal{M}_{n,m}(\mathbb{F})$ we must have $p=q$ so...

If A is a (m×n) matrix, for AB to be defined, B must have its rows equal to the coloumns of A, B can be a (n×p) matrix AB = (m×n)•(n×p)=(m×p) But for BA to be defined, BA=(n×p)•(m×n), since BA is defined, p=m Therefore B is a (n×m) matrix. AB=(m×n)•(n×m)=(m×m) thus AB is a (m×m) matrix BA=(n×m)•(m×n)=(n×n) thus BA is a (n×n) matrix Therefore AB and BA are square matrices