Does the following equation hold true in general?
$$ (a^Tb )^ 2 = (a^T b b^T a) $$
Where $a, b \in R^n$ are vectors of the same size n=1, 2, ...
I know it's true in n=1 and n=2 because I manually expanded it and verified it but I am not sure how to verify this for all n.
The reason for confusion is following: I know I can manipulate the RHS into
$$ a^Tb (a^Tb)^T $$
And if we define $u=a^Tb$, then
$$ u^2 = uu^T $$
But why does $u^2$ have to be the outer product? (as opposed to, say, inner product?)
The inner product $a^T b$ is a scalar. It is always the case $a^T b = b^T a$, by the definition of inner product (and commutative law of multiplication).
$$a^T b = \sum_j a_j b_j = \sum_j b_j a_j = b^T a.$$
So yes,
$$(a^T b)^2 = (a^Tb)(b^T a) = a^Tb b^T a.$$
Since $u = a^Tb$ is a scalar, $u^2 = u^T u = uu^T$.