Multiplication of Matrices & OLS Normal Equation Derivation

89 Views Asked by At

I found a derivation of the normal equation derivation and had a question about some of it:

Let $e$ be an $n \times 1$ vector of residual errors.

In that case:

$e'e = (y - X\hat{\beta})'(y - X\hat{\beta})$

$e'e = (y'y - \hat{\beta'}X'y - y'X\hat{\beta} + \hat{\beta'}X'X\hat{\beta}$

$e'e = y'y - 2\hat{\beta'}X'y + \hat{\beta'}X'X\hat{\beta}$

I can see that this is correct because $e'e$ should b4 a $1 \times 1$ scalar, and each term is a $1 \times 1$, however I would imagine that there is an easier way of getting this than guessing and checking what the order should be.

How is that done?