# Econometric Theory/Normal Equations Proof

Below is the proof of the Normal Equations for OLS.

The goal of OLS is to minimize the sum of squared error terms to find the best fit, also called the Residual Sum of Squares (RSS). This is denoted by ${\displaystyle \sum {\hat {\epsilon _{i}}}^{2}}$.

Known: ${\displaystyle {\hat {\epsilon _{i}}}=Y_{i}-{\hat {Y_{i}}}=Y_{i}-\alpha -\beta X_{i}}$

RSS = ${\displaystyle \sum {\hat {\epsilon _{i}}}^{2}}$ =

${\displaystyle =\sum (Y_{i}-{\hat {Y_{i}}})^{2}}$

${\displaystyle =\sum (Y_{i}-{\hat {\alpha }}-{\hat {\beta }}X_{i})^{2}}$

# Differentiate the RSS (so that we can then minimise it)

${\displaystyle min_{\alpha }\sum {\hat {\epsilon _{i}}}^{2}}$ =

${\displaystyle {\frac {\partial \sum {\hat {\epsilon _{i}}}^{2}}{\partial {\hat {\alpha }}}}=\sum 2{\hat {\epsilon _{i}}}{\frac {\partial {\hat {\epsilon _{i}}}}{\partial {\hat {\alpha }}}}=2\sum {\hat {\epsilon _{i}}}(-1)=2\sum (Y_{i}-{\hat {\alpha }}-{\hat {\beta }}X_{i})(-1)=0}$

${\displaystyle min_{\beta }\sum {\hat {\epsilon _{i}}}^{2}}$ =

${\displaystyle {\frac {\partial \sum {\hat {\epsilon _{i}}}^{2}}{\partial {\hat {\beta }}}}=\sum 2{\hat {\epsilon _{i}}}{\frac {\partial {\hat {\epsilon _{i}}}}{\partial {\hat {\beta }}}}=2\sum {\hat {\epsilon _{i}}}(-X_{i})=2\sum (Y_{i}-{\hat {\alpha }}-{\hat {\beta }}X_{i})(-X_{i})=0}$

So we have two equations:

${\displaystyle \sum (Y_{i}-{\hat {\alpha }}-{\hat {\beta }}X_{i})(-1)=0}$

and

${\displaystyle \sum (Y_{i}-{\hat {\alpha }}-{\hat {\beta }}X_{i})(-X_{i})=0}$ (The two(2) here is divided from both sides)

setting them both equal to ${\displaystyle \sum Y_{i}}$

We get

${\displaystyle \sum Y_{i}=n{\hat {\alpha }}+{\hat {\beta }}\sum X_{i}}$ (This is the first OLS Normal Equation)

and

${\displaystyle \sum Y_{i}X_{i}={\hat {\alpha }}\sum X_{i}+{\hat {\beta }}\sum X_{i}^{2}}$ (This is the second OLS Normal Equation)

# Solve the Normal Equations

Divide the first equation by n

${\displaystyle {\frac {1}{n}}\sum Y_{i}={\hat {\alpha }}+{\frac {1}{n}}{\hat {\beta }}\sum X_{i}}$

Leaves us with ${\displaystyle \left(\sum W_{i}{\frac {1}{n}}={\bar {W}}\right)}$

${\displaystyle {\bar {Y}}={\hat {\alpha }}+{\hat {\beta }}{\bar {X}}\Leftrightarrow {\hat {\alpha }}={\bar {Y}}-{\hat {\beta }}{\bar {X}}}$

Now we know how to get α(hat), we can work on β(hat)

${\displaystyle \sum Y_{i}X_{i}={\hat {\alpha }}\sum X_{i}+{\hat {\beta }}\sum X_{i}^{2}=[{\bar {Y}}-{\hat {\beta }}{\bar {X}}]\sum X_{i}+{\hat {\beta }}\sum X_{i}^{2}=[{\frac {(\sum X_{i})(\sum Y_{i})}{n}}]+{\hat {\beta }}[\sum X_{i}^{2}-{\frac {(\sum X_{i})^{2}}{n}}]}$

We can move β(hat) to one side

${\displaystyle {\hat {\beta }}={\frac {\sum Y_{i}X_{i}-{\frac {(\sum X_{i})(\sum Y_{i})}{n}}}{\sum X_{i}^{2}-{\frac {(\sum X_{i})^{2}}{n}}}}={\frac {\sum (x_{i}-{\bar {x}})(y_{i}-{\bar {y}})}{\sum (x_{i}-{\bar {x}})^{2}}}}$

- n \bar{X} \bar{Y}

And now we have our Normal equations for OLS.

Since we have two equations and two unknowns, we are able to solve for them (${\displaystyle {\hat {\alpha }},{\hat {\beta }}}$).