# Why is the weight matrix diagonal in weighted least squares regression?

I was going through the theory for weighted least-squares fitting and I understood its basic underlying concepts, but I couldn't understand why exactly do we keep the weights as a diagonal matrix during calculations.

This might be a dumb question but I don't have much experience with matrices and I am in the process of using them to solve more real-world problems so any input will be helpful.

• Perhaps you could provide more details? – Yuval Filmus Oct 4 at 19:07
• Also, the weight matrix probably represents weights of points. If you have $n$ points, these are $n$ values. We put them in a diagonal matrix since doing so allows us to write some formulas in a succinct way. – Yuval Filmus Oct 4 at 19:08