Q:

Proving that the product of two matrices $AB$ can be written as a sum of at most $n$ matrices, each of which has rank 1.

Let $A$ be an $m \times n$ matrix and let $B$ be an $n \times p$ matrix. Prove that $AB$ can be written as a sum of at most $n$ matrices, each of which has rank 1.

I don't quite understand how this proof works:
Isn't $AB$ a $m \times p$ matrix? If so wouldn't you be able to write $AB$ as a sum of at most $p$ rank 1 matrices? 
i.e. $AB_{i1} + AB_{i2} + ... + AB_{ip}$? 

A:

$AB x= A \begin{bmatrix} B_{1 \bullet }x \\ \vdots \\ B_{n \bullet }x \end{bmatrix}  = \sum_k A_{\bullet k} B_{k \bullet }x = (\sum_k A_{\bullet k} B_{k \bullet })x$.
Hence $AB=\sum_k A_{\bullet k} B_{k \bullet }$.

