Solution
= Solution
The <weighted least squares> objective is
$$
Q(b)=(Y-Xb)^TW(Y-Xb).
$$
Its gradient is
$$
\nabla_bQ(b)=-2X^TW(Y-Xb).
$$
Since $W$ is positive diagonal and $X$ has full column rank, $X^TWX$ is positive definite. The unique stationary point is therefore the unique minimizer:
$$
\boxed{\operatorname*{arg\,min}_{b\in\mathbb R^p}Q(b)
=(X^TWX)^{-1}X^TWY}.
$$