tonan6e

2022-09-07

How to multiply out brackets when they contain vectors
I am keen to know the general rule for any vector:
$\left(\mathbf{x}-\mathbf{y}\right)\left(\mathbf{x}-\mathbf{y}{\right)}^{T}$
How does it relate to $\left(x-y\right)\left(x-y\right)={x}^{2}-2xy+{y}^{2}$
Thanks for your help

### Answer & Explanation

Abigayle Lynn

To see why removing brackets is a bit different, you can remove them step by step:
$\left(\mathbf{x}-\mathbf{y}\right)\left(\mathbf{x}-\mathbf{y}{\right)}^{T}=\mathbf{x}\left(\mathbf{x}-\mathbf{y}{\right)}^{T}-\mathbf{y}\left(\mathbf{x}-\mathbf{y}{\right)}^{T}=\mathbf{x}{\mathbf{x}}^{T}-\mathbf{x}{\mathbf{y}}^{T}-\mathbf{y}{\mathbf{x}}^{T}-\mathbf{y}{\mathbf{y}}^{T}$
The result cannot be simplified any further, because unlike the scalar case, $\mathbf{x}{\mathbf{y}}^{T}\ne \mathbf{y}{\mathbf{x}}^{T}$

Deanna Gregory

EDIT/CAVEAT: I am interpreting the vectors as row vectors. Please see the other answer for interpreting the vectors as column vectors.
You're correct that you should treat it as the vector and its transpose. This is called an "inner product", or a "dot product". In the trivial case that the vectors are both scalars, it reduces to the formula you said. Otherwise, it becomes
$x{x}^{T}-x{y}^{T}-y{x}^{T}+y{y}^{T}$
$=|x{|}^{2}-2x\cdot y+|y{|}^{2}$

Do you have a similar question?

Recalculate according to your conditions!