# Thread: Matrix (vector) multiplication

1. ## Matrix (vector) multiplication

Hi MHF,

Consider 2 vectors x and m with the same dimension. Is the following condition true?
$\displaystyle (x - m)(x - m)^T == xx^T - mm^T$

It has been a while since I did linear algebra so some help is much appreciated!

2. It is true. As x and m have the same dimension say pxq, simply multiply out each side of your equation, you should get pxp in both cases.

3. Originally Posted by ikkuh
Consider 2 vectors x and m with the same dimension. Is the following condition true?
$\displaystyle (x - m)(x - m)^T == xx^T - mm^T$
It is quite possible that I have misread your post.
But I do not agree that it is true.
Consider: $\displaystyle M=<-2,4>~\&~X=<3,-6>$.
Is that a counter-example?

4. The dimensions of the solutions may be the same, maybe not the solution itself.

5. Originally Posted by pickslides
The dimensions of the solutions may be the same, maybe not the solution itself.
That is exactly what I was thinking. Unfortunately problem I need to solve is this:
$\displaystyle S = \frac{1}{n-1}\sum\limits_{i=1}^n ({\bf x}_i - {\bf m})({\bf x}_i - {\bf m})^T$ where
$\displaystyle {\bf m} = \frac{1}{n}\sum\limits_{i=1}^n x_i$
Prove that the expression for the covariance matrix (above) can be rewritten as:
$\displaystyle S = \frac{(\sum\limits_{i=1}^n {\bf x}_i {\bf x}_i^T) - n {\bf m}{\bf m}^t }{n-1}$

I might have split the question wrong before. Anyone who sees now how you can rewrite the expression?