Vector multiplication with transpose

3.2k Views Asked by At

I have the two vectors $X$ and $Q$. I want to calculate the following: $(X-Q)^T(X-Q)$.

This is what I get: $X^TX - X^TQ -Q^TX + Q^TQ $

The solutions state that this can be rewritten as: $X^TX - 2Q^TX + Q^TQ$

I can't see how that could be done, is it possible somehow?

2

There are 2 best solutions below

1
On BEST ANSWER

Notice that $X^T Q$ is an $1 \times 1$ matrix, and therefore $X^T Q = (X^T Q)^T = Q^T X$. Inserting this in your solution gives the desired result.

1
On

For two vectors $X,Q \in \mathbb R^n$, we have that $X^TQ$ is just another way to write down the scalar product of $X$ and $Q$: $$X^TQ=\langle X,Q \rangle = \sum_{i=1}^n x_i q_i.$$

From this sum, we see that the scalar product of two real vectors is symmetric: $X^TQ = \langle X,Q \rangle = \langle Q,X \rangle = Q^TX.$

If $X$ and $Q$ are complex vectors then we still have the algebraic identity $X^TQ = Q^TX, $ but this is expression is not the scalar product of $X$ and $Q$ anymore (and we cannot, e.g. expect $(X-Q)^T(X-Q)$ to be real, or nonnegative).