$\hat\beta = (X^T W X)^{-1} X^T W Y$, all the rest is commentary