Mathematics

101 Best Linear Algebra Problems and Solutions: From Eigenvalues to Vector Spaces

101 linear algebra problems with full solutions and checks, from vectors and Gaussian elimination to determinants, eigenvalues, least squares and SVD.

Linear algebra is learned by doing. Definitions of span, rank and eigenvalues only start to make sense after you have row-reduced a few matrices and watched a vector refuse to change direction. This article collects 101 problems in the order a first course usually covers them: vectors, linear combinations, matrix arithmetic, systems of equations, determinants, inverses, vector spaces, linear transformations, eigenvalues, and finally orthogonality, least squares and the singular value decomposition.

Every problem has a full solution and, where it helps, a check you can do in a few seconds to catch arithmetic slips. Every answer was recomputed with SymPy (exact arithmetic) before publication. Try each problem before opening the solution; the gap between "I follow the solution" and "I can produce it" is where the learning happens.

If you want the theory and machine-learning context behind these problems rather than practice, read the companion article 101 linear algebra concepts for machine learning.

Notation. Vectors are columns, written in parentheses in running text, such as v=(1,2,3)\mathbf{v} = (1, 2, 3). ATA^{T} is the transpose, A−1A^{-1} the inverse, det⁡A\det A the determinant and II the identity matrix.

Vectors

1. Linear combination of vectors

Problem: For u=(2,−1,3)\mathbf{u} = (2, -1, 3) and v=(1,4,−2)\mathbf{v} = (1, 4, -2), compute 3u−2v3\mathbf{u} - 2\mathbf{v}.

Show solution

Scale, then subtract component by component:

3u−2v=(6,−3,9)−(2,8,−4)=(4,−11,13)3\mathbf{u} - 2\mathbf{v} = (6, -3, 9) - (2, 8, -4) = (4, -11, 13)

Check: the first components give 3⋅2−2⋅1=43 \cdot 2 - 2 \cdot 1 = 4.

2. Length of a vector

Problem: Find ∥(3,4,12)∥\lVert (3, 4, 12) \rVert.

Show solution∥(3,4,12)∥=9+16+144=169=13\lVert (3, 4, 12) \rVert = \sqrt{9 + 16 + 144} = \sqrt{169} = 13

3. Unit vector

Problem: Find the unit vector in the direction of (1,2,2)(1, 2, 2).

Show solution

The length is 1+4+4=3\sqrt{1 + 4 + 4} = 3, so the unit vector is (13,23,23)\left(\tfrac{1}{3}, \tfrac{2}{3}, \tfrac{2}{3}\right).

Check: 19+49+49=1\tfrac{1}{9} + \tfrac{4}{9} + \tfrac{4}{9} = 1.

4. Dot product

Problem: Compute (1,2,3)⋅(4,−5,6)(1, 2, 3) \cdot (4, -5, 6).

Show solution1⋅4+2⋅(−5)+3⋅6=4−10+18=121 \cdot 4 + 2 \cdot (-5) + 3 \cdot 6 = 4 - 10 + 18 = 12

5. Angle between two vectors

Problem: Find the angle between (1,0,1)(1, 0, 1) and (0,1,1)(0, 1, 1).

Show solutioncos⁡θ=a⋅b∥a∥ ∥b∥=12 2=12⟹θ=60∘\cos\theta = \frac{\mathbf{a} \cdot \mathbf{b}}{\lVert \mathbf{a} \rVert \, \lVert \mathbf{b} \rVert} = \frac{1}{\sqrt{2}\,\sqrt{2}} = \frac{1}{2} \quad\Longrightarrow\quad \theta = 60^\circ

6. Testing orthogonality

Problem: Are (2,−1,3)(2, -1, 3) and (1,5,1)(1, 5, 1) orthogonal?

Show solution

2−5+3=02 - 5 + 3 = 0. The dot product is zero, so yes, they are orthogonal.

7. Choosing a parameter for orthogonality

Problem: For which kk are (k,2,−1)(k, 2, -1) and (3,k,4)(3, k, 4) orthogonal?

Show solution3k+2k−4=0⟹k=453k + 2k - 4 = 0 \quad\Longrightarrow\quad k = \frac{4}{5}

Check: 3(0.8)+2(0.8)−4=2.4+1.6−4=03(0.8) + 2(0.8) - 4 = 2.4 + 1.6 - 4 = 0.

8. Cross product

Problem: Compute (1,2,3)×(4,5,6)(1, 2, 3) \times (4, 5, 6).

Show solution(2⋅6−3⋅5,  3⋅4−1⋅6,  1⋅5−2⋅4)=(−3,6,−3)(2 \cdot 6 - 3 \cdot 5,\; 3 \cdot 4 - 1 \cdot 6,\; 1 \cdot 5 - 2 \cdot 4) = (-3, 6, -3)

Check: the result must be orthogonal to both inputs: −3+12−9=0-3 + 12 - 9 = 0 and −12+30−18=0-12 + 30 - 18 = 0.

9. Area of a triangle in space

Problem: Find the area of the triangle with vertices P(1,0,0)P(1, 0, 0), Q(0,2,0)Q(0, 2, 0) and R(0,0,3)R(0, 0, 3).

Show solution

PQ→=(−1,2,0)\overrightarrow{PQ} = (-1, 2, 0) and PR→=(−1,0,3)\overrightarrow{PR} = (-1, 0, 3). Their cross product is (6,3,2)(6, 3, 2), whose length is 36+9+4=7\sqrt{36 + 9 + 4} = 7. The triangle is half the parallelogram, so the area is 72=3.5\tfrac{7}{2} = 3.5.

10. Projection of one vector onto another

Problem: Project b=(1,3)\mathbf{b} = (1, 3) onto the line through a=(3,1)\mathbf{a} = (3, 1), and find the error vector.

Show solutionp=a⋅ba⋅a a=610(3,1)=(1.8,0.6),e=b−p=(−0.8,2.4)\mathbf{p} = \frac{\mathbf{a} \cdot \mathbf{b}}{\mathbf{a} \cdot \mathbf{a}}\,\mathbf{a} = \frac{6}{10}(3, 1) = (1.8, 0.6), \qquad \mathbf{e} = \mathbf{b} - \mathbf{p} = (-0.8, 2.4)

Check: e⋅a=−2.4+2.4=0\mathbf{e} \cdot \mathbf{a} = -2.4 + 2.4 = 0, so the error is perpendicular to the line, as it must be.

Vector b = (1, 3) projected onto the line through a = (3, 1). The projection p = (1.8, 0.6) lies on the line, and the dotted error vector from p to b meets the line at a right angle.
Problem 10: the projection p is the point on the line closest to b, so the error b − p is perpendicular to a.

11. Cauchy–Schwarz inequality

Problem: Verify ∣u⋅v∣≤∥u∥ ∥v∥|\mathbf{u} \cdot \mathbf{v}| \le \lVert \mathbf{u} \rVert \, \lVert \mathbf{v} \rVert for u=(1,2)\mathbf{u} = (1, 2) and v=(3,4)\mathbf{v} = (3, 4).

Show solution

u⋅v=11\mathbf{u} \cdot \mathbf{v} = 11, and ∥u∥ ∥v∥=5⋅5≈11.18\lVert \mathbf{u} \rVert \, \lVert \mathbf{v} \rVert = \sqrt{5} \cdot 5 \approx 11.18. Since 11≤11.1811 \le 11.18, the inequality holds. Equality would require the vectors to be parallel.

12. Distance from a point to a plane

Problem: Find the distance from (1,2,3)(1, 2, 3) to the plane 2x−y+2z=102x - y + 2z = 10.

Show solutiond=∣2(1)−2+2(3)−10∣22+(−1)2+22=∣−4∣3=43d = \frac{|2(1) - 2 + 2(3) - 10|}{\sqrt{2^2 + (-1)^2 + 2^2}} = \frac{|-4|}{3} = \frac{4}{3}

Linear combinations, span and independence

13. Writing a vector as a combination

Problem: Write (7,8)(7, 8) as a combination of (1,2)(1, 2) and (3,1)(3, 1).

Show solution

Solve c1+3c2=7c_1 + 3c_2 = 7 and 2c1+c2=82c_1 + c_2 = 8. From the second, c2=8−2c1c_2 = 8 - 2c_1; substituting gives c1+24−6c1=7c_1 + 24 - 6c_1 = 7, so c1=175c_1 = \tfrac{17}{5} and c2=65c_2 = \tfrac{6}{5}.

Check: 175+185=7\tfrac{17}{5} + \tfrac{18}{5} = 7 and 345+65=8\tfrac{34}{5} + \tfrac{6}{5} = 8.

14. Membership in a span

Problem: Is (1,2,3)(1, 2, 3) in the span of (1,0,1)(1, 0, 1) and (0,1,1)(0, 1, 1)?

Show solution

From the first two components, c1=1c_1 = 1 and c2=2c_2 = 2. The third component must then be c1+c2=3c_1 + c_2 = 3, which matches. Yes: (1,2,3)=1(1,0,1)+2(0,1,1)(1, 2, 3) = 1(1, 0, 1) + 2(0, 1, 1).

15. Testing independence with a determinant

Problem: Are (1,1,0)(1, 1, 0), (0,1,1)(0, 1, 1) and (1,0,1)(1, 0, 1) linearly independent?

Show solution

Put them in the columns of a matrix and take the determinant:

det⁡[101110011]=1(1−0)−0+1(1−0)=2≠0\det\begin{bmatrix} 1 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1 \end{bmatrix} = 1(1 - 0) - 0 + 1(1 - 0) = 2 \ne 0

The determinant is nonzero, so the vectors are independent and form a basis of R3\mathbb{R}^3.

16. Finding a dependence relation

Problem: Show that (1,2,3)(1, 2, 3), (4,5,6)(4, 5, 6) and (7,8,9)(7, 8, 9) are dependent by finding a relation.

Show solution

The vectors step by the same amount, (3,3,3)(3, 3, 3), so the middle one is the average of the other two: v1−2v2+v3=0\mathbf{v}_1 - 2\mathbf{v}_2 + \mathbf{v}_3 = \mathbf{0}.

Check: (1−8+7,  2−10+8,  3−12+9)=(0,0,0)(1 - 8 + 7,\; 2 - 10 + 8,\; 3 - 12 + 9) = (0, 0, 0).

17. Too many vectors

Problem: Explain why (1,0,0)(1, 0, 0), (0,1,0)(0, 1, 0), (0,0,1)(0, 0, 1) and (1,2,3)(1, 2, 3) must be dependent, and find the relation.

Show solution

Any set of more than nn vectors in Rn\mathbb{R}^n is dependent, because a matrix with more columns than rows has a free column. Here (1,2,3)=1e1+2e2+3e3(1, 2, 3) = 1\mathbf{e}_1 + 2\mathbf{e}_2 + 3\mathbf{e}_3.

18. Parameter that causes dependence

Problem: For which kk are (1,k)(1, k) and (k,4)(k, 4) dependent?

Show solution

det⁡[1kk4]=4−k2=0\det\begin{bmatrix} 1 & k \\ k & 4 \end{bmatrix} = 4 - k^2 = 0, so k=2k = 2 or k=−2k = -2.

Check: with k=2k = 2, (2,4)=2(1,2)(2, 4) = 2(1, 2).

19. Describing a span geometrically

Problem: Describe the span of (1,2)(1, 2) in R2\mathbb{R}^2.

Show solution

All multiples t(1,2)=(t,2t)t(1, 2) = (t, 2t): the line y=2xy = 2x through the origin.

20. Spanning the plane

Problem: Show that (1,1)(1, 1) and (1,−1)(1, -1) span R2\mathbb{R}^2, and write (5,3)(5, 3) in terms of them.

Show solution

det⁡[111−1]=−2≠0\det\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} = -2 \ne 0, so they span the plane. Solving c1+c2=5c_1 + c_2 = 5 and c1−c2=3c_1 - c_2 = 3 gives c1=4c_1 = 4 and c2=1c_2 = 1.

21. Equation of a plane spanned by two vectors

Problem: Find the equation of the plane through the origin spanned by (1,0,2)(1, 0, 2) and (0,1,−1)(0, 1, -1).

Show solution

A normal vector is the cross product: (1,0,2)×(0,1,−1)=(−2,1,1)(1, 0, 2) \times (0, 1, -1) = (-2, 1, 1). The plane is −2x+y+z=0-2x + y + z = 0.

Check: (1,0,2)(1, 0, 2) gives −2+0+2=0-2 + 0 + 2 = 0; (0,1,−1)(0, 1, -1) gives 0+1−1=00 + 1 - 1 = 0.

22. Independence of polynomials

Problem: Are 11, 1+x1 + x and 1+x+x21 + x + x^2 independent?

Show solution

Write their coefficients (constant, xx, x2x^2) as columns:

[111011001]\begin{bmatrix} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{bmatrix}

The matrix is triangular with nonzero diagonal, so its determinant is 11 and the polynomials are independent. They form a basis of the polynomials of degree at most 2.

Matrix operations

23. Matrix multiplication is not commutative

Problem: For A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} and B=[0110]B = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}, compute ABAB and BABA.

Show solutionAB=[2143],BA=[3412]AB = \begin{bmatrix} 2 & 1 \\ 4 & 3 \end{bmatrix}, \qquad BA = \begin{bmatrix} 3 & 4 \\ 1 & 2 \end{bmatrix}

Multiplying by BB on the right swaps the columns of AA; on the left it swaps the rows. AB≠BAAB \ne BA.

24. Matrix times vector

Problem: Compute [10201−1][312]\begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & -1 \end{bmatrix}\begin{bmatrix} 3 \\ 1 \\ 2 \end{bmatrix} and state the shapes.

Show solution

A 2×32 \times 3 matrix times a 3×13 \times 1 vector gives a 2×12 \times 1 vector:

[3+0+40+1−2]=[7−1]\begin{bmatrix} 3 + 0 + 4 \\ 0 + 1 - 2 \end{bmatrix} = \begin{bmatrix} 7 \\ -1 \end{bmatrix}

25. Transpose of a product

Problem: Using AA and BB from problem 23, verify (AB)T=BTAT(AB)^{T} = B^{T}A^{T}.

Show solution

(AB)T=[2413](AB)^{T} = \begin{bmatrix} 2 & 4 \\ 1 & 3 \end{bmatrix}. Since BT=BB^{T} = B, BTAT=[0110][1324]=[2413]B^{T}A^{T} = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix} = \begin{bmatrix} 2 & 4 \\ 1 & 3 \end{bmatrix}. They match. The order reverses.

26. Powers of a matrix

Problem: Find A5A^5 for A=[1101]A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}.

Show solution

A2=[1201]A^2 = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix}, and each further multiplication adds 1 to the top-right entry, so An=[1n01]A^n = \begin{bmatrix} 1 & n \\ 0 & 1 \end{bmatrix} and A5=[1501]A^5 = \begin{bmatrix} 1 & 5 \\ 0 & 1 \end{bmatrix}. (Prove the pattern by induction: AnAA^{n}A adds the top-left 1 to the top-right entry.)

27. Trace of a product

Problem: With AA and BB from problem 23, verify tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA).

Show solution

tr⁡(AB)=2+3=5\operatorname{tr}(AB) = 2 + 3 = 5 and tr⁡(BA)=3+2=5\operatorname{tr}(BA) = 3 + 2 = 5. The products differ but their traces agree, which is true for any compatible square products.

28. Symmetric plus skew-symmetric

Problem: Write A=[1423]A = \begin{bmatrix} 1 & 4 \\ 2 & 3 \end{bmatrix} as a symmetric matrix plus a skew-symmetric matrix.

Show solutionS=12(A+AT)=[1333],K=12(A−AT)=[01−10]S = \tfrac{1}{2}(A + A^{T}) = \begin{bmatrix} 1 & 3 \\ 3 & 3 \end{bmatrix}, \qquad K = \tfrac{1}{2}(A - A^{T}) = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}

Check: S+K=AS + K = A, ST=SS^{T} = S and KT=−KK^{T} = -K.

29. A nilpotent matrix

Problem: For N=[010001000]N = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}, compute N2N^2 and N3N^3.

Show solution

Each multiplication shifts the ones one place further up and to the right:

N2=[001000000],N3=0N^2 = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}, \qquad N^3 = 0

All eigenvalues of a nilpotent matrix are 0.

30. Matrix-vector product as a combination of columns

Problem: Compute [1234][56]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}\begin{bmatrix} 5 \\ 6 \end{bmatrix} as a combination of columns.

Show solution5[13]+6[24]=[1739]5\begin{bmatrix} 1 \\ 3 \end{bmatrix} + 6\begin{bmatrix} 2 \\ 4 \end{bmatrix} = \begin{bmatrix} 17 \\ 39 \end{bmatrix}

This "column picture" is why Ax=bA\mathbf{x} = \mathbf{b} is solvable exactly when b\mathbf{b} is in the column space of AA.

31. Outer product

Problem: Compute uvT\mathbf{u}\mathbf{v}^{T} for u=(1,2)\mathbf{u} = (1, 2) and v=(3,4,5)\mathbf{v} = (3, 4, 5), and give its rank.

Show solutionuvT=[3456810]\mathbf{u}\mathbf{v}^{T} = \begin{bmatrix} 3 & 4 & 5 \\ 6 & 8 & 10 \end{bmatrix}

The second row is twice the first, so the rank is 1. Every nonzero outer product has rank 1.

32. Rotation matrix

Problem: Rotate (3,4)(3, 4) by 90∘90^\circ counterclockwise.

Show solutionR90∘=[0−110],R90∘[34]=[−43]R_{90^\circ} = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}, \qquad R_{90^\circ}\begin{bmatrix} 3 \\ 4 \end{bmatrix} = \begin{bmatrix} -4 \\ 3 \end{bmatrix}

Check: the length is still 5, and (3,4)⋅(−4,3)=0(3, 4) \cdot (-4, 3) = 0.

33. Projection matrix

Problem: Find the matrix that projects onto the line through (1,1)(1, 1) and verify P2=PP^2 = P.

Show solutionP=aaTaTa=12[1111]P = \frac{\mathbf{a}\mathbf{a}^{T}}{\mathbf{a}^{T}\mathbf{a}} = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}

P2=14[2222]=PP^2 = \tfrac{1}{4}\begin{bmatrix} 2 & 2 \\ 2 & 2 \end{bmatrix} = P. Projecting twice is the same as projecting once.

34. Reflection matrix

Problem: Find the matrix that reflects across the line y=xy = x and apply it to (2,5)(2, 5).

Show solution

The reflection swaps coordinates: [0110]\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}, giving (5,2)(5, 2). Applying it twice returns the original vector, so the matrix is its own inverse.

Systems of linear equations

35. A 2 × 2 system

Problem: Solve x+y=4x + y = 4 and x−y=2x - y = 2.

Show solution

Adding the equations gives 2x=62x = 6, so x=3x = 3 and y=1y = 1.

Three panels of two lines each. Left: x + y = 4 and x − y = 2 cross at (3, 1), one solution. Middle: x + y = 4 and x + y = 1 are parallel, no solution. Right: x + y = 4 and 2x + 2y = 8 are the same line, infinitely many solutions.
Problems 35, 37 and 38: two equations in two unknowns can meet once, never or everywhere.

36. A 3 × 3 system by elimination

Problem: Solve x+y+z=6x + y + z = 6, 2x−y+z=32x - y + z = 3, x+2y−z=2x + 2y - z = 2.

Show solution

Subtract twice row 1 from row 2, and row 1 from row 3:

−3y−z=−9,y−2z=−4-3y - z = -9, \qquad y - 2z = -4

From the second, y=2z−4y = 2z - 4. Substituting: −3(2z−4)−z=−9-3(2z - 4) - z = -9, so −7z=−21-7z = -21 and z=3z = 3. Then y=2y = 2 and x=1x = 1.

Check: 1+2+3=61 + 2 + 3 = 6, 2−2+3=32 - 2 + 3 = 3, 1+4−3=21 + 4 - 3 = 2.

37. An inconsistent system

Problem: Solve x+2y=3x + 2y = 3 and 2x+4y=72x + 4y = 7.

Show solution

Subtracting twice the first equation from the second gives 0=10 = 1, which is impossible. There is no solution: the lines are parallel.

38. Infinitely many solutions

Problem: Solve x+y+z=3x + y + z = 3 and x−y+z=1x - y + z = 1.

Show solution

Subtracting gives 2y=22y = 2, so y=1y = 1 and x+z=2x + z = 2. Let z=tz = t be free:

(x,y,z)=(2−t,  1,  t),t∈R(x, y, z) = (2 - t,\; 1,\; t), \qquad t \in \mathbb{R}

The solution set is a line: two planes in R3\mathbb{R}^3 that are not parallel meet in a line.

39. Reduced row echelon form

Problem: Solve x+2y−z=3x + 2y - z = 3, 2x+4y+z=92x + 4y + z = 9, x+2y+2z=6x + 2y + 2z = 6 using RREF.

Show solution[12−1324191226]⟶[120400110000]\left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \\ 2 & 4 & 1 & 9 \\ 1 & 2 & 2 & 6 \end{array}\right] \longrightarrow \left[\begin{array}{ccc|c} 1 & 2 & 0 & 4 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \end{array}\right]

Pivots are in columns 1 and 3, so yy is free. With y=ty = t: (x,y,z)=(4−2t,  t,  1)(x, y, z) = (4 - 2t,\; t,\; 1).

40. A homogeneous system

Problem: Find all solutions of Ax=0A\mathbf{x} = \mathbf{0} for A=[123246]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \end{bmatrix}.

Show solution

Row 2 is twice row 1, so only x+2y+3z=0x + 2y + 3z = 0 remains. With y=sy = s and z=tz = t free:

x=s(−2,1,0)+t(−3,0,1)\mathbf{x} = s(-2, 1, 0) + t(-3, 0, 1)

The null space is a plane with basis (−2,1,0)(-2, 1, 0) and (−3,0,1)(-3, 0, 1).

41. When does a system have a unique solution?

Problem: For which kk does x+y=1x + y = 1, 2x+ky=32x + ky = 3 have exactly one solution?

Show solution

The coefficient determinant is k−2k - 2. For k≠2k \ne 2 there is exactly one solution. For k=2k = 2 the second equation says 2x+2y=32x + 2y = 3, while the first implies 2x+2y=22x + 2y = 2, so there is no solution.

42. Cramer's rule for a 3 × 3 system

Problem: Use Cramer's rule to find xx in problem 36.

Show solutiondet⁡A=det⁡[1112−1112−1]=1(1−2)−1(−2−1)+1(4+1)=7\det A = \det\begin{bmatrix} 1 & 1 & 1 \\ 2 & -1 & 1 \\ 1 & 2 & -1 \end{bmatrix} = 1(1 - 2) - 1(-2 - 1) + 1(4 + 1) = 7

Replace column 1 with the right-hand side (6,3,2)(6, 3, 2):

det⁡Ax=6(1−2)−1(−3−2)+1(6+2)=7,x=77=1\det A_x = 6(1 - 2) - 1(-3 - 2) + 1(6 + 2) = 7, \qquad x = \frac{7}{7} = 1

This matches problem 36. Cramer's rule is useful for theory and tiny systems; elimination is far cheaper for anything larger.

43. LU decomposition of a 2 × 2 matrix

Problem: Factor A=[2168]A = \begin{bmatrix} 2 & 1 \\ 6 & 8 \end{bmatrix} as LULU.

Show solution

The multiplier for row 2 is 6/2=36 / 2 = 3; subtracting 3×3 \times row 1 leaves (0,5)(0, 5):

A=[1031][2105]A = \begin{bmatrix} 1 & 0 \\ 3 & 1 \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 0 & 5 \end{bmatrix}

44. LU decomposition of a 3 × 3 matrix

Problem: Factor A=[211433879]A = \begin{bmatrix} 2 & 1 & 1 \\ 4 & 3 & 3 \\ 8 & 7 & 9 \end{bmatrix} as LULU.

Show solution

Multipliers 2 and 4 clear column 1, leaving rows (0,1,1)(0, 1, 1) and (0,3,5)(0, 3, 5). Multiplier 3 then clears column 2, leaving (0,0,2)(0, 0, 2):

L=[100210431],U=[211011002]L = \begin{bmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 4 & 3 & 1 \end{bmatrix}, \qquad U = \begin{bmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 2 \end{bmatrix}

Check: det⁡A=2⋅1⋅2=4\det A = 2 \cdot 1 \cdot 2 = 4, the product of the pivots.

45. Why pivoting matters

Problem: Solve 0.0001x+y=10.0001x + y = 1, x+y=2x + y = 2, and explain what goes wrong without row swaps in low-precision arithmetic.

Show solution

Exactly: y=2−xy = 2 - x, so 0.0001x+2−x=10.0001x + 2 - x = 1, giving x=10.9999≈1.0001x = \tfrac{1}{0.9999} \approx 1.0001 and y≈0.9999y \approx 0.9999.

Without a swap, the multiplier is 10 00010\,000, and row 2 becomes −9999y=−9998-9999y = -9998. With three significant digits both numbers round to about −10 000-10\,000, so y=1y = 1, and back-substitution gives 0.0001x=00.0001x = 0, so x=0x = 0, which is badly wrong. Swapping rows first (partial pivoting) uses the multiplier 0.00010.0001 and gives x≈1x \approx 1, y≈1y \approx 1 even at low precision.

46. Balancing a chemical equation

Problem: Balance a C3H8+b O2→c CO2+d H2Oa\,\mathrm{C_3H_8} + b\,\mathrm{O_2} \to c\,\mathrm{CO_2} + d\,\mathrm{H_2O}.

Show solution

Atom counts give a homogeneous system: carbon 3a=c3a = c, hydrogen 8a=2d8a = 2d, oxygen 2b=2c+d2b = 2c + d. Setting a=1a = 1: c=3c = 3, d=4d = 4, b=6+42=5b = \tfrac{6 + 4}{2} = 5.

C3H8+5 O2→3 CO2+4 H2O\mathrm{C_3H_8} + 5\,\mathrm{O_2} \to 3\,\mathrm{CO_2} + 4\,\mathrm{H_2O}

Determinants

47. Determinant as area

Problem: Find det⁡[3102]\det\begin{bmatrix} 3 & 1 \\ 0 & 2 \end{bmatrix} and interpret it.

Show solution

3⋅2−1⋅0=63 \cdot 2 - 1 \cdot 0 = 6. The matrix sends the unit square to the parallelogram spanned by its columns (3,0)(3, 0) and (1,2)(1, 2), which has area 6.

The unit square next to the parallelogram spanned by the column vectors (3, 0) and (1, 2). The parallelogram is labeled area equals the absolute value of det A, which is 6.
Problem 47: the absolute value of the determinant is the factor by which the matrix scales area.

48. A 3 × 3 determinant by cofactors

Problem: Compute det⁡[201132114]\det\begin{bmatrix} 2 & 0 & 1 \\ 1 & 3 & 2 \\ 1 & 1 & 4 \end{bmatrix}.

Show solution

Expand along row 1 (the zero saves work):

2(3⋅4−2⋅1)−0+1(1⋅1−3⋅1)=2(10)+(−2)=182(3 \cdot 4 - 2 \cdot 1) - 0 + 1(1 \cdot 1 - 3 \cdot 1) = 2(10) + (-2) = 18

49. Determinant of a triangular matrix

Problem: Compute det⁡[357029004]\det\begin{bmatrix} 3 & 5 & 7 \\ 0 & 2 & 9 \\ 0 & 0 & 4 \end{bmatrix}.

Show solution

For a triangular matrix the determinant is the product of the diagonal: 3⋅2⋅4=243 \cdot 2 \cdot 4 = 24.

50. Effect of scaling a matrix

Problem: If AA is 3×33 \times 3 with det⁡A=5\det A = 5, find det⁡(2A)\det(2A).

Show solution

Multiplying the matrix by 2 multiplies each of the 3 rows by 2, and each row scaling multiplies the determinant by 2: det⁡(2A)=23⋅5=40\det(2A) = 2^3 \cdot 5 = 40.

51. Product and inverse rules

Problem: If det⁡A=3\det A = 3 and det⁡B=−2\det B = -2 for n×nn \times n matrices, find det⁡(AB)\det(AB), det⁡(A−1B2)\det(A^{-1}B^2) and det⁡(AT)\det(A^{T}).

Show solution

det⁡(AB)=3(−2)=−6\det(AB) = 3(-2) = -6. det⁡(A−1B2)=13⋅(−2)2=43\det(A^{-1}B^2) = \tfrac{1}{3} \cdot (-2)^2 = \tfrac{4}{3}. det⁡(AT)=det⁡A=3\det(A^{T}) = \det A = 3.

52. Finding when a matrix is singular

Problem: For which kk is [123k]\begin{bmatrix} 1 & 2 \\ 3 & k \end{bmatrix} singular?

Show solution

k−6=0k - 6 = 0, so k=6k = 6. Then row 2 is three times row 1.

53. Vandermonde determinant

Problem: Compute det⁡[111124139]\det\begin{bmatrix} 1 & 1 & 1 \\ 1 & 2 & 4 \\ 1 & 3 & 9 \end{bmatrix}.

Show solution

This is a Vandermonde matrix with nodes 1,2,31, 2, 3, whose determinant is the product of all differences xj−xix_j - x_i with i<ji < j:

(2−1)(3−1)(3−2)=2(2 - 1)(3 - 1)(3 - 2) = 2

Because it is nonzero, exactly one parabola passes through any three points with x=1,2,3x = 1, 2, 3.

54. Volume of a parallelepiped

Problem: Find the volume of the box spanned by (1,0,0)(1, 0, 0), (1,2,0)(1, 2, 0) and (1,1,3)(1, 1, 3).

Show solutiondet⁡[111021003]=1⋅2⋅3=6\det\begin{bmatrix} 1 & 1 & 1 \\ 0 & 2 & 1 \\ 0 & 0 & 3 \end{bmatrix} = 1 \cdot 2 \cdot 3 = 6

The volume is ∣6∣=6|6| = 6.

55. A 4 × 4 determinant by elimination

Problem: Compute det⁡[1201013020111112]\det\begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & 1 & 3 & 0 \\ 2 & 0 & 1 & 1 \\ 1 & 1 & 1 & 2 \end{bmatrix}.

Show solution

Adding multiples of one row to another does not change the determinant. Clear column 1 (row 3 minus 2×2\times row 1, row 4 minus row 1), then column 2 using row 2:

[120101300−41−10−111]→[120101300013−10041]\begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & 1 & 3 & 0 \\ 0 & -4 & 1 & -1 \\ 0 & -1 & 1 & 1 \end{bmatrix} \to \begin{bmatrix} 1 & 2 & 0 & 1 \\ 0 & 1 & 3 & 0 \\ 0 & 0 & 13 & -1 \\ 0 & 0 & 4 & 1 \end{bmatrix}

Finally row 4 minus 413\tfrac{4}{13} row 3 leaves 1+413=17131 + \tfrac{4}{13} = \tfrac{17}{13} in the corner. The determinant is 1⋅1⋅13⋅1713=171 \cdot 1 \cdot 13 \cdot \tfrac{17}{13} = 17.

Matrix inverses

56. Inverse of a 2 × 2 matrix

Problem: Invert A=[4726]A = \begin{bmatrix} 4 & 7 \\ 2 & 6 \end{bmatrix}.

Show solution

det⁡A=24−14=10\det A = 24 - 14 = 10. Swap the diagonal, negate the off-diagonal and divide by the determinant:

A−1=110[6−7−24]A^{-1} = \frac{1}{10}\begin{bmatrix} 6 & -7 \\ -2 & 4 \end{bmatrix}

Check: the top-left entry of AA−1AA^{-1} is 24−1410=1\tfrac{24 - 14}{10} = 1.

57. Inverse of a 3 × 3 matrix by Gauss–Jordan

Problem: Invert A=[123014560]A = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 4 \\ 5 & 6 & 0 \end{bmatrix}.

Show solution

Row-reduce [A∣I][A \mid I] until the left block is II. The determinant is 1(0−24)−2(0−20)+3(0−5)=11(0 - 24) - 2(0 - 20) + 3(0 - 5) = 1, so the inverse has integer entries:

A−1=[−2418520−15−4−541]A^{-1} = \begin{bmatrix} -24 & 18 & 5 \\ 20 & -15 & -4 \\ -5 & 4 & 1 \end{bmatrix}

Check: row 1 of AA times column 1 of A−1A^{-1}: −24+40−15=1-24 + 40 - 15 = 1.

58. Solving a system with an inverse

Problem: Solve 4x+7y=14x + 7y = 1, 2x+6y=22x + 6y = 2 using problem 56.

Show solutionx=A−1b=110[6−14−2+8]=[−0.80.6]\mathbf{x} = A^{-1}\mathbf{b} = \frac{1}{10}\begin{bmatrix} 6 - 14 \\ -2 + 8 \end{bmatrix} = \begin{bmatrix} -0.8 \\ 0.6 \end{bmatrix}

Check: 4(−0.8)+7(0.6)=14(-0.8) + 7(0.6) = 1 and 2(−0.8)+6(0.6)=22(-0.8) + 6(0.6) = 2. In software, call a solver (such as numpy.linalg.solve) rather than forming the inverse; it is faster and more accurate.

59. Inverse of a product

Problem: Show that (AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}.

Show solution

(AB)(B−1A−1)=A(BB−1)A−1=AIA−1=I(AB)(B^{-1}A^{-1}) = A(BB^{-1})A^{-1} = AIA^{-1} = I. The order reverses, like taking off socks and shoes.

60. Inverse of an orthogonal matrix

Problem: Find the inverse of the rotation R=[cos⁡θ−sin⁡θsin⁡θcos⁡θ]R = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}.

Show solution

Its columns are orthonormal, so R−1=RT=[cos⁡θsin⁡θ−sin⁡θcos⁡θ]R^{-1} = R^{T} = \begin{bmatrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{bmatrix}, which is rotation by −θ-\theta.

61. A matrix with no inverse

Problem: Show that [2412]\begin{bmatrix} 2 & 4 \\ 1 & 2 \end{bmatrix} is not invertible in two ways.

Show solution

The determinant is 4−4=04 - 4 = 0. Also, (2,−1)(2, -1) is a nonzero vector in the null space: 2⋅2+4⋅(−1)=02 \cdot 2 + 4 \cdot (-1) = 0 and 2−2=02 - 2 = 0. A matrix that sends a nonzero vector to zero cannot be undone.

62. Sherman–Morrison formula

Problem: Use (I+uvT)−1=I−uvT1+vTu(I + \mathbf{u}\mathbf{v}^{T})^{-1} = I - \dfrac{\mathbf{u}\mathbf{v}^{T}}{1 + \mathbf{v}^{T}\mathbf{u}} with u=(1,0)\mathbf{u} = (1, 0) and v=(1,1)\mathbf{v} = (1, 1).

Show solution

I+uvT=[2101]I + \mathbf{u}\mathbf{v}^{T} = \begin{bmatrix} 2 & 1 \\ 0 & 1 \end{bmatrix} and vTu=1\mathbf{v}^{T}\mathbf{u} = 1, so

(I+uvT)−1=I−12[1100]=[0.5−0.501](I + \mathbf{u}\mathbf{v}^{T})^{-1} = I - \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 0.5 & -0.5 \\ 0 & 1 \end{bmatrix}

Check: the 2 × 2 formula gives 12[1−102]\tfrac{1}{2}\begin{bmatrix} 1 & -1 \\ 0 & 2 \end{bmatrix}, the same matrix. The formula lets software update an inverse after a rank-one change without starting over.

Vector spaces and subspaces

63. Is it a subspace?

Problem: Which of these are subspaces of R2\mathbb{R}^2: the line y=2xy = 2x, the line y=2x+1y = 2x + 1?

Show solution

y=2xy = 2x is a subspace: it contains 0\mathbf{0} and is closed under addition and scaling. y=2x+1y = 2x + 1 is not, because it does not contain (0,0)(0, 0).

64. Symmetric matrices as a subspace

Problem: Show that the 2×22 \times 2 symmetric matrices form a subspace and find its dimension.

Show solution

Sums and multiples of symmetric matrices are symmetric, and the zero matrix is symmetric. Every such matrix is

[abbc]=a[1000]+b[0110]+c[0001]\begin{bmatrix} a & b \\ b & c \end{bmatrix} = a\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} + b\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} + c\begin{bmatrix} 0 & 0 \\ 0 & 1 \end{bmatrix}

These three matrices form a basis, so the dimension is 3.

65. Coordinates in a non-standard basis

Problem: Find the coordinates of p(x)=3−2x+5x2p(x) = 3 - 2x + 5x^2 in the basis {1,  1+x,  1+x+x2}\{1,\; 1 + x,\; 1 + x + x^2\}.

Show solution

Write p=a+b(1+x)+c(1+x+x2)p = a + b(1 + x) + c(1 + x + x^2) and match coefficients from the highest power down: x2x^2: c=5c = 5; xx: b+c=−2b + c = -2, so b=−7b = -7; constant: a+b+c=3a + b + c = 3, so a=5a = 5. Coordinates: (5,−7,5)(5, -7, 5).

Check: 5−7(1+x)+5(1+x+x2)=3−2x+5x25 - 7(1 + x) + 5(1 + x + x^2) = 3 - 2x + 5x^2.

66. Rank of a matrix

Problem: Find the rank of A=[123246101]A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 1 & 0 & 1 \end{bmatrix}.

Show solution

Row 2 is twice row 1. Rows 1 and 3 are not multiples of each other. Elimination leaves two nonzero rows, so the rank is 2.

67. Basis for a null space

Problem: Find the null space of [123456789]\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}.

Show solution

Elimination gives x−z=0x - z = 0 and y+2z=0y + 2z = 0. With z=tz = t: x=t(1,−2,1)\mathbf{x} = t(1, -2, 1), so the columns satisfy c1−2c2+c3=0\mathbf{c}_1 - 2\mathbf{c}_2 + \mathbf{c}_3 = \mathbf{0}. Problem 16 found the same coefficients for the rows.

68. Rank–nullity theorem

Problem: A 3×53 \times 5 matrix has rank 2. What is the dimension of its null space?

Show solution

rank+nullity=number of columns\text{rank} + \text{nullity} = \text{number of columns}, so the nullity is 5−2=35 - 2 = 3.

69. The four fundamental subspaces

Problem: Find bases for the four fundamental subspaces of A=[1224]A = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}.

Show solution
  • Column space: multiples of (1,2)(1, 2).
  • Null space: x+2y=0x + 2y = 0, so multiples of (−2,1)(-2, 1).
  • Row space: multiples of (1,2)(1, 2) (the matrix is symmetric).
  • Left null space (null space of ATA^{T}): multiples of (−2,1)(-2, 1).

Check: the row space is perpendicular to the null space: (1,2)⋅(−2,1)=0(1, 2) \cdot (-2, 1) = 0.

70. Change of basis

Problem: Find the coordinates of (4,3)(4, 3) in the basis {(2,1),(1,1)}\{(2, 1), (1, 1)\}.

Show solution

Solve 2a+b=42a + b = 4 and a+b=3a + b = 3: subtracting gives a=1a = 1, then b=2b = 2. Coordinates: (1,2)(1, 2). Equivalently, multiply by P−1P^{-1} where P=[2111]P = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} has the basis vectors as columns.

71. Dimension of a solution space

Problem: What is the dimension of the subspace x+y+z+w=0x + y + z + w = 0 in R4\mathbb{R}^4?

Show solution

One equation of rank 1 on 4 unknowns leaves 4−1=34 - 1 = 3 free variables. A basis is (−1,1,0,0)(-1, 1, 0, 0), (−1,0,1,0)(-1, 0, 1, 0), (−1,0,0,1)(-1, 0, 0, 1).

72. Intersection of two subspaces

Problem: Find the intersection of the planes x+y+z=0x + y + z = 0 and x−y=0x - y = 0.

Show solution

From the second, y=xy = x; then z=−2xz = -2x. The intersection is the line spanned by (1,1,−2)(1, 1, -2).

Linear transformations

73. Is the map linear?

Problem: Which is linear: T1(x,y)=(x+y,2x)T_1(x, y) = (x + y, 2x) or T2(x,y)=(x+1,y)T_2(x, y) = (x + 1, y)?

Show solution

T1T_1 is linear: it is multiplication by [1120]\begin{bmatrix} 1 & 1 \\ 2 & 0 \end{bmatrix}. T2T_2 is not, because T2(0,0)=(1,0)≠(0,0)T_2(0, 0) = (1, 0) \ne (0, 0); a linear map must send zero to zero.

74. Matrix of a transformation

Problem: Find the matrix of T(x,y,z)=(x+2y,  3z−y)T(x, y, z) = (x + 2y,\; 3z - y).

Show solution

The columns are the images of the standard basis vectors: T(e1)=(1,0)T(\mathbf{e}_1) = (1, 0), T(e2)=(2,−1)T(\mathbf{e}_2) = (2, -1), T(e3)=(0,3)T(\mathbf{e}_3) = (0, 3).

[1200−13]\begin{bmatrix} 1 & 2 & 0 \\ 0 & -1 & 3 \end{bmatrix}

75. Rotation by 30 degrees

Problem: Rotate (1,0)(1, 0) by 30∘30^\circ.

Show solution[cos⁡30∘−sin⁡30∘sin⁡30∘cos⁡30∘][10]=[3/21/2]\begin{bmatrix} \cos 30^\circ & -\sin 30^\circ \\ \sin 30^\circ & \cos 30^\circ \end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} \sqrt{3}/2 \\ 1/2 \end{bmatrix}

76. Composing transformations

Problem: Rotate by 90∘90^\circ, then reflect across the xx-axis. What single transformation is this?

Show solution

The matrix of "first RR, then FF" is FRFR:

FR=[100−1][0−110]=[0−1−10]FR = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}

This sends (x,y)(x, y) to (−y,−x)(-y, -x): reflection across the line y=−xy = -x.

77. Kernel and image

Problem: Find the kernel and image of T(x,y,z)=(x−y,  y−z)T(x, y, z) = (x - y,\; y - z).

Show solution

The kernel needs x=y=zx = y = z: the line spanned by (1,1,1)(1, 1, 1). The rank is 3−1=23 - 1 = 2, so the image is all of R2\mathbb{R}^2.

78. A shear preserves area

Problem: Show that the shear [1k01]\begin{bmatrix} 1 & k \\ 0 & 1 \end{bmatrix} preserves area for every kk.

Show solution

Its determinant is 1⋅1−k⋅0=11 \cdot 1 - k \cdot 0 = 1, so areas are multiplied by 1. A shear slides layers past each other, like pushing a deck of cards sideways.

79. Differentiation as a matrix

Problem: Find the matrix of D=ddxD = \frac{d}{dx} on polynomials of degree at most 2, in the basis {1,x,x2}\{1, x, x^2\}.

Show solution

D(1)=0D(1) = 0, D(x)=1D(x) = 1, D(x2)=2xD(x^2) = 2x. These images, written in coordinates, are the columns:

D=[010002000]D = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 2 \\ 0 & 0 & 0 \end{bmatrix}

Check: 3−2x+5x23 - 2x + 5x^2 has coordinates (3,−2,5)(3, -2, 5), and DD sends them to (−2,10,0)(-2, 10, 0), which is −2+10x-2 + 10x.

80. A matrix in a better basis

Problem: Write A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} in the basis {(1,1),(1,−1)}\{(1, 1), (1, -1)\}.

Show solution

A(1,1)=(3,3)=3(1,1)A(1, 1) = (3, 3) = 3(1, 1) and A(1,−1)=(1,−1)A(1, -1) = (1, -1). In this basis the transformation is simply [3001]\begin{bmatrix} 3 & 0 \\ 0 & 1 \end{bmatrix}: stretch by 3 along (1,1)(1, 1), leave (1,−1)(1, -1) alone. This is what diagonalization means (problem 87).

Eigenvalues and eigenvectors

81. Eigenvalues of a symmetric 2 × 2 matrix

Problem: Find the eigenvalues and eigenvectors of A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}.

Show solutiondet⁡(A−λI)=(2−λ)2−1=0⟹λ=3 or λ=1\det(A - \lambda I) = (2 - \lambda)^2 - 1 = 0 \quad\Longrightarrow\quad \lambda = 3 \text{ or } \lambda = 1

For λ=3\lambda = 3: (A−3I)x=0(A - 3I)\mathbf{x} = \mathbf{0} gives x=(1,1)\mathbf{x} = (1, 1). For λ=1\lambda = 1: x=(1,−1)\mathbf{x} = (1, -1).

Check: 3+1=4=tr⁡A3 + 1 = 4 = \operatorname{tr} A and 3⋅1=3=det⁡A3 \cdot 1 = 3 = \det A.

Left: the unit circle with three arrows: eigenvector directions (1, 1) and (1, −1) and the vector (1, 0). Right: after multiplying by A = [[2, 1], [1, 2]] the circle becomes a tilted ellipse; the (1, 1) arrow is stretched three times, the (1, −1) arrow is unchanged, and (1, 0) becomes (2, 1), which points in a new direction.
Problem 81: eigenvectors are the directions that A only stretches. The ellipse's axes lie along them, with half-lengths equal to the eigenvalues 3 and 1.

82. Eigenvalues of a non-symmetric matrix

Problem: Find the eigenvalues and eigenvectors of A=[4123]A = \begin{bmatrix} 4 & 1 \\ 2 & 3 \end{bmatrix}.

Show solutionλ2−7λ+10=0⟹λ=5 or λ=2\lambda^2 - 7\lambda + 10 = 0 \quad\Longrightarrow\quad \lambda = 5 \text{ or } \lambda = 2

For λ=5\lambda = 5: A−5I=[−112−2]A - 5I = \begin{bmatrix} -1 & 1 \\ 2 & -2 \end{bmatrix}, so x=(1,1)\mathbf{x} = (1, 1). For λ=2\lambda = 2: A−2I=[2121]A - 2I = \begin{bmatrix} 2 & 1 \\ 2 & 1 \end{bmatrix}, so x=(1,−2)\mathbf{x} = (1, -2).

Check: A(1,−2)=(2,−4)=2(1,−2)A(1, -2) = (2, -4) = 2(1, -2).

83. Eigenvalues of a triangular matrix

Problem: Find the eigenvalues of [37−10−25006]\begin{bmatrix} 3 & 7 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & 6 \end{bmatrix}.

Show solution

det⁡(A−λI)\det(A - \lambda I) is the product of the diagonal entries (3−λ)(−2−λ)(6−λ)(3 - \lambda)(-2 - \lambda)(6 - \lambda), so the eigenvalues are 33, −2-2 and 66.

84. Using trace and determinant

Problem: A 2×22 \times 2 matrix has trace 10 and determinant 21. Find its eigenvalues.

Show solution

They are the roots of λ2−10λ+21=0\lambda^2 - 10\lambda + 21 = 0: λ=3\lambda = 3 and λ=7\lambda = 7. Their sum is the trace and their product is the determinant.

85. Eigenvalues of a block matrix

Problem: Find the eigenvalues of [200034049]\begin{bmatrix} 2 & 0 & 0 \\ 0 & 3 & 4 \\ 0 & 4 & 9 \end{bmatrix}.

Show solution

The matrix is block diagonal, so its eigenvalues are 2 together with those of [3449]\begin{bmatrix} 3 & 4 \\ 4 & 9 \end{bmatrix}: λ2−12λ+11=0\lambda^2 - 12\lambda + 11 = 0, so λ=11\lambda = 11 and λ=1\lambda = 1. The eigenvalues are 2, 11 and 1.

86. Complex eigenvalues of a rotation

Problem: Find the eigenvalues of [0−110]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}.

Show solution

λ2+1=0\lambda^2 + 1 = 0, so λ=±i\lambda = \pm i. No real vector keeps its direction under a 90∘90^\circ rotation, which is why the eigenvalues are not real.

87. Diagonalization

Problem: Diagonalize A=[4123]A = \begin{bmatrix} 4 & 1 \\ 2 & 3 \end{bmatrix} from problem 82.

Show solution

Put the eigenvectors in the columns of PP and the eigenvalues on the diagonal of DD:

A=PDP−1,P=[111−2],D=[5002]A = PDP^{-1}, \qquad P = \begin{bmatrix} 1 & 1 \\ 1 & -2 \end{bmatrix}, \qquad D = \begin{bmatrix} 5 & 0 \\ 0 & 2 \end{bmatrix}

Check: AP=[525−4]=PDAP = \begin{bmatrix} 5 & 2 \\ 5 & -4 \end{bmatrix} = PD.

88. Fibonacci numbers from matrix powers

Problem: Use F=[1110]F = \begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix} to find the 10th Fibonacci number.

Show solution

Fn=[Fn+1FnFnFn−1]F^n = \begin{bmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{bmatrix}, and

F10=[89555534]F^{10} = \begin{bmatrix} 89 & 55 \\ 55 & 34 \end{bmatrix}

so F10=55F_{10} = 55. The eigenvalues of FF are φ=1+52\varphi = \tfrac{1 + \sqrt{5}}{2} and ψ=1−52\psi = \tfrac{1 - \sqrt{5}}{2}, which gives Binet's formula Fn=φn−ψn5F_n = \tfrac{\varphi^n - \psi^n}{\sqrt{5}}.

89. A matrix that cannot be diagonalized

Problem: Show that [1101]\begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} is not diagonalizable.

Show solution

The only eigenvalue is λ=1\lambda = 1 (repeated). A−I=[0100]A - I = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} has a one-dimensional null space spanned by (1,0)(1, 0). Two independent eigenvectors are needed to diagonalize a 2×22 \times 2 matrix, and there is only one.

90. Steady state of a Markov chain

Problem: Each day 90% of customers of shop A stay and 10% switch to B; B keeps 50% and loses 50% to A. Find the long-run market shares.

Show solution

With column-stochastic matrix P=[0.90.50.10.5]P = \begin{bmatrix} 0.9 & 0.5 \\ 0.1 & 0.5 \end{bmatrix}, the steady state is the eigenvector with λ=1\lambda = 1: Ps=sP\mathbf{s} = \mathbf{s}. The first row gives 0.9a+0.5b=a0.9a + 0.5b = a, so 0.1a=0.5b0.1a = 0.5b and a=5ba = 5b. Normalizing, s=(56,16)\mathbf{s} = \left(\tfrac{5}{6}, \tfrac{1}{6}\right).

Check: 0.9⋅56+0.5⋅16=4.5+0.56=560.9 \cdot \tfrac{5}{6} + 0.5 \cdot \tfrac{1}{6} = \tfrac{4.5 + 0.5}{6} = \tfrac{5}{6}.

91. Cayley–Hamilton theorem

Problem: Use Cayley–Hamilton to find the inverse of A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}.

Show solution

The characteristic polynomial is λ2−5λ−2\lambda^2 - 5\lambda - 2, and every matrix satisfies its own: A2−5A−2I=0A^2 - 5A - 2I = 0. Multiply by A−1A^{-1}: A−5I=2A−1A - 5I = 2A^{-1}, so

A−1=12(A−5I)=[−211.5−0.5]A^{-1} = \frac{1}{2}(A - 5I) = \begin{bmatrix} -2 & 1 \\ 1.5 & -0.5 \end{bmatrix}

This matches the 2 × 2 formula, 1−2[4−2−31]\tfrac{1}{-2}\begin{bmatrix} 4 & -2 \\ -3 & 1 \end{bmatrix}.

92. Solving a system of differential equations

Problem: Solve x′(t)=Ax(t)\mathbf{x}'(t) = A\mathbf{x}(t) with A=[4123]A = \begin{bmatrix} 4 & 1 \\ 2 & 3 \end{bmatrix}.

Show solution

Each eigenpair from problem 82 gives a solution eλtve^{\lambda t}\mathbf{v}:

x(t)=c1e5t[11]+c2e2t[1−2]\mathbf{x}(t) = c_1 e^{5t}\begin{bmatrix} 1 \\ 1 \end{bmatrix} + c_2 e^{2t}\begin{bmatrix} 1 \\ -2 \end{bmatrix}

The constants come from the initial condition. As tt grows, the e5te^{5t} term dominates, so solutions line up with (1,1)(1, 1).

Orthogonality, least squares and decompositions

93. Gram–Schmidt process

Problem: Orthonormalize a1=(1,1,0)\mathbf{a}_1 = (1, 1, 0) and a2=(1,0,1)\mathbf{a}_2 = (1, 0, 1).

Show solution

q1=12(1,1,0)\mathbf{q}_1 = \tfrac{1}{\sqrt{2}}(1, 1, 0). Remove from a2\mathbf{a}_2 its component along q1\mathbf{q}_1:

a2−(q1⋅a2)q1=(1,0,1)−12(1,1,0)=(12,−12,1)\mathbf{a}_2 - (\mathbf{q}_1 \cdot \mathbf{a}_2)\mathbf{q}_1 = (1, 0, 1) - \tfrac{1}{2}(1, 1, 0) = \left(\tfrac{1}{2}, -\tfrac{1}{2}, 1\right)

Its length is 3/2\sqrt{3/2}, so q2=16(1,−1,2)\mathbf{q}_2 = \tfrac{1}{\sqrt{6}}(1, -1, 2).

Check: q1⋅q2=1−1+012=0\mathbf{q}_1 \cdot \mathbf{q}_2 = \tfrac{1 - 1 + 0}{\sqrt{12}} = 0.

94. QR decomposition

Problem: Factor A=[111001]A = \begin{bmatrix} 1 & 1 \\ 1 & 0 \\ 0 & 1 \end{bmatrix} as QRQR.

Show solution

The columns of AA are the vectors from problem 93, so Q=[q1  q2]Q = [\mathbf{q}_1 \; \mathbf{q}_2]. RR records the dot products and lengths from Gram–Schmidt:

R=[21/203/2]R = \begin{bmatrix} \sqrt{2} & 1/\sqrt{2} \\ 0 & \sqrt{3/2} \end{bmatrix}

Check: the first column of QRQR is 2 q1=(1,1,0)\sqrt{2}\,\mathbf{q}_1 = (1, 1, 0).

95. Least squares line of best fit

Problem: Fit y=c+mxy = c + mx to the points (0,1)(0, 1), (1,3)(1, 3), (2,4)(2, 4), (3,4)(3, 4).

Show solution

The system Ax=bA\mathbf{x} = \mathbf{b} has no exact solution, so solve the normal equations ATAx^=ATbA^{T}A\hat{\mathbf{x}} = A^{T}\mathbf{b}:

A=[10111213],ATA=[46614],ATb=[1223]A = \begin{bmatrix} 1 & 0 \\ 1 & 1 \\ 1 & 2 \\ 1 & 3 \end{bmatrix}, \quad A^{T}A = \begin{bmatrix} 4 & 6 \\ 6 & 14 \end{bmatrix}, \quad A^{T}\mathbf{b} = \begin{bmatrix} 12 \\ 23 \end{bmatrix}

Solving gives c=1.5c = 1.5 and m=1m = 1: the line y=1.5+xy = 1.5 + x.

Check: the residuals are −0.5,0.5,0.5,−0.5-0.5, 0.5, 0.5, -0.5. They sum to zero and are orthogonal to the xx values: 0+0.5+1−1.5=00 + 0.5 + 1 - 1.5 = 0.

Four data points (0, 1), (1, 3), (2, 4), (3, 4) with the best-fit line y = 1.5 + x. Dashed vertical segments show residuals of 0.5 between each point and the line; their squares sum to 1.
Problem 95: least squares chooses the line that minimizes the sum of the squared vertical distances.

96. Projection onto a column space

Problem: Using problem 95, find the projection of b=(1,3,4,4)\mathbf{b} = (1, 3, 4, 4) onto the column space of AA.

Show solution

The projection is Ax^=(1.5,2.5,3.5,4.5)A\hat{\mathbf{x}} = (1.5, 2.5, 3.5, 4.5): the fitted values. The error b−Ax^=(−0.5,0.5,0.5,−0.5)\mathbf{b} - A\hat{\mathbf{x}} = (-0.5, 0.5, 0.5, -0.5) is perpendicular to both columns of AA, which is exactly what the normal equations say.

97. Orthogonal diagonalization of a symmetric matrix

Problem: Write A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} as QΛQTQ\Lambda Q^{T}.

Show solution

Normalize the eigenvectors from problem 81:

Q=12[111−1],Λ=[3001]Q = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}, \qquad \Lambda = \begin{bmatrix} 3 & 0 \\ 0 & 1 \end{bmatrix}

By the spectral theorem every real symmetric matrix has real eigenvalues and orthonormal eigenvectors, so Q−1=QTQ^{-1} = Q^{T}.

98. Testing positive definiteness

Problem: Is A=[2−1−12]A = \begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix} positive definite?

Show solution

Three equivalent tests all say yes:

  • Eigenvalues: λ2−4λ+3=0\lambda^2 - 4\lambda + 3 = 0 gives 1 and 3, both positive.
  • Leading minors: 2>02 > 0 and det⁡A=3>0\det A = 3 > 0.
  • Energy: xTAx=2x2−2xy+2y2=x2+y2+(x−y)2>0\mathbf{x}^{T}A\mathbf{x} = 2x^2 - 2xy + 2y^2 = x^2 + y^2 + (x - y)^2 > 0 for every nonzero (x,y)(x, y).

99. Singular value decomposition

Problem: Find the singular values of A=[3045]A = \begin{bmatrix} 3 & 0 \\ 4 & 5 \end{bmatrix} and the singular vectors.

Show solutionATA=[25202025]A^{T}A = \begin{bmatrix} 25 & 20 \\ 20 & 25 \end{bmatrix}

has eigenvalues 45 and 5 with eigenvectors v1=12(1,1)\mathbf{v}_1 = \tfrac{1}{\sqrt{2}}(1, 1) and v2=12(1,−1)\mathbf{v}_2 = \tfrac{1}{\sqrt{2}}(1, -1). The singular values are σ1=45=35\sigma_1 = \sqrt{45} = 3\sqrt{5} and σ2=5\sigma_2 = \sqrt{5}. The left singular vectors are ui=Avi/σi\mathbf{u}_i = A\mathbf{v}_i / \sigma_i:

u1=110(1,3),u2=110(3,−1)\mathbf{u}_1 = \tfrac{1}{\sqrt{10}}(1, 3), \qquad \mathbf{u}_2 = \tfrac{1}{\sqrt{10}}(3, -1)

Check: σ1σ2=15=∣det⁡A∣\sigma_1\sigma_2 = 15 = |\det A|.

100. Best rank-one approximation

Problem: Find the best rank-one approximation to AA from problem 99 and its error.

Show solution

Keep only the largest singular value (Eckart–Young theorem):

A1=σ1u1v1T=32[1133]=[1.51.54.54.5]A_1 = \sigma_1\mathbf{u}_1\mathbf{v}_1^{T} = \frac{3}{2}\begin{bmatrix} 1 & 1 \\ 3 & 3 \end{bmatrix} = \begin{bmatrix} 1.5 & 1.5 \\ 4.5 & 4.5 \end{bmatrix}

The error A−A1=[1.5−1.5−0.50.5]A - A_1 = \begin{bmatrix} 1.5 & -1.5 \\ -0.5 & 0.5 \end{bmatrix} has Frobenius norm 2.25+2.25+0.25+0.25=5=σ2\sqrt{2.25 + 2.25 + 0.25 + 0.25} = \sqrt{5} = \sigma_2. The same idea compresses images and powers principal component analysis.

101. Condition number

Problem: Find the condition number of AA from problem 99, and explain why B=[1111.0001]B = \begin{bmatrix} 1 & 1 \\ 1 & 1.0001 \end{bmatrix} is dangerous to solve with.

Show solution

κ(A)=σ1/σ2=35/5=3\kappa(A) = \sigma_1 / \sigma_2 = 3\sqrt{5} / \sqrt{5} = 3: well-conditioned. For BB, κ(B)≈40 002\kappa(B) \approx 40\,002. A relative error in the data can be amplified by up to that factor in the solution, so about 4 to 5 significant digits can be lost. Change the right-hand side from (2,2)(2, 2) to (2,2.0001)(2, 2.0001) and the solution jumps from (2,0)(2, 0) to (1,1)(1, 1).

Common mistakes

  • Treating matrix multiplication as commutative. AB≠BAAB \ne BA in general (problem 23), and (AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}, not A−1B−1A^{-1}B^{-1}.
  • Forgetting that a subspace must contain zero. A line or plane that misses the origin is not a subspace (problem 63).
  • Assuming det⁡(A+B)=det⁡A+det⁡B\det(A + B) = \det A + \det B. Only products split: det⁡(AB)=det⁡Adet⁡B\det(AB) = \det A \det B. And det⁡(kA)=kndet⁡A\det(kA) = k^n\det A, not kdet⁡Ak\det A (problem 50).
  • Counting rows instead of pivots. Rank is the number of pivots after elimination, not the number of rows (problem 66).
  • Expecting every matrix to be diagonalizable. A repeated eigenvalue can come with too few eigenvectors (problem 89).
  • Forming A−1A^{-1} to solve Ax=bA\mathbf{x} = \mathbf{b}. Elimination or a library solver is faster and more stable (problem 58), and an ill-conditioned matrix loses accuracy either way (problem 101).
  • Mixing up which side the eigenvector goes on. Av=λvA\mathbf{v} = \lambda\mathbf{v} uses column vectors on the right. In row-vector code such as xP\mathbf{x}P for Markov chains, the steady state is a left eigenvector.

Next steps

References