Level 5 — MasteryLinear Algebra (Full)

Linear Algebra (Full)

90 minutes60 marksprintable — key stays hidden on paper

Level 5 — Cross-Domain Synthesis, Proof & Computation

Time limit: 90 minutes Total marks: 60

Instructions: Attempt all three questions. Show all reasoning. Where a computational routine is requested, give clear pseudocode/algorithm and hand-execute on the given data. Marks are indicated in brackets.


Question 1 — Spectral Theory Meets a Physical Oscillator [20 marks]

Two identical masses m=1m=1 connected by three identical springs (constant k=1k=1) between two fixed walls have small-oscillation equation of motion x¨=Kx\ddot{\mathbf{x}} = -K\mathbf{x} where

K=(2112).K = \begin{pmatrix} 2 & -1 \\ -1 & 2 \end{pmatrix}.

(a) Prove that any real symmetric matrix has real eigenvalues and that eigenvectors for distinct eigenvalues are orthogonal. State the two facts about KK that let you invoke the spectral theorem here. [6]

(b) Find the eigenvalues λ1<λ2\lambda_1<\lambda_2 and a corresponding orthonormal eigenbasis of KK. [5]

(c) The normal-mode angular frequencies are ωi=λi\omega_i=\sqrt{\lambda_i}. Using the change of basis x=Qy\mathbf{x}=Q\mathbf{y} where QQ has your orthonormal eigenvectors as columns, show the system decouples into two independent scalar oscillators, and write the general solution x(t)\mathbf{x}(t). [5]

(d) Classify the quadratic form V(x)=12xKxV(\mathbf{x})=\tfrac12\mathbf{x}^\top K\mathbf{x} (the potential energy) as positive/negative definite or indefinite, and connect this classification to physical stability of the equilibrium. [4]


Question 2 — Least Squares, QR, and a Fitting Algorithm [22 marks]

You are given data points (ti,bi)(t_i,b_i): (0,1),(1,1),(2,3),(3,4)(0,1),(1,1),(2,3),(3,4), and wish to fit a line b=c0+c1tb=c_0+c_1 t.

(a) Write the overdetermined system Ac=bA\mathbf{c}=\mathbf{b} explicitly, and derive the normal equations AAc=AbA^\top A\,\mathbf{c}=A^\top\mathbf{b} from the principle of minimising Acb2\|A\mathbf{c}-\mathbf{b}\|^2. Justify why the minimiser satisfies A(bAc)=0A^\top(\mathbf{b}-A\mathbf{c})=\mathbf 0 geometrically (in terms of the four fundamental subspaces). [7]

(b) Solve the normal equations to obtain the best-fit coefficients c0,c1c_0,c_1. [5]

(c) Perform Gram–Schmidt on the columns of AA to obtain a QRQR factorisation (QQ with orthonormal columns, RR upper triangular), and re-solve for c\mathbf c via Rc=QbR\mathbf c=Q^\top\mathbf b. Confirm agreement with (b). [7]

(d) Give pseudocode for a general least-squares solver via QR, and state one numerical reason QR is preferred over forming AAA^\top A directly. [3]


Question 3 — Rank, SVD & the Pseudoinverse [18 marks]

Let

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

(a) Determine rank(M)\operatorname{rank}(M) by row reduction, identify pivot and free columns, and give bases for the column space and null space. Verify the rank–nullity theorem. [6]

(b) State and prove the rank–nullity theorem for a matrix ARm×nA\in\mathbb{R}^{m\times n}. [6]

(c) Since MM is singular, its inverse does not exist. Explain how the Moore–Penrose pseudoinverse M+M^{+} (built from the SVD M=UΣVM=U\Sigma V^\top) provides the minimum-norm least-squares solution to Mx=bM\mathbf x=\mathbf b. Specifically: for a general b\mathbf b, characterise the set of least-squares solutions and identify which one M+bM^{+}\mathbf b selects. [6]

Answer keyMark scheme & solutions

Question 1

(a) [6] Let A=AA=A^\top real. Let Av=λvA\mathbf v=\lambda\mathbf v, v0\mathbf v\neq 0, possibly complex. Take conjugate transpose: vˉA=λˉvˉ\bar{\mathbf v}^\top A = \bar\lambda\,\bar{\mathbf v}^\top (using AA real symmetric so Aˉ=A\bar A^\top=A). Then vˉAv=λvˉv\bar{\mathbf v}^\top A\mathbf v = \lambda\,\bar{\mathbf v}^\top\mathbf v and also =λˉvˉv=\bar\lambda\,\bar{\mathbf v}^\top\mathbf v. Since vˉv=v2>0\bar{\mathbf v}^\top\mathbf v=\|\mathbf v\|^2>0, we get λ=λˉ\lambda=\bar\lambda, so λR\lambda\in\mathbb R. [3] Orthogonality: Au=λuA\mathbf u=\lambda\mathbf u, Aw=μwA\mathbf w=\mu\mathbf w, λμ\lambda\neq\mu. wAu=λwu\mathbf w^\top A\mathbf u = \lambda\,\mathbf w^\top\mathbf u; also wAu=(Aw)u=μwu\mathbf w^\top A\mathbf u=(A\mathbf w)^\top\mathbf u=\mu\,\mathbf w^\top\mathbf u. So (λμ)wu=0wu=0(\lambda-\mu)\mathbf w^\top\mathbf u=0\Rightarrow\mathbf w^\top\mathbf u=0. [2] KK is real and symmetric (K=KK=K^\top), so the spectral theorem applies: K=QΛQK=Q\Lambda Q^\top with QQ orthogonal. [1]

(b) [5] det(KλI)=(2λ)21=λ24λ+3=(λ1)(λ3)\det(K-\lambda I)=(2-\lambda)^2-1=\lambda^2-4\lambda+3=(\lambda-1)(\lambda-3). So λ1=1, λ2=3\lambda_1=1,\ \lambda_2=3. [2] λ1=1\lambda_1=1: (KI)v=0(1111)v=0v1=12(1,1)(K-I)\mathbf v=0\Rightarrow\begin{pmatrix}1&-1\\-1&1\end{pmatrix}\mathbf v=0\Rightarrow \mathbf v_1=\tfrac1{\sqrt2}(1,1)^\top. [1.5] λ2=3\lambda_2=3: (1111)v=0v2=12(1,1)\begin{pmatrix}-1&-1\\-1&-1\end{pmatrix}\mathbf v=0\Rightarrow \mathbf v_2=\tfrac1{\sqrt2}(1,-1)^\top. [1.5] Orthonormal: v1v2=0\mathbf v_1\cdot\mathbf v_2=0, both unit.

(c) [5] Q=12(1111)Q=\tfrac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, QKQ=Λ=diag(1,3)Q^\top K Q=\Lambda=\mathrm{diag}(1,3). [1] Sub x=Qy\mathbf x=Q\mathbf y: x¨=KxQy¨=KQyy¨=QKQy=Λy\ddot{\mathbf x}=-K\mathbf x\Rightarrow Q\ddot{\mathbf y}=-KQ\mathbf y\Rightarrow \ddot{\mathbf y}=-Q^\top K Q\,\mathbf y=-\Lambda\mathbf y. [2] Decoupled: y¨1=y1\ddot y_1=-y_1 (ω1=1\omega_1=1), y¨2=3y2\ddot y_2=-3y_2 (ω2=3\omega_2=\sqrt3). [1] yi(t)=Aicos(ωit)+Bisin(ωit)y_i(t)=A_i\cos(\omega_i t)+B_i\sin(\omega_i t), and x(t)=12 ⁣(11) ⁣(A1cost+B1sint)+12 ⁣(11) ⁣(A2cos3t+B2sin3t).\mathbf x(t)=\tfrac1{\sqrt2}\!\begin{pmatrix}1\\1\end{pmatrix}\!\big(A_1\cos t+B_1\sin t\big)+\tfrac1{\sqrt2}\!\begin{pmatrix}1\\-1\end{pmatrix}\!\big(A_2\cos\sqrt3 t+B_2\sin\sqrt3 t\big). Mode 1 = in-phase (slow), Mode 2 = anti-phase (fast). [1]

(d) [4] Eigenvalues 1,3>0K1,3>0\Rightarrow K positive definite V(x)>0\Rightarrow V(\mathbf x)>0 for x0\mathbf x\neq0. [2] Physically the potential has a strict local minimum at x=0\mathbf x=0; positive definiteness ⇔ real positive ωi2\omega_i^2 ⇔ purely oscillatory (no growing modes) ⇒ equilibrium is stable. [2]


Question 2

(a) [7] A=(10111213),b=(1134),c=(c0c1).A=\begin{pmatrix}1&0\\1&1\\1&2\\1&3\end{pmatrix},\quad \mathbf b=\begin{pmatrix}1\\1\\3\\4\end{pmatrix},\quad \mathbf c=\begin{pmatrix}c_0\\c_1\end{pmatrix}. [2] Minimise f(c)=Acb2f(\mathbf c)=\|A\mathbf c-\mathbf b\|^2. f=2A(Acb)=0AAc=Ab\nabla f=2A^\top(A\mathbf c-\mathbf b)=0\Rightarrow A^\top A\mathbf c=A^\top\mathbf b. [3] Geometric: the residual r=bAc\mathbf r=\mathbf b-A\mathbf c is minimised when AcA\mathbf c is the orthogonal projection of b\mathbf b onto Col(A)\operatorname{Col}(A), i.e. rCol(A)\mathbf r\perp\operatorname{Col}(A), meaning rCol(A)=Nul(A)\mathbf r\in\operatorname{Col}(A)^\perp=\operatorname{Nul}(A^\top), giving Ar=0A^\top\mathbf r=0. [2]

(b) [5] AA=(46614)A^\top A=\begin{pmatrix}4&6\\6&14\end{pmatrix}, Ab=(917)A^\top\mathbf b=\begin{pmatrix}9\\17\end{pmatrix}. [2] det=5636=20\det=56-36=20. (AA)1=120(14664)(A^\top A)^{-1}=\tfrac1{20}\begin{pmatrix}14&-6\\-6&4\end{pmatrix}. c=120(14961769+417)=120(2414)=(1.20.7).\mathbf c=\tfrac1{20}\begin{pmatrix}14\cdot9-6\cdot17\\-6\cdot9+4\cdot17\end{pmatrix}=\tfrac1{20}\begin{pmatrix}24\\14\end{pmatrix}=\begin{pmatrix}1.2\\0.7\end{pmatrix}. [3] So c0=1.2, c1=0.7c_0=1.2,\ c_1=0.7.

(c) [7] Columns a1=(1,1,1,1)a_1=(1,1,1,1)^\top, a2=(0,1,2,3)a_2=(0,1,2,3)^\top. q1=a1/a1=12(1,1,1,1)q_1=a_1/\|a_1\|=\tfrac12(1,1,1,1)^\top, r11=2r_{11}=2. [1.5] r12=q1a2=12(0+1+2+3)=3r_{12}=q_1^\top a_2=\tfrac12(0+1+2+3)=3. u2=a23q1=(0,1,2,3)32(1,1,1,1)=(1.5,0.5,0.5,1.5)u_2=a_2-3q_1=(0,1,2,3)^\top-\tfrac32(1,1,1,1)^\top=(-1.5,-0.5,0.5,1.5)^\top. [2] u2=2.25+0.25+0.25+2.25=5\|u_2\|=\sqrt{2.25+0.25+0.25+2.25}=\sqrt5, so r22=5r_{22}=\sqrt5, q2=u2/5q_2=u_2/\sqrt5. [1.5] R=(2305)R=\begin{pmatrix}2&3\\0&\sqrt5\end{pmatrix}. QbQ^\top\mathbf b: q1b=12(1+1+3+4)=4.5q_1^\top\mathbf b=\tfrac12(1+1+3+4)=4.5; q2b=15(1.5+(0.5)+1.5+6)=5.55q_2^\top\mathbf b=\tfrac1{\sqrt5}(-1.5+(-0.5)+1.5+6)=\tfrac{5.5}{\sqrt5}. Back-sub Rc=QbR\mathbf c=Q^\top\mathbf b: 5c1=5.5/5c1=5.5/5=1.1\sqrt5\,c_1=5.5/\sqrt5\Rightarrow c_1=5.5/5=1.1?? Recompute q2bq_2^\top b: components q2=15(1.5,0.5,0.5,1.5)q_2=\tfrac1{\sqrt5}(-1.5,-0.5,0.5,1.5), dot b=(1,1,3,4)b=(1,1,3,4): 1.50.5+1.5+6=5.5-1.5-0.5+1.5+6=5.5; times 1/51/\sqrt5. Then c1=(5.5/5)/5=5.5/5=1.1c_1=(5.5/\sqrt5)/\sqrt5=5.5/5=1.1. This disagrees — recheck u2u_2 dot b directly: c1=(u2b)/u22=5.5/5=1.1c_1=(u_2^\top b)/\|u_2\|^2=5.5/5=1.1. But (b) gave 0.7.

Correction: u2b=(1.5)(1)+(0.5)(1)+(0.5)(3)+(1.5)(4)=1.50.5+1.5+6=5.5u_2^\top b=(-1.5)(1)+(-0.5)(1)+(0.5)(3)+(1.5)(4)=-1.5-0.5+1.5+6=5.5; u22=5\|u_2\|^2=5; ratio =1.1=1.1. The discrepancy flags an arithmetic error in (b): recompute AbA^\top b: rows: c0c_0 eqn b=1+1+3+4=9\sum b=1+1+3+4=9 ✓; c1c_1 eqn tibi=0+1+6+12=19\sum t_i b_i=0+1+6+12=19 (not 17!). So Ab=(9,19)A^\top b=(9,19)^\top. Then c=120(149619, 69+419)=120(126114, 54+76)=120(12,22)=(0.6,1.1)\mathbf c=\tfrac1{20}(14\cdot9-6\cdot19,\ -6\cdot9+4\cdot19)^\top=\tfrac1{20}(126-114,\ -54+76)^\top=\tfrac1{20}(12,22)^\top=(0.6,1.1)^\top. [2] Corrected answer: c0=0.6, c1=1.1c_0=0.6,\ c_1=1.1. QR gives c0=(4.531.1)/2=(4.53.3)/2=0.6c_0=(4.5-3\cdot1.1)/2=(4.5-3.3)/2=0.6 ✓ — both methods agree. [stray, credited]

(d) [3]

QR_least_squares(A, b):
    Q, R = qr(A)          # thin QR, orthonormal cols
    y = Q^T b
    solve R c = y by back-substitution  # R upper triangular
    return c

Numerical reason: forming AAA^\top A squares the condition number (κ(AA)=κ(A)2\kappa(A^\top A)=\kappa(A)^2), amplifying round-off; QR works directly on AA preserving conditioning. [3]


Question 3

(a) [6] Row reduce MM: R3R3R1R2R_3\to R_3-R_1-R_2 gives (0,0,0)(0,0,0). RREF: (101011000).\begin{pmatrix}1&0&1\\0&1&1\\0&0&0\end{pmatrix}. Pivots in columns 1,2; column 3 free. rank=2\operatorname{rank}=2. [2] Column space basis: original pivot columns {(1,0,1),(0,1,1)}\{(1,0,1)^\top,(0,1,1)^\top\}, dim=2\dim=2. [2] Null space: x1=x3, x2=x3x_1=-x_3,\ x_2=-x_3, x3x_3 free x=x3(1,1,1)\Rightarrow \mathbf x=x_3(-1,-1,1)^\top; basis {(1,1,1)}\{(-1,-1,1)^\top\}, dim=1\dim=1. [1] Rank–nullity: rank+dimNul=2+1=3=n\operatorname{rank}+\dim\operatorname{Nul}=2+1=3=n ✓. [1]

(b) [6] Statement: For ARm×nA\in\mathbb R^{m\times n}, dimCol(A)+dimNul(A)=n\dim\operatorname{Col}(A)+\dim\operatorname{Nul}(A)=n. [1] Proof: Let r=rankAr=\operatorname{rank}A. Reduce AA to RREF RR; row operations don't change null space or the number of pivot columns. There are rr pivot columns and nrn-r free columns. Each free variable indexes a basis vector of Nul(A)\operatorname{Nul}(A) (set it =1=1, others 00, solve pivots), giving nrn-r linearly independent null-space vectors that span it — so dimNul(A)=nr\dim\operatorname{Nul}(A)=n-r. [3] Column rank =r=dimCol(A)=r=\dim\operatorname{Col}(A) (pivot columns