Work out least squares line instantly with clear inputs, formula shown and shareable results.
The least squares line minimises the sum of squared vertical residuals. Its slope is Σ(x−x̄)(y−ȳ)/Σ(x−x̄)², and it always passes through the point of means (x̄, ȳ).
Least squares slope
b = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)²
Intercept
a = ȳ − b·x̄
The slope is 0.6 and the intercept 2.2, giving y = 0.6x + 2.2 and a prediction of 5.8 at x = 6.
Squaring makes the problem differentiable with a unique closed-form solution, and it penalises large misses more heavily.