What is an idempotent matrix, what are its possible eigenvalues, and how do you construct the orthogonal projection matrix P onto the column space of a full-column-rank matrix X∈Rn×d and show that tr⁡(P)=d?

Linear algebra and optimisation, Projections and idempotent matrices
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you connect idempotence (P2=P) to projections, eigenvalue constraints, and the trace–rank identity used in regression degrees of freedom.

Key idea

Projecting twice changes nothing, so P2=P, forcing every eigenvalue to satisfy λ2=λ (hence λ∈{0,1}); for P=X(X⊤X)−1X⊤, the cyclic property of trace collapses X⊤X with (X⊤X)−1 to give tr⁡(P)=tr⁡(Id)=d.

Steps

  1. Define idempotence: a square matrix P is idempotent if P2=P. If Pv=λv with v≠0, then λv=Pv=P2v=λ2v, so λ(λ−1)=0 and every eigenvalue is either 0 or 1.
  2. Derive the orthogonal projection onto C(X): for any y∈Rn, the closest point y^=Xw^ makes the residual y−Xw^ orthogonal to every column of X, meaning X⊤(y−Xw^)=0.
  3. Solve for w^=(X⊤X)−1X⊤y (invertible because X has full column rank d), giving y^=Py with P=X(X⊤X)−1X⊤.
  4. Verify that P is symmetric (P⊤=P) and idempotent (P2=X(X⊤X)−1(X⊤X)(X⊤X)−1X⊤=P).
  5. Compute the trace via the cyclic property tr⁡(AB)=tr⁡(BA): tr⁡(P)=tr⁡(X(X⊤X)−1X⊤)=tr⁡((X⊤X)−1X⊤X)=tr⁡(Id)=d, which also equals rank⁡(P) since all non-zero eigenvalues equal 1.

Common mistakes

How long your answer should be

Half a page; 4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Linear algebra and optimisation: Using the Gram–Schmidt process, how do you turn the columns of A=(110101011) into an orthonormal basis, and how do you write the resulting QR factorisation?
Next in Linear algebra and optimisation: For which values of c is the symmetric matrix A=(42025202c) positive definite by Sylvester's criterion, and what is its Cholesky factorisation A=LL⊤ when c=5?