Level 5 — MasteryLinear Algebra Essentials

Linear Algebra Essentials

90 minutes60 marksprintable — key stays hidden on paper

Level 5 — Mastery (cross-domain: math + physics + coding, build/prove) Time limit: 90 minutes Total marks: 60

Instructions: Answer all three questions. Show all reasoning. Proofs must be rigorous; code may be written in NumPy-style pseudocode but must be dimensionally correct and executable in spirit.


Question 1 — Spectral theory and positive definiteness (20 marks)

Let ARn×nA \in \mathbb{R}^{n\times n} be symmetric, and consider the quadratic form q(x)=xAxq(x) = x^\top A x.

(a) Prove that every eigenvalue of a real symmetric matrix is real, and that eigenvectors corresponding to distinct eigenvalues are orthogonal. (6 marks)

(b) Using the eigendecomposition A=QΛQA = Q\Lambda Q^\top (with QQ orthogonal), prove that AA is positive definite if and only if all eigenvalues λi>0\lambda_i > 0. (5 marks)

(c) Consider the specific matrix A=(210121012).A = \begin{pmatrix} 2 & -1 & 0 \\ -1 & 2 & -1 \\ 0 & -1 & 2 \end{pmatrix}. Compute its eigenvalues. Determine whether AA is positive definite, and state the minimum value of q(x)q(x) subject to x2=1\|x\|_2 = 1 (justify via the Rayleigh quotient). (6 marks)

(d) Physics link: AA above models the stiffness matrix of three masses connected by springs (spring constant 1) with fixed walls. Explain in one or two sentences what positive definiteness guarantees physically about the equilibrium. (3 marks)


Question 2 — SVD, rank, and least squares (22 marks)

Let M=(101011112).M = \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 1 & 1 & 2 \end{pmatrix}.

(a) Compute rank(M)\operatorname{rank}(M) and give an explicit basis for its column space and its null space. (6 marks)

(b) Prove that for any real matrix MM, the nonzero singular values of MM are the square roots of the nonzero eigenvalues of MMM^\top M, and that rank(M)=\operatorname{rank}(M) = number of nonzero singular values. (6 marks)

(c) Compute the singular values of MM above (you may leave them as exact surds or 4-decimal numbers). (5 marks)

(d) Coding/derivation: Write NumPy-style pseudocode that, given a full SVD M=UΣVM = U\Sigma V^\top and a vector bb, returns the minimum-norm least-squares solution to MxbMx \approx b using the pseudoinverse. Explain why truncating tiny singular values (below tolerance ε\varepsilon) improves numerical stability, referencing the condition number. (5 marks)


Question 3 — Trace, orthogonality, and a build/prove synthesis (18 marks)

(a) Prove the cyclic property of the trace: tr(ABC)=tr(BCA)=tr(CAB)\operatorname{tr}(ABC) = \operatorname{tr}(BCA) = \operatorname{tr}(CAB) for conformable matrices, starting from tr(XY)=tr(YX)\operatorname{tr}(XY)=\operatorname{tr}(YX). (5 marks)

(b) Show that for any matrix AA, tr(AA)=i,jAij2=AF2=kσk2\operatorname{tr}(A^\top A) = \sum_{i,j} A_{ij}^2 = \|A\|_F^2 = \sum_k \sigma_k^2, where σk\sigma_k are singular values. (5 marks)

(c) Build/prove: Let QQ be orthogonal. Prove that QQ preserves the L2L_2 norm (Qx2=x2\|Qx\|_2 = \|x\|_2) and preserves dot products. Then prove det(Q)=±1\det(Q) = \pm 1 and tr(QQ)=n\operatorname{tr}(Q^\top Q) = n. (8 marks)


Answer keyMark scheme & solutions

Question 1

(a) [6 marks] Let Ax=λxAx=\lambda x, x0x\neq0. Take conjugate transpose: xA=λˉxx^* A = \bar\lambda x^* (using AA real symmetric so A=AA^*=A). Then xAx=λxx,xAx=λˉxx.x^*Ax = \lambda x^*x, \qquad x^*Ax = \bar\lambda x^*x. Since xx=x2>0x^*x=\|x\|^2>0, λ=λˉ\lambda=\bar\lambda, so λR\lambda\in\mathbb{R}. (3) For distinct eigenvalues λiλj\lambda_i\neq\lambda_j with Axi=λixiAx_i=\lambda_i x_i, Axj=λjxjAx_j=\lambda_j x_j: λi(xixj)=(Axi)xj=xiAxj=λj(xixj).\lambda_i (x_i^\top x_j) = (Ax_i)^\top x_j = x_i^\top A x_j = \lambda_j (x_i^\top x_j). So (λiλj)xixj=0xixj=0(\lambda_i-\lambda_j)x_i^\top x_j=0 \Rightarrow x_i^\top x_j=0. (3)

(b) [5 marks] q(x)=xAx=xQΛQx=yΛy=iλiyi2q(x)=x^\top A x = x^\top Q\Lambda Q^\top x = y^\top\Lambda y=\sum_i\lambda_i y_i^2 where y=Qxy=Q^\top x. (2) Since QQ is orthogonal (invertible), x0    y0x\neq0 \iff y\neq0. (\Leftarrow) If all λi>0\lambda_i>0, then λiyi2>0\sum\lambda_i y_i^2>0 for y0y\neq0 ⇒ PD. (1.5) (\Rightarrow) If some λk0\lambda_k\le0, choose y=eky=e_k (i.e. x=Qekx=Qe_k, the eigenvector), giving q=λk0q=\lambda_k\le0 ⇒ not PD. Contrapositive complete. (1.5)

(c) [6 marks] Characteristic polynomial of the tridiagonal [2,1][2,-1] matrix (size 3): eigenvalues are 22coskπ42-2\cos\frac{k\pi}{4}, k=1,2,3k=1,2,3: λ1=220.5858,λ2=2,λ3=2+23.4142.\lambda_1 = 2-\sqrt2 \approx 0.5858,\quad \lambda_2=2,\quad \lambda_3=2+\sqrt2\approx3.4142. (3) All positive ⇒ AA is positive definite. (1) By the Rayleigh quotient, minx2=1xAx=λmin=22\min_{\|x\|_2=1} x^\top A x = \lambda_{\min} = 2-\sqrt2, attained at the corresponding unit eigenvector. (2)

(d) [3 marks] Positive definiteness means the potential energy 12xAx\tfrac12 x^\top A x is strictly positive for any nonzero displacement, so the equilibrium at x=0x=0 is a strict energy minimum — the system is stable; any displacement raises the elastic energy and produces restoring forces. (3)


Question 2

(a) [6 marks] Row 3 = Row 1 + Row 2, and column 3 = column 1 + column 2. So rank(M)=2\operatorname{rank}(M)=2. (2) Column space basis: {(1,0,1),(0,1,1)}\{(1,0,1)^\top,(0,1,1)^\top\} (columns 1 and 2, independent). (2) Null space: solve Mx=0Mx=0. From column dependence c1+c2c3=0c_1+c_2-c_3=0 ⇒ null vector (1,1,1)(1,1,-1)^\top. Basis: {(1,1,1)}\{(1,1,-1)^\top\} (dim = 32=13-2=1). (2)

(b) [6 marks] MMM^\top M is symmetric PSD, so it has orthonormal eigenvectors viv_i with eigenvalues μi0\mu_i\ge0: MMvi=μiviM^\top M v_i=\mu_i v_i. (2) Define σi=μi\sigma_i=\sqrt{\mu_i}. For μi>0\mu_i>0 set ui=Mvi/σiu_i = Mv_i/\sigma_i; then Mvi2=viMMvi=μi\|Mv_i\|^2 = v_i^\top M^\top M v_i=\mu_i, so Mvi=σi\|Mv_i\|=\sigma_i and uiu_i is unit; these uiu_i are orthonormal (from orthonormality of viv_i). This yields M=UΣVM=U\Sigma V^\top with Σ\Sigma holding σi\sigma_i. (2) Rank(M)=(M)= dim of column space == number of independent ui=Mviu_i=Mv_i == number of σi>0\sigma_i>0 == number of nonzero singular values. (2)

(c) [5 marks] MM=(213123336).M^\top M = \begin{pmatrix}2&1&3\\1&2&3\\3&3&6\end{pmatrix}. Rank 2 ⇒ one zero eigenvalue. Trace =10=μ1+μ2=10=\mu_1+\mu_2. Sum of 2×22\times2 principal minors gives μ1μ2\mu_1\mu_2: compute μ1μ2=\mu_1\mu_2 = (nonzero eigenvalue product). Eigenvalues of MMM^\top M: {0, 5+24, 524}\{0,\ 5+\sqrt{24},\ 5-\sqrt{24}\}? Check: eigenvalues are 00, and roots of μ210μ+9=0\mu^2-10\mu+9=0μ=9,1\mu=9,1. (3) So singular values: σ1=3, σ2=1, σ3=0\sigma_1=3,\ \sigma_2=1,\ \sigma_3=0. (2)

(d) [5 marks]

def minnorm_lstsq(U, S, Vt, b, eps=1e-10):
    # M = U @ diag(S) @ Vt
    S_inv = np.array([1/s if s > eps else 0.0 for s in S])
    # pseudoinverse M+ = V @ diag(S_inv) @ U^T
    x = Vt.T @ (S_inv * (U.T @ b))
    return x

(3) Explanation: The pseudoinverse gives the minimum-L2L_2-norm solution among all least-squares minimizers. Tiny σk\sigma_k produce huge 1/σk1/\sigma_k factors that amplify noise in bb; the condition number κ=σmax/σmin\kappa=\sigma_{\max}/\sigma_{\min} blows up as σmin0\sigma_{\min}\to0. Zeroing singular values below ε\varepsilon (truncated SVD) discards these unstable directions, bounding the effective condition number and stabilizing the solution. (2)


Question 3

(a) [5 marks] Given tr(XY)=tr(YX)\operatorname{tr}(XY)=\operatorname{tr}(YX) (1, standard identity). Let X=AX=A, Y=BCY=BC: tr(A(BC))=tr((BC)A)=tr(BCA).\operatorname{tr}(A(BC))=\operatorname{tr}((BC)A)=\operatorname{tr}(BCA). (2) Again with X=ABX=AB, Y=CY=C: tr((AB)C)=tr(C(AB))=tr(CAB)\operatorname{tr}((AB)C)=\operatorname{tr}(C(AB))=\operatorname{tr}(CAB). (2) Hence all three cyclic permutations equal.

(b) [5 marks] (AA)jj=iAijAij=iAij2(A^\top A)_{jj}=\sum_i A_{ij}A_{ij}=\sum_i A_{ij}^2, so tr(AA)=jiAij2=AF2\operatorname{tr}(A^\top A)=\sum_j\sum_i A_{ij}^2=\|A\|_F^2. (2.5) With SVD A=UΣVA=U\Sigma V^\top: AA=VΣΣVA^\top A=V\Sigma^\top\Sigma V^\top, similar to ΣΣ=diag(σk2)\Sigma^\top\Sigma=\operatorname{diag}(\sigma_k^2). Trace is invariant under similarity ⇒ tr(AA)=kσk2\operatorname{tr}(A^\top A)=\sum_k\sigma_k^2. (2.5)

(c) [8 marks] Norm preservation: Qx22=(Qx)(Qx)=xQQx=xIx=x22\|Qx\|_2^2=(Qx)^\top(Qx)=x^\top Q^\top Q x = x^\top I x=\|x\|_2^2 (using QQ=IQ^\top Q=I). (2) Dot product: (Qx)(Qy)=xQQy=xy(Qx)^\top(Qy)=x^\top Q^\top Q y=x^\top y. (2) Determinant: det(QQ)=det(I)=1\det(Q^\top Q)=\det(I)=1; and det(Q)det(Q)=det(Q)2=1\det(Q^\top)\det(Q)=\det(Q)^2=1det(Q)=±1\det(Q)=\pm1. (2) Trace: QQ=InQ^\top Q=I_n so tr(QQ)=tr(In)=n\operatorname{tr}(Q^\top Q)=\operatorname{tr}(I_n)=n. (2)


[
  {"claim": "Eigenvalues of the 3x3 tridiagonal [2,-1] matrix are 2-sqrt2, 2, 2+sqrt2",
   "code": "A=Matrix([[2,-1,0],[-1,2,-1],[0,-1,2]]); ev=set(A.eigenvals().keys()); expected={2-sqrt(2),Integer(2),2+sqrt(2)}; result = (ev==expected)"},
  {"claim": "Minimum of Rayleigh quotient equals smallest eigenvalue 2-sqrt2",
   "code": "A=Matrix([[2,-1,0],[-1,2,-1],[0,-1,2]]); lam=min(A.eigenvals().keys(),key=lambda z:float(z)); result = simplify(lam-(2-sqrt(2)))==0"},
  {"claim": "Singular values of M are 3,1,0 (eigenvalues of M^T M are 9,1,0)",
   "code": "M=Matrix([[1,0,1],[0,1,1],[1,1,2]]); mm=M.T*M; evs=sorted([float(v) for v in mm.eigenvals().keys()]); result = evs==[0.0,1.0,9.0]"},
  {"claim": "rank(M)=2 and null space spanned by (1,1,-1)",
   "code": "M=Matrix([[1,0,1],[0,1,1],[1,1,2]]); ns=M.nullspace(); result = (M.rank()==2 and len(ns)==1 and simplify(ns[0]-ns[0][0]*Matrix([1,1,-1]))==zeros(3,1))"},
  {"claim": "trace(M^T M) equals sum of squares of singular values (9+1+0=10)",
   "code": "M=Matrix([[1,0,1],[0,1,1],[1,1,2]]); result = trace(M.T*M)==10"}
]