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.


*

*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?
 A: 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? 
A: 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...
A: 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
