This wiki page Simple linear regression has formulas to calculate α and β. Could anyone tell me how to derive the formulas in weighted case?

**Answer**

Think of ordinary least squares (OLS) as a “black box” to minimize

n∑i=1(yi−(α1+βxi))2

for a data table whose ith row is the tuple (1,xi,yi).

When there are weights, necessarily positive, we can write them as w2i. By definition, weighted least squares minimizes

n∑i=1w2i(yi−(α1+βxi))2

=n∑i=1(wiyi−(αwi+βwixi))2.

But that’s exactly what the OLS black box is minimizing when given the data table consisting of the “weighted” tuples (wi,wixi,wiyi). So, **applying the OLS formulas to these weighted tuples gives the formulas you seek.**

**Attribution***Source : Link , Question Author : Wei Shi , Answer Author : whuber*