Why does the least-squares line pass through the mean point, and when does it not?

I keep seeing that the least-squares line of best fit always goes through (x̄, ȳ). I accept it algebraically, but I don’t have a good intuition for it. Is this guaranteed whenever we regress y on x with an intercept? What changes if I (1) force the line through the origin, (2) minimize absolute vertical deviations instead of squares, or (3) use perpendicular distances (orthogonal regression)? I’d like a clear statement of the exact conditions so I know when to expect the line to pass through the mean point.

3 Responses

  1. A nice way to feel this is to imagine you can slide your candidate line straight up and down while keeping its slope fixed. With ordinary least squares (minimizing squared vertical residuals) and an intercept, the best intercept is exactly the one that makes the residuals average to zero. Algebraically that’s the normal equation ∑r_i = 0, which is equivalent to a + b x̄ = ȳ. Geometrically, if the line sat above or below the mean point, nudging it toward (x̄, ȳ) would reduce the sum of squared residuals-so the optimum must pass through the centroid. This stays true even if you fix the slope ahead of time and just fit the intercept, and in the weighted case it passes through the weighted centroid (x̄_w, ȳ_w).

    When does it not? If you force the line through the origin (no intercept), you lose the “slide it up/down” freedom, so there’s no requirement that ∑r_i = 0, and the fit generally won’t go through (x̄, ȳ) unless by coincidence ȳ = b x̄ (with b = ∑x_i y_i / ∑x_i^2). If you minimize absolute vertical deviations (L1), the balancing condition is about medians, not means: the fit need not satisfy a + b x̄ = ȳ, so it typically misses the centroid. On the other hand, if you minimize squared perpendicular distances (orthogonal regression/total least squares) with a free intercept, the best line is the first principal-component line, and it always goes through the data centroid (and through the weighted centroid if you use weights).

    Does a short “slide-the-line” proof or a small numeric example for the LAD case sound helpful? Also, are you working with any weights or constraints in your setting?

  2. Neat fact: with ordinary least squares and an intercept, you’re orthogonally projecting y onto span{1, x}, which preserves the mean-so residuals sum to zero and b0 = ȳ − b1 x̄, forcing the line through (x̄, ȳ). If you (1) force the origin, it generally won’t hit (x̄, ȳ); (2) minimize absolute vertical deviations, there’s no mean-preservation so it needn’t pass through (x̄, ȳ); (3) use perpendicular distances (orthogonal/TLS) with an intercept, it again passes through the centroid (and through the origin if intercept is omitted)-barring odd degeneracies, I think.

  3. I always picture the least‑squares line like a seesaw trying to balance a bunch of little weights: with an intercept, OLS makes the positive and negative vertical residuals “balance out” so perfectly that their total is zero and, even more, the x‑weighted residuals also balance to zero-so the plank has to pass right through the data’s center of mass (x̄, ȳ). That’s why, yes, in ordinary (unweighted) regression of y on x with an intercept, the line must cross (x̄, ȳ); with weights, it passes through the weighted mean instead. If you force the line through the origin, you remove that balancing freedom from the intercept: the line is pinned at (0,0) and in general it won’t hit (x̄, ȳ) unless a special coincidence holds (roughly, ȳ = b x̄, or the centroid happens to be at the origin). If you minimize absolute vertical deviations (L1/LAD), the “balance” condition changes: the optimal line makes as many points above as below in a sign sense, but that doesn’t force it through (x̄, ȳ)-so typically it won’t. For perpendicular distances (orthogonal regression/total least squares), the same center‑of‑mass story comes back, just in 2D: the best‑fit line is the first principal component and it must pass through the centroid (x̄, ȳ) (again, weighted versions go through the weighted centroid). I’m pretty sure I’ve got those cases right, though I may be a tad hand‑wavy about the LAD intuition; this Khan Academy piece on least‑squares and residuals gives the core “why the mean point” idea: https://www.khanacademy.org/math/statistics-probability/describing-relationships-quantitative-data/regression-library/a/least-squares-regression-line

Leave a Reply

Your email address will not be published. Required fields are marked *

Join Our Community

Ready to make maths more enjoyable, accessible, and fun? Join a friendly community where you can explore puzzles, ask questions, track your progress, and learn at your own pace.

By becoming a member, you unlock:

  • Access to all community puzzles
  • The Forum for asking and answering questions
  • Your personal dashboard with points & achievements
  • A supportive space built for every level of learner
  • New features and updates as the Hub grows