Linear Regression Slope and Intercept (Least Squares)
Fitting a straight line through scattered data is one of the most widely used tools in engineering analysis — calibrating a sensor, trending a wear rate, or relating two measured quantities. Least squares finds the line that minimizes the total squared vertical distance from every point to the line, which has a simple closed-form solution built entirely from sums.Because the slope and intercept come directly from sums of x, y, xy, and x², the calculation is transparent and reproducible by hand — useful for verifying what a spreadsheet or software package reports, and for understanding how a single outlier point can skew a fit disproportionately.
The least-squares slope is b = (nΣxy − ΣxΣy)/(nΣx² − (Σx)²) and the intercept is a = (Σy − bΣx)/n. where x_1r…x_4r and y_1r…y_4r are the paired data points, n_r is the number of points, b_slope is the fitted slope, and a_int is the fitted intercept.
Sum the x-values; this and the following sums are the only building blocks the least-squares formulas need.
Sum the pairwise products x·y — this captures how x and y vary together.
Sum the squared x-values, needed to normalize the spread of x.
Combine the sums into the closed-form least-squares slope.
With the slope known, the intercept follows from forcing the line through the mean of the data.
Results
The fitted slope of about 2.3 says y increases roughly 2.3 units for each unit increase in x, and the small intercept means the line passes close to the origin. In practice you would also check the residuals (actual minus predicted y) to confirm the linear model is appropriate before trusting extrapolation beyond the observed x-range. A correlation coefficient or R² would quantify how tightly the points hug this line.