# Calculate Error Variance without exact information (OLS)

so the formula for calculating the error variance in the ols model is: $$σ^2=\frac{\hat{u}^T\hat{u}}{T-k}$$. That would be easy to calculate in a practical example, where I have all residuals numerically. Now I unfortunately have an exercise task where only the following is given the (demeaned) linear regression model: $$y_t = β_1 x_{t1} + β_2 x_{t2} + u_t$$ and the summarized cross products: $$\sum_{t=1}^{T} x^2_{t2}$$, $$\sum_{t=1}^{T} x_{t1} y_t$$, $$\sum_{t=1}^{T} x_{t2} y_t$$, $$\sum_{t=1}^{T} x^2_{t1}$$, $$\sum_{t=1}^{T} y^2_t$$, $$\sum_{t=1}^{T} x_{t1} x_{t2}$$ and T is also given.

Now my first step for calculationg $$σ^2$$ was: $$σ^2=\frac{\hat{u}^T\hat{u}}{T-k} = \frac{(y-X\hat{β})^T * (y-X\hat{β})}{T-k} = \frac{y^Ty-2\hat {\beta^T}X^Ty+\hat{\beta}X^TX\hat{\beta}}{T-k}$$ Is my approach correct? How do I proceed? I think you can set anything to zero in the last fraction, but I don't quite understand what and why.

Using the definition of inner product $$y^Ty =\overbrace{\sum_{t=1}^{T} y^2_t}^{\textsf{given}}$$ $$\hat {\beta^T}X^Ty = \hat{\beta}_1\overbrace{\sum_{t=1}^{T} x_{t1} y_t}^{\textsf{given}} + \hat{\beta}_2\overbrace{\sum_{t=1}^{T} x_{t2} y_t}^{\textsf{given}}$$
$$\hat{\beta}X^TX\hat{\beta} =\hat{\beta}_1\overbrace{\sum_{t=1}^{T} x_{t1} ^2 }^{\textsf{given}} + \hat{\beta}_2\overbrace{\sum_{t=1}^{T} x_{t2} ^2}^{\textsf{given}} + 2\hat{\beta}_1\hat{\beta}_2\overbrace{\sum_{t=1}^{T} x_{t1} x_{t2}}^{\textsf{given}}$$
and you should compute $$\hat{\beta}_1,\hat{\beta}_2$$ using OLS.