Suppose we have a model $y_{i} = \beta_{0} + \beta_{1} x_{i1} + \beta_{2}x_{i2} + \epsilon_{i}$. Then I need to find a general expression for $\hat{\sigma}²(X^TX)^{-1}$.
My first thought was that we have a $3$x$3$ matrix. So simply compute the following:
$X^TX= \begin{pmatrix} 1 & \dots & 1\\ x_1 & \dots & x_1\\ x_2 & \dots & x_2 \end{pmatrix} \begin{pmatrix} 1 & x_1 & x_2\\ \vdots & \vdots & \vdots \\ 1 & x_1 & x_2 \end{pmatrix} = \begin{pmatrix} n & \sum x_i & \sum x_{j+1}\\ \sum x_i & \sum x_i^2 & \sum x_i x_{j+1} \\ \sum x_{j+1} & \sum x_{j+1} x_i & \sum x_{j+1}^{2} \end{pmatrix}_{i=j=1} = \begin{pmatrix} n & n\overline{x_1} & n \overline{x}_2\\ n \overline{x}_1 & \sum x_i^2 & n \overline{x}_1\overline{x}_2 \\ n \overline{x}_2 & n \overline{x}_2 x_1 & \sum x^2_{j+1} \end{pmatrix}_{i=j=1} $.
Then take the inverse with a very messy determinant. Is this the correct approach or is there any simpler/easier way to do this?