Skip to content

9.7 Linear algebra problem set, part a: elimination, LU, bases, rank, determinants, eigenvalues, QR

The sections before this one write code that factors matrices. Gaussian elimination and LU with partial pivoting builds LU, Orthogonality, Householder QR, and orthogonal initialization builds QR and an orthogonal initializer, and Eigenvalues, power iteration, and the spectral radius builds power iteration and the spectral radius that Vanilla RNN with manual BPTT and truncation in AI Engineering uses to diagnose exploding gradients. Comparing those factors with NumPy’s is only meaningful if you know what the factors are supposed to be and why they exist: why pivoting is needed, what rank and null space mean for a least-squares fit, why an eigenvalue above 1 makes a recurrent network blow up.

Concepts from other sections (15)

This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.

This problem set works those ideas by hand, on matrices small enough to check on paper. It is a pen-and-paper set with no code to write. It assumes the vectors, matrices, and matrix product of Vectors, matrices, row-major layout, and matmul and the overview in the chapter opening, and it fits best after the LU, QR, and power-iteration sections. Its sequel, the linear algebra problem set, part b, covers SVD, projections, and the roofline, and follows the SVD and inner-product sections.

Every problem is followed by a collapsed worked answer with the final result, the derivation, and the common wrong answers and why they are wrong. There are 44 exact answers and 4 proofs (q10, q20, q28, q44); model proofs for those four are also in course/solutions/solve/S-M03a/. Try each problem before opening its answer.

Learning objectives

  • Carry out elimination by hand, read off LL and UU, and apply partial pivoting.
  • Test vectors for independence, find bases of column and null spaces, and use rank-nullity.
  • Build the matrix of a linear map from the images of the basis vectors and compose maps in the right order.
  • Compute determinants and eigenvalues of small matrices and connect them to volume, singularity, and repeated multiplication.
  • Project onto a line, orthonormalize with Gram-Schmidt, and solve a small least-squares problem.

These are the facts the problems draw on, gathered in one place. The notation is standard:

SymbolMeaningType / shape
A∈Rm×nA \in \mathbb{R}^{m \times n}a matrix with mm rows and nn columnsmatrix
x,bx, bthe unknown and the right-hand side of Ax=bAx = bvectors
P,L,UP, L, Upermutation, unit lower triangular, upper triangular: PA=LUPA = LUn×nn \times n
span⁡{vi}\operatorname{span}\{v_i\}all linear combinations ∑civi\sum c_i v_isubspace
dim⁡V\dim Vthe number of vectors in any basis of VVinteger
rank⁡A\operatorname{rank} Athe dimension of the column space (equal to that of the row space)integer
N(A)N(A)the null space {x:Ax=0}\{x : Ax = 0\}; its dimension is the nullitysubspace
det⁡A\det Athe determinant of a square matrixreal
λ,v\lambda, van eigenvalue and an eigenvector: Av=λvAv = \lambda v, v≠0v \ne 0scalar, vector
ρ(A)\rho(A)the spectral radius, $\max\lambda
Q,RQ, Rorthonormal columns and upper triangular: A=QRA = QRmatrices

Gaussian elimination subtracts multiples of a pivot row from the rows below it until the matrix is upper triangular, UU. Recording each multiplier ℓij\ell_{ij} (the amount of row jj subtracted from row ii) in a unit lower triangular LL gives A=LUA = LU, so solving Ax=bAx = b becomes two triangular solves. If a pivot is 0 the rows must be exchanged, and if it is merely small, dividing by it amplifies rounding errors; partial pivoting swaps the row with the largest ∣aij∣|a_{ij}| in the current column into the pivot position, giving PA=LUPA = LU with every ∣ℓij∣≤1|\ell_{ij}| \le 1. The reduced row echelon form continues until each pivot is 1 and the only nonzero entry in its column. A system has no solution (inconsistent), exactly one, or infinitely many (a free variable).

Vectors are linearly independent when ∑civi=0\sum c_i v_i = 0 forces every ci=0c_i = 0. A basis of a subspace is an independent spanning set, and every basis has the same size, the dimension: a basis is a minimal spanning set, and any n+1n + 1 vectors in Rn\mathbb{R}^n are dependent. The pivot columns of AA are a basis of its column space; the special solutions (one per free variable) are a basis of its null space. Coordinates in a basis are the unique coefficients cc with ∑civi=x\sum c_i v_i = x: solve a linear system.

A map TT is linear when T(x+y)=T(x)+T(y)T(x + y) = T(x) + T(y) and T(cx)=cT(x)T(cx) = cT(x); then T(x)=AxT(x) = Ax where column jj of AA is T(ej)T(e_j). Composition is multiplication: S∘TS \circ T has matrix S TS\,T (apply TT first, so it is on the right). For AA with nn columns, rank-nullity says rank⁡A+dim⁡N(A)=n\operatorname{rank} A + \dim N(A) = n: every column either adds a direction to the image or a direction to the null space.

The determinant is the signed volume scale factor of x↦Axx \mapsto Ax: ∣det⁡[u v]∣|\det [u\ v]| is the area of the parallelogram spanned by uu and vv. It is multiplicative, det⁡(AB)=det⁡Adet⁡B\det(AB) = \det A \det B, so det⁡(A−1)=1/det⁡A\det(A^{-1}) = 1/\det A; it scales as det⁡(cA)=cndet⁡A\det(cA) = c^n \det A for n×nn \times n AA; a triangular matrix’s determinant is the product of its diagonal; and det⁡A=0\det A = 0 exactly when AA is singular.

λ\lambda is an eigenvalue when A−λIA - \lambda I is singular, that is, a root of the characteristic polynomial det⁡(tI−A)\det(tI - A); the product of the eigenvalues is det⁡A\det A and their sum is the trace. A real matrix may have complex eigenvalues (a rotation moves every real vector). If vv is an eigenvector, Akv=λkvA^k v = \lambda^k v, so the largest ∣λ∣|\lambda|, the spectral radius ρ(A)\rho(A), decides whether repeated application grows (ρ>1\rho > 1) or shrinks (ρ<1\rho < 1). Power iteration repeats v←Av/∥Av∥v \leftarrow Av / \lVert Av \rVert; the component along the second eigenvector shrinks by ∣λ2/λ1∣|\lambda_2/\lambda_1| per step.

The projection of bb onto the line through uu is u⋅bu⋅uu\frac{u \cdot b}{u \cdot u} u. Gram-Schmidt subtracts from each column its projections onto the previous orthonormal vectors and normalizes the rest, giving A=QRA = QR; requiring a positive diagonal of RR makes the factorization unique. Least squares minimizes ∥Ax−b∥2\lVert Ax - b \rVert^2; its solution satisfies the normal equations A⊤Ax=A⊤bA^\top A x = A^\top b, which QR solves stably as Rx=Q⊤bRx = Q^\top b, as in SVD, Eckart-Young low rank, and least squares.

Before the set itself, here are two siblings of q6, q7, and q36. They are not problems of the set, but they show the level of detail the answers use.

LU with partial pivoting. A=(2164)A = \begin{pmatrix} 2 & 1 \\ 6 & 4 \end{pmatrix}. The largest entry in column 1 is 6, in row 2, so swap: P=(0110)P = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, PA=(6421)PA = \begin{pmatrix} 6 & 4 \\ 2 & 1 \end{pmatrix}. The multiplier is ℓ21=2/6=1/3\ell_{21} = 2/6 = 1/3, and row 2 becomes (2,1)−13(6,4)=(0,−1/3)(2, 1) - \frac13 (6, 4) = (0, -1/3). So L=(101/31)L = \begin{pmatrix} 1 & 0 \\ 1/3 & 1 \end{pmatrix}, U=(640−1/3)U = \begin{pmatrix} 6 & 4 \\ 0 & -1/3 \end{pmatrix}. Check: LU=(6424/3−1/3)=PALU = \begin{pmatrix} 6 & 4 \\ 2 & 4/3 - 1/3 \end{pmatrix} = PA.

Eigenvalues and an eigenvector. B=(3102)B = \begin{pmatrix} 3 & 1 \\ 0 & 2 \end{pmatrix} is triangular, so det⁡(tI−B)=(t−3)(t−2)\det(tI - B) = (t - 3)(t - 2) and the eigenvalues are 3 and 2. For λ=2\lambda = 2: (B−2I)v=(1100)v=0(B - 2I)v = \begin{pmatrix} 1 & 1 \\ 0 & 0 \end{pmatrix} v = 0 gives v=(1,−1)v = (1, -1), or any nonzero multiple such as (2,−2)(2, -2). The product of the eigenvalues is 6=det⁡B6 = \det B.

The problems are grouped by topic, in the order of the summary above. Answers are exact (1/21/\sqrt2, not 0.7071). A vector is one column; a basis answer is correct if it is any basis of the right space; an eigenvector is correct up to a nonzero scalar. The tag after each problem says what kind of answer is expected.

q1. Solve x+2y=5x + 2y = 5, 3x+4y=63x + 4y = 6. Give (x,y)(x, y). [vector]

Answer

(x,y)=(−4,92)(x, y) = (-4, \frac92). Subtract 3 times the first equation from the second: −2y=−9-2y = -9, so y=92y = \frac92, and back substitution gives x=5−2⋅92=−4x = 5 - 2 \cdot \frac92 = -4. Check: −4+9=5-4 + 9 = 5, −12+18=6-12 + 18 = 6. Writing (92,−4)(\frac92, -4) swaps the unknowns.

q2. Solve x+y+z=6x + y + z = 6, 2x−y+z=32x - y + z = 3, x+2y−z=2x + 2y - z = 2. Give (x,y,z)(x, y, z). [vector]

Answer

(1,2,3)(1, 2, 3). Eliminate xx: row 2 minus 2 row 1 gives −3y−z=−9-3y - z = -9; row 3 minus row 1 gives y−2z=−4y - 2z = -4. From the second, y=2z−4y = 2z - 4; substituting, −3(2z−4)−z=−9-3(2z - 4) - z = -9, so z=3z = 3, y=2y = 2, x=1x = 1. Check all three: 66, 2−2+3=32 - 2 + 3 = 3, 1+4−3=21 + 4 - 3 = 2. (3,2,1)(3, 2, 1) reverses the order.

q3. Give the reduced row echelon form of (123247)\begin{pmatrix} 1 & 2 & 3 \\ 2 & 4 & 7 \end{pmatrix}. [matrix]

Answer

(120001)\begin{pmatrix} 1 & 2 & 0 \\ 0 & 0 & 1 \end{pmatrix}. Row 2 minus 2 row 1 gives (0,0,1)(0, 0, 1); then row 1 minus 3 row 2 clears the entry above that pivot. Stopping at (123001)\begin{pmatrix} 1 & 2 & 3 \\ 0 & 0 & 1 \end{pmatrix} gives an echelon form, not the reduced one: the reduced form needs zeros above every pivot.

q4. A=(2145)=LUA = \begin{pmatrix} 2 & 1 \\ 4 & 5 \end{pmatrix} = LU with LL unit lower triangular and UU upper triangular, no row exchanges. Give LL. [matrix]

Answer

L=(1021)L = \begin{pmatrix} 1 & 0 \\ 2 & 1 \end{pmatrix}. The multiplier is ℓ21=4/2=2\ell_{21} = 4/2 = 2 (row 2 minus 2 row 1), and LL stores it as is. The lu of Gaussian elimination and LU with partial pivoting would swap rows here (4 is the larger pivot candidate); without row exchanges, as asked, these are the factors. A common mistake is ℓ21=12\ell_{21} = \frac12, the reciprocal, which gives LU≠ALU \ne A.

q5. Give the UU of q4. [matrix]

Answer

U=(2103)U = \begin{pmatrix} 2 & 1 \\ 0 & 3 \end{pmatrix}. Row 2 becomes (4,5)−2(2,1)=(0,3)(4, 5) - 2(2, 1) = (0, 3). Check: LU=(2142+3)=ALU = \begin{pmatrix} 2 & 1 \\ 4 & 2 + 3 \end{pmatrix} = A. Writing 55 in the corner forgets to subtract 2×2 \times row 1 from the second column.

q6. Factor A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} as PA=LUPA = LU with partial pivoting (swap the row with the largest pivot candidate to the top). Give LL. [matrix]

Answer

L=(10131)L = \begin{pmatrix} 1 & 0 \\ \frac13 & 1 \end{pmatrix}. The pivot candidates in column 1 are 1 and 3; the larger is 3, so swap (P=(0110)P = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, PA=(3412)PA = \begin{pmatrix} 3 & 4 \\ 1 & 2 \end{pmatrix}). The multiplier is 13\frac13, at most 1 in size, which is the point of partial pivoting. Without pivoting the multiplier would be 3.

q7. Give the UU of q6. [matrix]

Answer

U=(34023)U = \begin{pmatrix} 3 & 4 \\ 0 & \frac23 \end{pmatrix}. Row 2 of PAPA becomes (1,2)−13(3,4)=(0,23)(1, 2) - \frac13(3, 4) = (0, \frac23). Without pivoting one gets (120−2)\begin{pmatrix} 1 & 2 \\ 0 & -2 \end{pmatrix}, a valid A=LUA = LU but not the pivoted factorization asked for.

q8. How many solutions has the system x+y=1x + y = 1, x+y=2x + y = 2? [number]

Answer

00. Subtracting the equations gives 0=10 = 1: the two lines x+y=1x + y = 1 and x+y=2x + y = 2 are parallel and distinct, so the system is inconsistent.

q9. Give the set of kk for which x+ky=1x + k y = 1, kx+y=1k x + y = 1 has infinitely many solutions. [set]

Answer

{1}\{1\}. The determinant 1−k21 - k^2 is nonzero for k≠±1k \ne \pm 1, giving exactly one solution. At k=1k = 1 both equations are x+y=1x + y = 1: infinitely many solutions. At k=−1k = -1 they are x−y=1x - y = 1 and −x+y=1-x + y = 1, whose sum is 0=20 = 2: no solution. A common mistake is {1,−1}\{1, -1\}, which treats every singular case as underdetermined.

q10. Prove that if the square matrix AA is invertible, then Ax=bAx = b has exactly one solution for every bb. [proof]

Answer

Claim. If the n×nn \times n matrix AA is invertible, then for every bb the system Ax=bAx = b has exactly one solution.

Proof. Let A−1A^{-1} satisfy A−1A=AA−1=IA^{-1}A = AA^{-1} = I. Existence: put x=A−1bx = A^{-1}b. Then Ax=A(A−1b)=(AA−1)b=bAx = A(A^{-1}b) = (AA^{-1})b = b by associativity. Uniqueness: if Ax=bAx = b and Ay=bAy = b, then A(x−y)=0A(x - y) = 0, and multiplying on the left by A−1A^{-1} gives x−y=(A−1A)(x−y)=A−10=0x - y = (A^{-1}A)(x - y) = A^{-1}0 = 0. So for every bb there is exactly one solution, x=A−1bx = A^{-1}b.

A proof needs both halves (existence and uniqueness) and should use only the definition of the inverse and associativity. Model proof also in q10.md.

Span, linear independence, basis, dimension

Section titled “Span, linear independence, basis, dimension”

q11. Is (1,2,3)(1, 2, 3) in the span of (1,0,1)(1, 0, 1) and (0,1,1)(0, 1, 1)? [bool]

Answer

Yes. a(1,0,1)+b(0,1,1)=(a,b,a+b)a(1, 0, 1) + b(0, 1, 1) = (a, b, a + b). Matching (1,2,3)(1, 2, 3) forces a=1a = 1, b=2b = 2, and then a+b=3a + b = 3 holds.

q12. Are (1,2)(1, 2) and (2,4)(2, 4) linearly independent? [bool]

Answer

No. (2,4)=2(1,2)(2, 4) = 2(1, 2), so 2(1,2)−(2,4)=02(1, 2) - (2, 4) = 0 is a nontrivial combination.

q13. Give the dimension of the span of (1,0,1)(1, 0, 1), (0,1,1)(0, 1, 1), (1,1,2)(1, 1, 2). [number]

Answer

22. (1,1,2)=(1,0,1)+(0,1,1)(1, 1, 2) = (1, 0, 1) + (0, 1, 1), so the third vector adds nothing, and the first two are independent. Answering 3 counts vectors rather than independent directions.

q14. Give a basis of the column space of (122436)\begin{pmatrix} 1 & 2 \\ 2 & 4 \\ 3 & 6 \end{pmatrix}. [basis]

Answer

{(1,2,3)}\{(1, 2, 3)\}. The second column is twice the first, so the column space is the line through (1,2,3)(1, 2, 3). Listing both columns is wrong because a basis must be independent.

q15. Give a basis of the null space of (111)\begin{pmatrix} 1 & 1 & 1 \end{pmatrix} (vectors in R3\mathbb{R}^3). [basis]

Answer

{(−1,1,0),(−1,0,1)}\{(-1, 1, 0), (-1, 0, 1)\} (any basis of the plane x+y+z=0x + y + z = 0 is correct). The pivot is xx; yy and zz are free. Setting (y,z)=(1,0)(y, z) = (1, 0) and (0,1)(0, 1) gives the two special solutions. Common mistakes: (1,1,1)(1, 1, 1), which spans the row space (orthogonal to the null space), and giving only one vector when the nullity is 3−1=23 - 1 = 2.

q16. Give the coordinates of (3,5)(3, 5) in the basis (1,1)(1, 1), (1,−1)(1, -1). [vector]

Answer

(4,−1)(4, -1). Solve a(1,1)+b(1,−1)=(3,5)a(1, 1) + b(1, -1) = (3, 5): a+b=3a + b = 3, a−b=5a - b = 5, so a=4a = 4, b=−1b = -1. Check: (4−1,4+1)=(3,5)(4 - 1, 4 + 1) = (3, 5). (−1,4)(-1, 4) swaps the coordinates.

q17. Give the dimension of the space of symmetric 2×22 \times 2 real matrices. [number]

Answer

33. A symmetric matrix (abbc)\begin{pmatrix} a & b \\ b & c \end{pmatrix} is fixed by three free numbers, and the three matrices with a single 1 in position aa, cc, or the pair bb form a basis. Answering 4 counts all 2×22 \times 2 matrices.

q18. Give the set of cc for which (1,c)(1, c) and (c,4)(c, 4) are linearly dependent. [set]

Answer

{−2,2}\{-2, 2\}. Two vectors in R2\mathbb{R}^2 are dependent exactly when det⁡(1cc4)=4−c2=0\det\begin{pmatrix} 1 & c \\ c & 4 \end{pmatrix} = 4 - c^2 = 0. Forgetting the negative root is the common mistake: (1,−2)(1, -2) and (−2,4)(-2, 4) are also parallel.

q19. Give the dimension of the null space of (123246)\begin{pmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \end{pmatrix}. [number]

Answer

22. Row 2 is twice row 1, so the rank is 1, and rank-nullity gives 3−1=23 - 1 = 2. Answering 1 reports the rank.

q20. Prove that any n+1n + 1 vectors in Rn\mathbb{R}^n are linearly dependent. [proof]

Answer

Claim. Any n+1n + 1 vectors v1,…,vn+1v_1, \dots, v_{n+1} in Rn\mathbb{R}^n are linearly dependent.

Proof. Let AA be the n×(n+1)n \times (n + 1) matrix with columns v1,…,vn+1v_1, \dots, v_{n+1}. The vectors are dependent exactly when Ac=0Ac = 0 for some c≠0c \ne 0, since Ac=∑iciviAc = \sum_i c_i v_i. Reduce AA to echelon form; row operations do not change the solutions of Ac=0Ac = 0. Each pivot occupies its own row and there are only nn rows, so at most nn of the n+1n + 1 columns have a pivot: some cjc_j is a free variable. Set cj=1c_j = 1, every other free variable to 0, and solve for the pivot variables by back substitution. This gives Ac=0Ac = 0 with cj=1c_j = 1, so c≠0c \ne 0, and the vectors are dependent.

The key steps are translating dependence into Ac=0Ac = 0, counting pivots against columns, and building an explicit nonzero solution from the free variable. Model proof also in q20.md.

q21. Give the matrix of the rotation of R2\mathbb{R}^2 by 90°90° counterclockwise. [matrix]

Answer

(0−110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}. Column jj is the image of eje_j: e1=(1,0)↦(0,1)e_1 = (1, 0) \mapsto (0, 1) and e2=(0,1)↦(−1,0)e_2 = (0, 1) \mapsto (-1, 0). rotate_pairs in Trigonometry, rotations, complex numbers, and Euler’s formula and RoPE in AI Engineering apply this matrix to pairs of coordinates. The transpose (01−10)\begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix} rotates clockwise.

q22. Give the matrix of T(x,y)=(x+y, 2x, y)T(x, y) = (x + y,\ 2x,\ y) from R2\mathbb{R}^2 to R3\mathbb{R}^3. [matrix]

Answer

(112001)\begin{pmatrix} 1 & 1 \\ 2 & 0 \\ 0 & 1 \end{pmatrix}. The columns are T(e1)=(1,2,0)T(e_1) = (1, 2, 0) and T(e2)=(1,0,1)T(e_2) = (1, 0, 1), giving a 3×23 \times 2 matrix for a map from R2\mathbb{R}^2 to R3\mathbb{R}^3. Writing the images as rows gives the 2×32 \times 3 transpose, which does not even have the right shape.

q23. Give the rank of (123456789)\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}. [number]

Answer

22. Row 3 minus row 2 equals row 2 minus row 1 (both (3,3,3)(3, 3, 3)), so the rows are dependent; rows 1 and 2 are not parallel. Elimination leaves two pivots. (q31 changes the last entry to 10, which makes the matrix invertible.)

q24. Give the nullity (dimension of the null space) of the matrix of q23. [number]

Answer

11. Rank-nullity: 3−2=13 - 2 = 1. The null space is spanned by (1,−2,1)(1, -2, 1): 1−4+3=01 - 4 + 3 = 0, 4−10+6=04 - 10 + 6 = 0, 7−16+9=07 - 16 + 9 = 0.

q25. A 5×75 \times 7 matrix has rank 4. Give the dimension of its null space. [number]

Answer

33. The null space lives in R7\mathbb{R}^7 (the number of columns), so its dimension is 7−4=37 - 4 = 3. Answering 1 computes 5−45 - 4, subtracting from the number of rows.

q26. Is T(x)=x+1T(x) = x + 1, from R\mathbb{R} to R\mathbb{R}, a linear map? [bool]

Answer

No. A linear map sends 0 to 0, but T(0)=1T(0) = 1. (Also T(2x)=2x+1≠2T(x)T(2x) = 2x + 1 \ne 2T(x).) It is an affine map.

q27. T(x,y)=(y,x)T(x, y) = (y, x) and S(x,y)=(2x,y)S(x, y) = (2x, y). Give the matrix of S∘TS \circ T (first TT, then SS). [matrix]

Answer

(0210)\begin{pmatrix} 0 & 2 \\ 1 & 0 \end{pmatrix}. (x,y)→T(y,x)→S(2y,x)(x, y) \xrightarrow{T} (y, x) \xrightarrow{S} (2y, x). As matrices, ST=(2001)(0110)ST = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}: the map applied first is on the right. Multiplying in the order of application gives TS=(0120)TS = \begin{pmatrix} 0 & 1 \\ 2 & 0 \end{pmatrix}, which sends (x,y)(x, y) to (y,2x)(y, 2x).

q28. Prove that the null space {x:Ax=0}\{x : Ax = 0\} of an m×nm \times n matrix AA is a subspace of Rn\mathbb{R}^n. [proof]

Answer

Claim. For an m×nm \times n matrix AA, N(A)={x∈Rn:Ax=0}N(A) = \{x \in \mathbb{R}^n : Ax = 0\} is a subspace of Rn\mathbb{R}^n.

Proof. Matrix multiplication is linear: A(x+y)=Ax+AyA(x + y) = Ax + Ay and A(cx)=c(Ax)A(cx) = c(Ax). Zero: A0=0A0 = 0, so 0∈N(A)0 \in N(A). Addition: if Ax=0Ax = 0 and Ay=0Ay = 0, then A(x+y)=0+0=0A(x + y) = 0 + 0 = 0. Scaling: if Ax=0Ax = 0, then A(cx)=c⋅0=0A(cx) = c \cdot 0 = 0. So N(A)N(A) is a nonempty subset of Rn\mathbb{R}^n closed under addition and scalar multiplication: a subspace.

All three conditions are needed, and linearity of x↦Axx \mapsto Ax is the reason each holds. Model proof also in q28.md.

q29. det⁡(2174)\det \begin{pmatrix} 2 & 1 \\ 7 & 4 \end{pmatrix}. [number]

Answer

11. ad−bc=2⋅4−1⋅7=1ad - bc = 2 \cdot 4 - 1 \cdot 7 = 1. Answering 15 adds the products instead of subtracting.

q30. det⁡(123045006)\det \begin{pmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{pmatrix}. [number]

Answer

2424. The matrix is upper triangular, so the determinant is the product of the diagonal, 1⋅4⋅61 \cdot 4 \cdot 6. Answering 11 gives the trace.

q31. det⁡(1234567810)\det \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 10 \end{pmatrix}. [number]

Answer

−3-3. Expand along row 1: 1(5⋅10−6⋅8)−2(4⋅10−6⋅7)+3(4⋅8−5⋅7)=2+4−9=−31(5 \cdot 10 - 6 \cdot 8) - 2(4 \cdot 10 - 6 \cdot 7) + 3(4 \cdot 8 - 5 \cdot 7) = 2 + 4 - 9 = -3. Common mistakes: 3 (a sign slip in the cofactor pattern +,−,++, -, +) and 0, which is the determinant of the matrix with a 9 in the corner (q23’s).

q32. AA is 3×33 \times 3 with det⁡A=5\det A = 5. Give det⁡(2A)\det(2A). [number]

Answer

4040. Scaling every entry by 2 scales each of the 3 rows by 2, and the determinant is linear in each row: det⁡(2A)=23det⁡A=40\det(2A) = 2^3 \det A = 40. Answering 10 scales only once.

q33. det⁡A=4\det A = 4. Give det⁡(A−1)\det(A^{-1}). [number]

Answer

14\frac14. det⁡(A)det⁡(A−1)=det⁡(AA−1)=det⁡I=1\det(A)\det(A^{-1}) = \det(AA^{-1}) = \det I = 1. Answering −4-4 confuses the inverse with the negative.

q34. Give the area of the parallelogram spanned by (3,1)(3, 1) and (1,2)(1, 2). [number]

Answer

55. The area is ∣det⁡(3112)∣=∣3⋅2−1⋅1∣=5|\det\begin{pmatrix} 3 & 1 \\ 1 & 2 \end{pmatrix}| = |3 \cdot 2 - 1 \cdot 1| = 5. Answering 7 adds the products.

q35. Give the eigenvalues of (2003)\begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix}. [set]

Answer

{2,3}\{2, 3\}. A diagonal matrix has its diagonal entries as eigenvalues, with eigenvectors e1e_1 and e2e_2. Answering {5}\{5\} adds them (that is the trace).

q36. Give the eigenvalues of (2112)\begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}. [set]

Answer

{1,3}\{1, 3\}. det⁡(tI−A)=(t−2)2−1=(t−1)(t−3)\det(tI - A) = (t - 2)^2 - 1 = (t - 1)(t - 3). Check: the sum 1+3=41 + 3 = 4 is the trace and the product 33 is the determinant. Reading {2}\{2\} off the diagonal works only for triangular matrices.

q37. Give an eigenvector of the matrix of q36 for its largest eigenvalue. [vector]

Answer

(1,1)(1, 1) (or any nonzero multiple). (A−3I)v=(−111−1)v=0(A - 3I)v = \begin{pmatrix} -1 & 1 \\ 1 & -1 \end{pmatrix}v = 0 gives v1=v2v_1 = v_2. Check: A(1,1)=(3,3)A(1, 1) = (3, 3). (1,−1)(1, -1) is the eigenvector of the other eigenvalue, 1.

q38. Give the characteristic polynomial det⁡(tI−A)\det(tI - A) of A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}. [expr in t]

Answer

t2−5t−2t^2 - 5t - 2. det⁡(t−1−2−3t−4)=(t−1)(t−4)−6=t2−5t−2\det\begin{pmatrix} t - 1 & -2 \\ -3 & t - 4 \end{pmatrix} = (t - 1)(t - 4) - 6 = t^2 - 5t - 2. Check: the constant term is det⁡A=4−6=−2\det A = 4 - 6 = -2 and the tt coefficient is −tr⁡A-\operatorname{tr} A. Common mistakes: t2−5t+4t^2 - 5t + 4 (the off-diagonal product dropped) and t2+5t−2t^2 + 5t - 2 (the sign of the trace term).

q39. Give the (complex) eigenvalues of the rotation (0−110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}. [set]

Answer

{i,−i}\{i, -i\}. det⁡(tI−A)=t2+1\det(tI - A) = t^2 + 1. No real vector is mapped onto its own line by a 90°90° rotation, so the eigenvalues cannot be real. {1,−1}\{1, -1\} are the eigenvalues of a reflection.

q40. Give the product of the eigenvalues of (4123)\begin{pmatrix} 4 & 1 \\ 2 & 3 \end{pmatrix}. [number]

Answer

1010. The product of the eigenvalues is det⁡A=4⋅3−1⋅2=10\det A = 4 \cdot 3 - 1 \cdot 2 = 10 (the eigenvalues are 5 and 2). Answering 7 gives their sum, the trace.

q41. With AA from q36, give A10(1,1)A^{10} (1, 1). [vector]

Answer

(59049,59049)(59049, 59049). (1,1)(1, 1) is the eigenvector for λ=3\lambda = 3 (q37), so A10(1,1)=310(1,1)A^{10}(1, 1) = 3^{10}(1, 1) and 310=590493^{10} = 59049. Answering (30,30)(30, 30) multiplies by 10⋅310 \cdot 3 instead of raising to the power.

q42. Give the spectral radius (largest ∣λ∣|\lambda|) of (1/22/52/51/2)\begin{pmatrix} 1/2 & 2/5 \\ 2/5 & 1/2 \end{pmatrix}. [number]

Answer

910\frac{9}{10}. For (abba)\begin{pmatrix} a & b \\ b & a \end{pmatrix} the eigenvalues are a±ba \pm b (eigenvectors (1,±1)(1, \pm 1)): here 12±25=910,110\frac12 \pm \frac25 = \frac{9}{10}, \frac{1}{10}. A spectral radius below 1 makes repeated multiplication shrink, which is the vanishing-gradient story of Vanilla RNN with manual BPTT and truncation. Common mistakes: 12\frac12 (the diagonal entry) and 110\frac{1}{10} (the smaller eigenvalue).

q43. Power iteration on the matrix of q36 from a generic start shrinks its error by the factor ∣λ2/λ1∣|\lambda_2 / \lambda_1| per step. Give that factor. [number]

Answer

13\frac13. ∣λ2/λ1∣=1/3|\lambda_2/\lambda_1| = 1/3 from q36: the component along (1,−1)(1, -1) is multiplied by 1 per step while the one along (1,1)(1, 1) is multiplied by 3, so their ratio shrinks by a factor 3 each step. The power_iteration of Eigenvalues, power iteration, and the spectral radius converges at this rate. Answering 3 inverts the ratio.

q44. Prove that eigenvectors v1,v2v_1, v_2 of AA with eigenvalues λ1≠λ2\lambda_1 \ne \lambda_2 are linearly independent. [proof]

Answer

Claim. If Av1=λ1v1Av_1 = \lambda_1 v_1, Av2=λ2v2Av_2 = \lambda_2 v_2, v1,v2≠0v_1, v_2 \ne 0, and λ1≠λ2\lambda_1 \ne \lambda_2, then v1v_1 and v2v_2 are linearly independent.

Proof. Suppose c1v1+c2v2=0c_1 v_1 + c_2 v_2 = 0 (1). Apply AA: c1λ1v1+c2λ2v2=0c_1\lambda_1 v_1 + c_2\lambda_2 v_2 = 0 (2). Subtract λ2\lambda_2 times (1) from (2): c1(λ1−λ2)v1=0c_1(\lambda_1 - \lambda_2)v_1 = 0. Since λ1≠λ2\lambda_1 \ne \lambda_2 and v1≠0v_1 \ne 0, c1=0c_1 = 0. Then (1) reads c2v2=0c_2 v_2 = 0, and v2≠0v_2 \ne 0 gives c2=0c_2 = 0. So only the trivial combination is 0.

The essential move is getting a second equation by applying AA and eliminating one vector; both hypotheses (λ1≠λ2\lambda_1 \ne \lambda_2 and v1≠0v_1 \ne 0) must be used. Model proof also in q44.md.

q45. Give the orthogonal projection of (1,2,3)(1, 2, 3) onto the line spanned by (1,1,1)(1, 1, 1). [vector]

Answer

(2,2,2)(2, 2, 2). u⋅bu⋅uu=1+2+33(1,1,1)\frac{u \cdot b}{u \cdot u}u = \frac{1 + 2 + 3}{3}(1, 1, 1). The residual (−1,0,1)(-1, 0, 1) is orthogonal to (1,1,1)(1, 1, 1), as it must be. This is the inner-product step of Inner products, projections, cosine similarity, and top-k and of Gram-Schmidt. Answering (6,6,6)(6, 6, 6) forgets to divide by ∥u∥2=3\lVert u\rVert^2 = 3.

q46. A=(111001)A = \begin{pmatrix} 1 & 1 \\ 1 & 0 \\ 0 & 1 \end{pmatrix}. Gram-Schmidt on its columns gives A=QRA = QR with QQ having orthonormal columns and RR upper triangular with a positive diagonal. Give QQ. [matrix]

Answer

Q=(121612−16026)Q = \begin{pmatrix} \frac{1}{\sqrt2} & \frac{1}{\sqrt6} \\ \frac{1}{\sqrt2} & -\frac{1}{\sqrt6} \\ 0 & \frac{2}{\sqrt6} \end{pmatrix}. Normalize a1=(1,1,0)a_1 = (1, 1, 0): q1=(1,1,0)/2q_1 = (1, 1, 0)/\sqrt2. Then q1⋅a2=12q_1 \cdot a_2 = \frac{1}{\sqrt2}, and a2−12q1=(1,0,1)−(12,12,0)=(12,−12,1)a_2 - \frac{1}{\sqrt2}q_1 = (1, 0, 1) - (\frac12, \frac12, 0) = (\frac12, -\frac12, 1), with length 3/2=62\sqrt{3/2} = \frac{\sqrt6}{2}, so q2=(1,−1,2)/6q_2 = (1, -1, 2)/\sqrt6. Common mistakes: leaving the second column unnormalized, and flipping the sign of q2q_2, which makes R22R_{22} negative and violates the uniqueness convention.

q47. Give the RR of q46. [matrix]

Answer

R=(212062)R = \begin{pmatrix} \sqrt2 & \frac{1}{\sqrt2} \\ 0 & \frac{\sqrt6}{2} \end{pmatrix}. R=Q⊤AR = Q^\top A: R11=∥a1∥=2R_{11} = \lVert a_1\rVert = \sqrt2, R12=q1⋅a2=12R_{12} = q_1 \cdot a_2 = \frac{1}{\sqrt2}, R22R_{22} is the length of what was left of a2a_2, 62\frac{\sqrt6}{2}. Check the second column: 12q1+62q2=(12,12,0)+(12,−12,1)=(1,0,1)\frac{1}{\sqrt2}q_1 + \frac{\sqrt6}{2}q_2 = (\frac12, \frac12, 0) + (\frac12, -\frac12, 1) = (1, 0, 1). Writing (1101)\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} forgets that QQ‘s columns are normalized.

q48. Fit y=c xy = c\,x to the points (1,1)(1, 1), (2,2)(2, 2), (3,2)(3, 2) by least squares. Give cc. [number]

Answer

c=1114c = \frac{11}{14}. Minimize ∑(yi−cxi)2\sum (y_i - cx_i)^2: the derivative is zero at c=∑xiyi∑xi2=1+4+61+4+9c = \frac{\sum x_i y_i}{\sum x_i^2} = \frac{1 + 4 + 6}{1 + 4 + 9}. This is the normal equation A⊤Ac=A⊤yA^\top A c = A^\top y for the one-column A=(1,2,3)⊤A = (1, 2, 3)^\top; the lstsq of SVD, Eckart-Young low rank, and least squares solves it through QR. Common mistakes: 56=∑y/∑x\frac56 = \sum y / \sum x, and 1, which fits only the first two points.

The wrong answers discussed above fall into a handful of patterns. Each one has a symptom you can spot and a habit that prevents it:

MistakeSymptomThe habit that avoids it
Storing the reciprocal of the multiplier in LLLU≠ALU \ne Astore ℓ21=a21/a11\ell_{21} = a_{21}/a_{11} itself (q4)
Skipping the pivot searchmultipliers larger than 1 and unstable factors; PP differs from NumPy’spick the largest ∣candidate∣\lvert\text{candidate}\rvert as pivot before eliminating (q6, q7)
Calling an echelon form “reduced”entries above the pivots left nonzeroclear the entries above each pivot too (q3)
Counting vectors instead of independent vectorsdimension and rank too largecheck each vector against the span of the previous ones (q13, q14)
Confusing rank with nullity, or rows with columns in rank-nullitythe wrong null space dimensionsubtract the rank from the number of columns (q19, q25)
Writing images of basis vectors as rowsthe transpose of the map’s matrixwrite T(ej)T(e_j) as column jj (q22)
Multiplying maps in the order they are appliedTSTS instead of STSTput the map applied first on the right (q27)
det⁡(cA)=cdet⁡A\det(cA) = c \det Avolume scale off by cn−1c^{n-1}scale once per row: cnc^n (q32)
Reading eigenvalues off the diagonal of a non-triangular matrixwrong spectral radius; an RNN diagnosed as stable when it is notsolve the characteristic polynomial (q36, q42)
Forgetting to divide by u⋅uu \cdot u in a projectionprojections scaled by ∥u∥2\lVert u \rVert^2divide by u⋅uu \cdot u (q45)

Each group of problems is the hand version of code in this chapter. q4 to q7 are the factors that lu and lu_solve compute in Gaussian elimination and LU with partial pivoting. The uniqueness convention of q46 and q47 is the sign rule of Orthogonality, Householder QR, and orthogonal initialization. The rate in q43 is the convergence rate of power_iteration and spectral_radius in Eigenvalues, power iteration, and the spectral radius, and q48 is least squares through QR in SVD, Eckart-Young low rank, and least squares. The linear algebra problem set, part b continues with inner products and projections, SVD and low rank, and FLOP and byte counts.

  • Strang, Introduction to Linear Algebra, ch. 2 to 6, and MIT 18.06 lectures 1 to 21.
  • Hefferon, Linear Algebra (free), ch. 1 to 5.
  • Elimination is LU: the multipliers are LL, the result is UU, and partial pivoting keeps every multiplier at most 1 in size (q4 to q7).
  • A basis is a minimal spanning set; its size, the dimension, is the same for every basis, and any n+1n + 1 vectors in Rn\mathbb{R}^n are dependent (q13, q20).
  • Rank plus nullity equals the number of columns: every column either adds a direction to the image or a direction to the null space (q23 to q25).
  • The determinant measures how a matrix scales volume; it is the product of the eigenvalues and is 0 exactly when the matrix is singular (q31, q34, q40).
  • Repeated multiplication by AA is governed by its eigenvalues: Akv=λkvA^k v = \lambda^k v, power iteration converges at rate ∣λ2/λ1∣|\lambda_2/\lambda_1|, and a spectral radius below 1 shrinks everything (q41 to q43).