In my econometrics textbook, I have this step which is not clear to me:
\begin{align} S &= e'e \\ &= (y-W\beta)'(y-W\beta) \\ &= \underbrace{y'}_{1\times T} \ \underbrace{y}_{T\times 1} -\underbrace{y'}_{1\times T} \ \underbrace{W\beta}_{(T\times2)(2\times1)} -\underbrace{\beta'W'y}_{(1\times2)(2\times T)(T\times1)} +\underbrace{\beta'W'W\beta}_{1\times1}, \end{align} or, since all the terms are scalars, $$S =y'y -2\beta'W'y +\beta'W'W\beta. \tag{2.5.6}$$
Basically, I don't understand how we go from $-y'W\beta -\beta'W'y$ to $-2\beta'W'y'$.
Apparently, $-y'W\beta$ is the same as its transpose, how so?
Thanks in advance.
By transposition of the product,
$$(y'W\beta)'=\beta'W'y.$$
But as this expression is a scalar (a $1\times1$ matrix),
$$y'W\beta=(y'W\beta)'=\beta'W'y.$$