Skip to content
S3U
Login Create Account

Math / Algebra / Undergraduate / mld01

Least Squares as an Orthogonal Projection

Derive a fitted constant and connect residuals to the normal equations.

All worksheets
5 questions0m 0s

Prerequisites

Vectors, dot products, matrix transposes, and derivatives of quadratics.

Learn first

An observation and its model prediction

A model prediction is an expected value under a stated rule. A residual records the difference between an observed value and the prediction.

How to work it out When the requested convention is observed minus predicted, subtract the model prediction from the observation. A residual can be positive, zero, or negative.

A separate example For a separate observation of 17 with prediction 20, the residual is 17 − 20 = −3. The sign shows the observation is below the prediction.

Powers and exponents

An exponent tells how many equal factors are multiplied. A square uses two factors; a cube uses three. An exponent does not mean multiply the base by the exponent.

How to work it out For powers with the same base, multiplication adds exponents. Apply parentheses and exponents before ordinary multiplication and addition.

A separate example In a separate example, 3⁴ = 3 × 3 × 3 × 3. Also 3² × 3⁴ = 3⁶ because there are six factors of 3.

Letters stand for numbers

A variable is a letter standing for a number. An expression describes a calculation. An equation says two expressions are equal. A solution makes the equation true.

How to work it out Substitute given values into expressions. To solve an equation, undo operations while doing the same thing to both sides. Check by substitution.

A separate example For the separate equation 4x + 1 = 21, subtract 1 from both sides, then divide by 4. Checking x = 5 gives 21 on both sides.

Learn the skill

Minimize the squared residual norm ||Ax - b||^2. Differentiating gives A^T(Ax - b) = 0: the residual is orthogonal to the column space. Full column rank gives a unique coefficient vector; a fitted vector can remain unique without unique coefficients.

Worked example

For b = (1, 5) and A = (1, 1)^T, the best constant is 3. The residual b - Ax = (-2, 2) sums to zero, so it is perpendicular to A.

Two observed values are one and five. The best constant fit is three. Residuals relative to three are minus two and plus two, summing to zero.
For a constant least-squares fit, residuals sum to zero; the fitted value here is three.

Model and Assumptions

Fit one constant x to invented observations b = (1, 2, 6). A is a three-by-one column of ones. Give all observations equal weight and define the residual as r = b - Ax.

Question 1 What fitted constant minimizes the squared error?
Question 2 What is the sum of the three residuals at that fit?
Question 3 What is the minimized sum of squared residuals?
Question 4 Which condition characterizes a least-squares fit?
Question 5 If A has dependent columns, what can still be unique?

Further inquiry

Derive the normal equations for a general real matrix. Then replace A with two identical columns of ones: describe all minimizing coefficient pairs and prove that their fitted vectors agree.

Review criteria

  • Differentiate or complete the square explicitly.
  • Give the coefficient family and identify its null direction.
  • Distinguish uniqueness of the projection from uniqueness of coefficients.