∑GATE DA Atlas

Projections, Least Squares and Quadratic Forms

Orthogonal projection onto a line and onto a subspace, projection matrices and their properties, least squares and the normal equations, distance to a subspace, quadratic forms and their symmetric matrices, definiteness tests (eigenvalues, leading minors), the Rayleigh quotient, and diagonalising a quadratic form by a change of variables.

Section 29 practice questions

Projection onto a line

The closest point to b\mathbf b on the line through a\mathbf a is the orthogonal projection

p=a⊤ba⊤a a=Pb,P=aa⊤a⊤a.\mathbf p = \frac{\mathbf a^\top\mathbf b}{\mathbf a^\top\mathbf a}\,\mathbf a = P\mathbf b, \qquad P = \frac{\mathbf a\mathbf a^\top}{\mathbf a^\top\mathbf a}.

The error e=b−p\mathbf e = \mathbf b - \mathbf p is perpendicular to a\mathbf a. PP is a rank-1, symmetric, idempotent matrix.

a b p = Pb e = b − p e ⟂ a: the projection is the closest point on the line
Projection decomposes b into a part along a and a part perpendicular to it.

Projection onto a subspace

For a subspace W=C(A)W = C(A) where AA has independent columns:

x^=(A⊤A)−1A⊤b,p=Ax^=Pb,P=A(A⊤A)−1A⊤.\hat{\mathbf x} = (A^\top A)^{-1}A^\top\mathbf b, \qquad \mathbf p = A\hat{\mathbf x} = P\mathbf b, \qquad P = A(A^\top A)^{-1}A^\top.

If the columns are orthonormal (A=QA = Q), this simplifies to P=QQ⊤P = QQ^\top and p=∑i(qi⊤b)qi\mathbf p = \sum_i(\mathbf q_i^\top\mathbf b)\mathbf q_i.

Properties of an orthogonal projection matrix PP onto WW:

Property
IdempotentP2=PP^2 = P (projecting twice changes nothing)
SymmetricP⊤=PP^\top = P
Eigenvalues1 on WW, 0 on W⊥W^\perp
Rank=trace⁡=dim⁡W= \operatorname{trace} = \dim W
ComplementI−PI - P projects onto W⊥W^\perp
Best approximation∥b−Pb∥≤∥b−w∥\lVert\mathbf b - P\mathbf b\rVert \le \lVert\mathbf b - \mathbf w\rVert for all w∈W\mathbf w \in W

Least squares

When Ax=bA\mathbf x = \mathbf b has no solution (more equations than unknowns), choose x^\hat{\mathbf x} to minimise ∥Ax−b∥2\lVert A\mathbf x - \mathbf b\rVert^2. The minimiser makes the residual orthogonal to every column of AA:

A⊤(b−Ax^)=0⟺A⊤A x^=A⊤b(normal equations).A^\top(\mathbf b - A\hat{\mathbf x}) = \mathbf 0 \quad\Longleftrightarrow\quad A^\top A\,\hat{\mathbf x} = A^\top\mathbf b \quad\text{(normal equations)}.

This is exactly linear regression: β^=(X⊤X)−1X⊤y\hat{\boldsymbol\beta} = (X^\top X)^{-1}X^\top\mathbf y, fitted values HyH\mathbf y, residuals (I−H)y(I - H)\mathbf y.

Numerically, solving via QR (Rx^=Q⊤bR\hat{\mathbf x} = Q^\top\mathbf b) or the SVD is more stable than forming A⊤AA^\top A, which squares the condition number.

Quadratic forms

A quadratic form is Q(x)=x⊤Ax=∑i,jaijxixjQ(\mathbf x) = \mathbf x^\top A\mathbf x = \sum_{i,j}a_{ij}x_ix_j with AA symmetric (any matrix can be replaced by its symmetric part without changing QQ).

Reading off the matrix: the coefficient of xi2x_i^2 goes on the diagonal; half the coefficient of xixjx_ix_j goes in each of positions (i,j)(i,j) and (j,i)(j,i).

2x12+6x1x2−x22+4x2x3  ⟷  (2303−12020).2x_1^2 + 6x_1x_2 - x_2^2 + 4x_2x_3 \;\longleftrightarrow\; \begin{pmatrix}2&3&0\\3&-1&2\\0&2&0\end{pmatrix}.

Definiteness

TypeCondition on Q(x)Q(\mathbf x)Eigenvalues of AA
Positive definite>0> 0 for all x≠0\mathbf x \ne 0all >0> 0
Positive semi-definite≥0\ge 0all ≥0\ge 0
Negative definite<0< 0 for x≠0\mathbf x \ne 0all <0< 0
Indefinitetakes both signssome >0> 0, some <0< 0

Sylvester's criterion: AA is positive definite iff all leading principal minors are positive. For 2×22\times 2: a>0a > 0 and ac−b2>0ac - b^2 > 0. Negative definite iff the leading minors alternate in sign starting negative.

Equivalent characterisations of positive definiteness: all eigenvalues positive; A=R⊤RA = R^\top R with RR invertible (Cholesky A=LL⊤A = LL^\top exists); all pivots positive. Covariance matrices, Gram matrices X⊤XX^\top X and kernel matrices are positive semi-definite.

Rayleigh quotient

For symmetric AA with eigenvalues λmin⁡≤⋯≤λmax⁡\lambda_{\min} \le \dots \le \lambda_{\max}:

λmin⁡≤x⊤Axx⊤x≤λmax⁡,\lambda_{\min} \le \frac{\mathbf x^\top A\mathbf x}{\mathbf x^\top\mathbf x} \le \lambda_{\max},

with equality at the corresponding eigenvectors. This is why the first principal component (direction of maximum variance) is the top eigenvector of the covariance matrix.

Principal axes

With A=QΛQ⊤A = Q\Lambda Q^\top and new coordinates y=Q⊤x\mathbf y = Q^\top\mathbf x, the cross terms disappear:

x⊤Ax=y⊤Λy=λ1y12+⋯+λnyn2.\mathbf x^\top A\mathbf x = \mathbf y^\top\Lambda\mathbf y = \lambda_1y_1^2 + \dots + \lambda_ny_n^2.

The level set x⊤Ax=1\mathbf x^\top A\mathbf x = 1 of a positive definite form is an ellipsoid with axes along the eigenvectors and semi-axis lengths 1/λi1/\sqrt{\lambda_i}.

Quick revision

Practice questions

GATE-style questions: 4 one-mark and 5 two-mark. Wrong MCQs cost ⅓ of their marks in the real exam; MSQ and NAT have no negative marking. Attempt each before opening the solution.

Q1NAT1 mark

The orthogonal projection of b=(2,3)\mathbf b = (2, 3) onto the line spanned by a=(1,1)\mathbf a = (1, 1) is (p1,p2)(p_1, p_2). The value of p1p_1 is ______.

Q2NAT2 marks

The least-squares line y=c+mxy = c + mx through the points (0,1)(0, 1), (1,3)(1, 3) and (2,4)(2, 4) has slope m=m = ______.

Q3MCQ1 mark

The quadratic form Q(x,y)=x2+4xy+y2Q(x, y) = x^2 + 4xy + y^2 is

Q4NAT2 marks

The maximum value of x⊤Ax\mathbf x^\top A\mathbf x over unit vectors x∈R2\mathbf x \in \mathbb R^2, where A=(2112)A = \begin{pmatrix}2&1\\1&2\end{pmatrix}, is ______.

Q5MSQ2 marks

PP is the orthogonal projection matrix onto a subspace WW of Rn\mathbb R^n with 0<dim⁡W<n0 < \dim W < n. Which statements are true?

One or more options are correct.

Q6NAT2 marks

The largest integer kk for which (2kk8)\begin{pmatrix}2 & k\\k & 8\end{pmatrix} is positive definite is ______.

Q7NAT2 marks

The distance from the point (1,2,3)(1, 2, 3) to the plane x+y+z=0x + y + z = 0 is ______ (round to two decimals).

Q8NAT1 mark

The quadratic form 3x2−2xy+5y23x^2 - 2xy + 5y^2 is written as x⊤Ax\mathbf x^\top A\mathbf x with AA symmetric. The entry a12a_{12} is ______.

Q9MCQ1 mark

For an m×nm\times n matrix AA with linearly independent columns, the least-squares solution of Ax≈bA\mathbf x \approx \mathbf b satisfies