Design matrix and residual
Columns of A are known model components; entries of x are their unknown weights.[2]
Linear means linear in the parameters. Thus a quadratic curveβ0+β1t+β2t2 gives a linear least-squares problem when t-values are known. Residual r=b−Ax has b’s units and its squared sum has squared units. Mixed data units or weighting require an explicitly appropriate model rather than unqualified addition.[2]
Why the normal equations hold
Equivalently, Aᵀr=0:the residual is orthogonal to every model column.[1]
The quadratic objective is convex, so every normal-equation solution is a global minimizer. Full column rank makes AᵀA positive definite and the coefficients unique. Without that rank, different coefficients can give the same optimal fitted values. A minimum-norm choice is an extra convention, not automatically included in an ordinary inverse formula.[1]
Compute stably and separate statistical claims
Normal equations can amplify conditioning problems; QR avoids explicitly forming this product matrix.[1]
The algebraic minimization does not require normal errors. Confidence intervals, significance tests and unbiased-estimation claims need additional statistical assumptions. A small residual sum of squares proves neither causality nor reliable extrapolation. The existing regression calculator is the appropriate special case for a straight-line fit, not a new arbitrary matrix CAS.[2]
Two worked examples
Fit a line to three points
- Given
- A has rows(1,0),(1,1),(1,2), b=(1,2,2).
- Find
- Find intercept and slope.
Form the small normal equations.
Solve and evaluate residuals.
Result: The line is 7/6+t/2 and its residual sum of squares is 1/6.
Check: Both the residual sum andΣtiri vanish, so Aᵀr=0.
A single constant model column
- Given
- A=(1,1,1)ᵀ, b=(2,4,9).
- Find
- Find the best constant.
The normal equation reduces to one scalar.
Compute the three residuals.
Result: The minimum squared sum occurs at c=5.
Check: The mean minimizes squared deviations; residuals sum to zero.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Five exercises with solutions
Calculate · Foundation
Find the best constant for data 1,4,7.
Show hint
For a ones column, the solution is the mean.
Learning goal: Solve a simple normal equation.
Interpret · Application
What does Aᵀr=0 mean for a line with an intercept?
Show hint
The columns are 1 and input values ti.
Learning goal: Interpret residual orthogonality.
Show solution and calculation
It givesΣri=0 andΣtiri=0.
Residuals are orthogonal to both model directions, not individually zero.
Error analysis · Application
A has two identical ones columns. Are coefficients unique?
Show hint
Only the sum of the coefficients affects Ax.
Learning goal: Distinguish rank deficiency from arithmetic failure.
Show solution and calculation
No.
Column rank is 1 rather than 2; adding(t,−t) to an optimal pair leaves fitted values unchanged.
Rearrange · Application
What design row represents y=β0+β1t+β2t2 at t=3?
Show hint
Keep the unknown parameters linear.
Learning goal: Recognize linearity in the parameters.
Transfer · Challenge
Ifκ2(A)=104, what isκ2(AᵀA) for full column rank?
Show hint
The spectral condition number is squared.
Learning goal: Separate algebraic equivalence and numerical quality.
Show solution and calculation
κ2(AᵀA)=108, explaining why explicit normal equations can be more sensitive and QR is preferable.
Check your understanding with the formula’s reference test.
7 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Useful next steps
For a practical fitted line and its special calculation, see Linear Regression (Line of Best Fit).
Uniqueness depends on rank: Linear systems and matrix rank.
For constructing orthonormal model directions in QR, see Gram–Schmidt Orthogonalization.
Sources for this explanation
Quanta · Updated November 8, 2026
- Technical University of Munich, Numerical Methods, winter semester 2016: QR decomposition and least-squares problems (translated source label)
- NIST Engineering Statistics Handbook: Linear Least Squares Regression
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added the matrix objective, residual orthogonality, rank and QR limitations with exact DE/EN fits and exercises.
Cite this reference page
Quanta. Linear Least Squares. Updated November 8, 2026. https://quanta-study.de/en/formula-sheet/kleinste-quadrate-matrix
When citing a specific scientific statement, also cite the specialist source linked to that statement.