Least squares as an orthogonal projection: the linear algebra and geometric view

Quick Overview

Asks for the geometric view of least squares as an orthogonal projection onto the column space of a matrix. Tests the orthogonality condition, the normal equations, projection matrix properties, the full rank assumption and numerically stable ways to compute the fit.

Least squares as an orthogonal projection: the linear algebra and geometric view

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Other

Explain the least squares method from a linear algebra perspective, focusing on its geometric interpretation such as projection. Take the problem of solving $Ax = b$ when $A$ has more rows than columns and no exact solution exists. ```hint Picture the reachable set As $x$ varies, which vectors can $Ax$ reach? Think about what the shortest error vector from $b$ to that set looks like. ``` ```hint Check uniqueness Ask what has to be true of the columns of $A$ for the best coefficients to be unique. ``` ### What a Strong Answer Covers - The column space of $A$ as the set of reachable vectors, and why an exact solution usually does not exist - The orthogonality condition on the residual and how it leads to the normal equations - The projection matrix and its properties - When the solution is unique and what happens when the columns of $A$ are dependent - How the solution is computed in practice and why ### Follow-up Questions - Why does forming $A^\top A$ hurt numerical accuracy, and how does a QR decomposition avoid it? - What does the projection view say about the residuals of a regression that includes an intercept? - How does the picture change for weighted least squares? - How does ordinary least squares differ geometrically from fitting a line with the first principal component?

Overview: Asks for the geometric view of least squares as an orthogonal projection onto the column space of a matrix. Tests the orthogonality condition, the normal equations, projection matrix properties, the full rank assumption and numerically stable ways to compute the fit.

PracHub logo
General
Nov 24, 2026
mediumData ScientistOtherStatistics & Math
0
0

Explain the least squares method from a linear algebra perspective, focusing on its geometric interpretation such as projection. Take the problem of solving Ax=bAx = b when AA has more rows than columns and no exact solution exists.

What a Strong Answer Covers Guidance

  • The column space of AA as the set of reachable vectors, and why an exact solution usually does not exist
  • The orthogonality condition on the residual and how it leads to the normal equations
  • The projection matrix and its properties
  • When the solution is unique and what happens when the columns of AA are dependent
  • How the solution is computed in practice and why

Follow-up Questions Guidance

  • Why does forming A⊤AA^\top A hurt numerical accuracy, and how does a QR decomposition avoid it?
  • What does the projection view say about the residuals of a regression that includes an intercept?
  • How does the picture change for weighted least squares?
  • How does ordinary least squares differ geometrically from fitting a line with the first principal component?