# Is the formula of VIF correct compared with partial correlation (variance)

For a variable $$x = (x_1,\cdots,x_n)$$ and its sample matrix $$X,$$ we know the partial correlation of $$x_i,x_j$$ is the correlation of their residuals respect to the left variables. And the precision matrix $$(X^TX)^{-1}$$ is just the partial covariance matrix of $$x.$$ Then the diagonal elements $$(X^TX)_{ii}^{-1}$$ is the $$x_i$$'s squared residual $$RSS_i.$$

On the other hand, we know the variance of linear regression estimation $$Var(\hat{\beta}_i) = s^2(X^TX)^{-1}_{ii}.$$ Therefore, the variance should be $$Var(\hat{\beta}_i) = s^2 RSS_i.$$

However in the discussion of VIF in wiki is:

https://en.wikipedia.org/wiki/Variance_inflation_factor

I don't where I am wrong. Actually I also don't understand the last step: $$RSS_j$$ should be

$$RSS_j = (X_j - X_{-j}\hat{\beta}_{*j})^T(X_j - X_{-j}\hat{\beta}_{*j}).$$

How to get

$$RSS_j = X^T_jX_j - (X_{-j}\hat{\beta}_{*j})^T(X_{-j}\hat{\beta}_{*j})?$$