In my notes I have the following representation:
$(a+\beta'X)^2$
where $a$ is a constant and both $\beta$ and $X$ are k by 1 vectors.
The representation is further written as follows:
$a^2+2a\beta'X+X'\beta \beta'X)$
While the first part is clear to me, I struggle to understand why it is shown once with $'$ ($X'$ and $\beta'$) and once without $'$ ($X$ and $\beta$).
$'$ here denotes the transpose vector. Since both $\beta$ and $X$ are $k\times 1$ vectors, $\beta' X$ is a scalar, so $\beta'X = (\beta'X)' = X'\beta$, and $$ (\beta'X)^2 = (\beta'X)(\beta'X) = X'\beta\beta'X. $$