Chapter 9 Exercises — The Inverse Matrix

Work these with pencil first; reach for numpy only where a problem says "code" or asks you to verify. Throughout, $I$ is the identity, "invertible" means a two-sided inverse exists, and all matrices are real. Tiers: ⭐ conceptual · ⭐⭐ computation (by hand) · ⭐⭐⭐ proof (A) / coding (C) · ⭐⭐⭐⭐ application.

The single habit to practice everywhere: the inverse is the transformation that undoes $A$, and it exists exactly when $A$ loses no dimension.


⭐ Conceptual (warm-ups)

9.1. In one sentence each, state what $A^{-1}$ does geometrically and what equations define it.

9.2. True or false, with a one-line reason each: (a) Every square matrix has an inverse. (b) A matrix with a column of all zeros is singular. (c) If $\det(A) = 0$ then $A$ is invertible. (d) The inverse of a rotation is a rotation. (e) $(AB)^{-1} = A^{-1}B^{-1}$ for all invertible $A, B$.

9.3. A transformation squashes the whole plane onto a single line through the origin. Is it invertible? Explain in terms of information lost.

9.4. List four equivalent conditions, from the Invertible Matrix Theorem, for a square matrix $A$ to be invertible. For each, state the geometric meaning in a few words.

9.5. Why is $(AB)^{-1} = B^{-1}A^{-1}$ rather than $A^{-1}B^{-1}$? Give the "socks and shoes" explanation in one sentence.

9.6. You need to solve $A\mathbf{x} = \mathbf{b}$ once for a $1000\times 1000$ matrix $A$. Should you compute np.linalg.inv(A) @ b or np.linalg.solve(A, b)? Give two reasons.

9.7. A classmate says "the determinant of my matrix is $0.0001$, so it's almost singular and I shouldn't trust the inverse." Is the size of a nonzero determinant a reliable measure of near-singularity? What is the right measure (name it)?

9.8. Which of the six standard transformations from Chapter 7 (identity, scaling, rotation, shear, reflection, projection) is the only one with no inverse, and why?


⭐⭐ Computation (by hand)

9.9. Use the $2\times 2$ shortcut to invert each, or state that it's singular: (a) $\begin{bmatrix}4 & 3 \\ 1 & 1\end{bmatrix}$ (b) $\begin{bmatrix}2 & 4 \\ 1 & 2\end{bmatrix}$ (c) $\begin{bmatrix}0 & -1 \\ 1 & 0\end{bmatrix}$ (d) $\begin{bmatrix}5 & 0 \\ 0 & 2\end{bmatrix}$.

9.10. Invert $A = \begin{bmatrix}1 & 2 & 3 \\ 0 & 1 & 4 \\ 0 & 0 & 1\end{bmatrix}$ by Gauss-Jordan on $[A\,|\,I]$. (It's upper-triangular with $1$s on the diagonal, so the work is light.) Verify your answer satisfies $AA^{-1} = I$ by hand.

9.11. Invert $A = \begin{bmatrix}2 & 1 & 0 \\ 1 & 2 & 1 \\ 0 & 1 & 2\end{bmatrix}$ by Gauss-Jordan, showing each augmented-matrix step. (The determinant is $4$; expect clean quarters.)

9.12. For each matrix, decide invertibility without computing an inverse — name which face of the Invertible Matrix Theorem you used: (a) $\begin{bmatrix}1 & 2 \\ 3 & 6\end{bmatrix}$ (b) $\begin{bmatrix}1 & 0 & 5 \\ 0 & 2 & 1 \\ 0 & 0 & 3\end{bmatrix}$ (c) $\begin{bmatrix}1 & 1 & 1 \\ 2 & 2 & 2 \\ 3 & 1 & 4\end{bmatrix}$.

9.13. Without inverting, write down the inverse of each standard transformation by geometry: (a) scaling $\begin{bmatrix}3 & 0 \\ 0 & \tfrac14\end{bmatrix}$; (b) rotation by $60°$; (c) the shear $\begin{bmatrix}1 & 0 \\ 5 & 1\end{bmatrix}$; (d) reflection across the line $y = x$, $\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}$.

9.14. Let $A = \begin{bmatrix}2 & 0 \\ 0 & 3\end{bmatrix}$ and $B = \begin{bmatrix}1 & 1 \\ 0 & 1\end{bmatrix}$. Compute $A^{-1}$, $B^{-1}$, $(AB)^{-1}$, and $B^{-1}A^{-1}$ by hand and confirm the last two agree. Then compute $A^{-1}B^{-1}$ and confirm it is different.

9.15. For $A = \begin{bmatrix}3 & 1 \\ 2 & 1\end{bmatrix}$, compute $A^{-1}$, then verify the property $\det(A^{-1}) = 1/\det(A)$ numerically (by hand).

9.16. Solve the system $\begin{cases} 2x + y = 5 \\ x + 3y = 10 \end{cases}$ two ways: (a) by writing it as $A\mathbf{x} = \mathbf{b}$ and computing $\mathbf{x} = A^{-1}\mathbf{b}$; (b) by Gaussian elimination directly. Confirm you get the same $\mathbf{x}$ and comment on which you'd prefer for a large system.

9.17. Show by hand that $\begin{bmatrix}1 & 0 \\ 0 & -1\end{bmatrix}$ is its own inverse, and explain geometrically why a reflection always satisfies $A^{-1} = A$.


⭐⭐⭐ Proof (A) and Coding (C)

9.18. (Proof) Prove that if $A$ is invertible then its inverse is unique: suppose $B$ and $C$ both satisfy $AB = BA = I$ and $AC = CA = I$, and show $B = C$. (Hint: consider $BAC$ and use associativity.)

9.19. (Proof) Prove the order-reversal rule $(AB)^{-1} = B^{-1}A^{-1}$ for invertible $A, B$ by verifying that $B^{-1}A^{-1}$ satisfies the definition of $(AB)^{-1}$ on both sides.

9.20. (Proof) Prove $(A^{\mathsf{T}})^{-1} = (A^{-1})^{\mathsf{T}}$ for invertible $A$. (Hint: transpose the equation $A A^{-1} = I$ using $(XY)^{\mathsf{T}} = Y^{\mathsf{T}}X^{\mathsf{T}}$.) Deduce that the inverse of a symmetric matrix is symmetric.

9.21. (Proof) Prove that a square matrix $A$ is invertible if and only if its null space is trivial (the only solution of $A\mathbf{x} = \mathbf{0}$ is $\mathbf{x} = \mathbf{0}$). Use the fact that $n$ linearly independent vectors in $\mathbb{R}^n$ form a basis.

9.22. (Proof) Suppose $A$ and $B$ are $n\times n$ and $AB$ is invertible. Prove that both $A$ and $B$ are invertible. (Hint: show $B$ has trivial null space, then handle $A$.)

9.23. (Coding, C) Implement inverse(A) from scratch in toolkit/inverse.py via Gauss-Jordan on $[A\,|\,I]$, reusing row_reduce from Chapter 4's toolkit/linear_systems.py, as in the Build Your Toolkit callout. Verify against np.linalg.inv for 100 random invertible matrices (use np.allclose), and confirm it raises ValueError on [[1, 2], [2, 4]]. Print "all passed."

9.24. (Coding, C) Write a function is_invertible(A) that returns True/False by row-reducing $[A]$ and checking for a pivot in every column (do not call np.linalg.det or np.linalg.inv). Test it against np.linalg.matrix_rank(A) == A.shape[0] on a mix of singular and nonsingular matrices.

9.25. (Coding, C) Empirically compare np.linalg.solve(A, b) against np.linalg.inv(A) @ b for a moderately ill-conditioned matrix (e.g. a $30\times 30$ Hilbert matrix, scipy.linalg.hilbert(30)). Compute the residual $\lVert A\mathbf{x} - \mathbf{b}\rVert$ for each route and report which is smaller. In a comment, connect the result to §9.8's accuracy argument.

9.26. (Coding, C) Using the recurring visualize_2d from toolkit/visualizer.py (do not modify it), produce a single figure with three subplots showing a matrix $A = \begin{bmatrix}1 & 1 \\ 0 & 2\end{bmatrix}$, its inverse $A^{-1}$, and the product $A^{-1}A$. Confirm visually that the third panel restores the unit square, and that the printed determinants are reciprocals.


⭐⭐⭐⭐ Application

9.27. (Cryptography / Hill cipher) The Hill cipher encrypts pairs of letters (A=0, …, Z=25) by $\mathbf{c} = K\mathbf{p} \bmod 26$ for a key matrix $K$. (a) For $K = \begin{bmatrix}3 & 3 \\ 2 & 5\end{bmatrix}$, encrypt the pair "HI" $= (7, 8)$. (b) The decryption key is $K^{-1} \bmod 26$; given that it equals $\begin{bmatrix}15 & 17 \\ 20 & 9\end{bmatrix}$, decrypt your ciphertext and confirm you recover "HI." (c) Explain why $K$ must have a determinant coprime to $26$ to be usable — connect this to the chapter's invertibility conditions. (Full development in Case Study 1.)

9.28. (Economics / Leontief model) A two-sector economy has consumption matrix $C = \begin{bmatrix}0.2 & 0.3 \\ 0.4 & 0.1\end{bmatrix}$. (a) Form $I - C$ and check it is invertible (compute its determinant). (b) Compute the Leontief inverse $(I - C)^{-1}$ and, for final demand $\mathbf{d} = (90, 60)$, the total output $\mathbf{x} = (I - C)^{-1}\mathbf{d}$ (numpy allowed). (c) Verify $\mathbf{x} - C\mathbf{x} = \mathbf{d}$. (d) In one sentence, explain what it would mean economically if $I - C$ were singular.

9.29. (Graphics / color) A white-balance correction multiplies each pixel's RGB vector by $M = \begin{bmatrix}1.2 & 0 & 0 \\ 0 & 1.0 & 0 \\ 0 & 0 & 0.8\end{bmatrix}$. (a) Is $M$ invertible? Write $M^{-1}$ by inspection (it's diagonal). (b) A pixel reads $(200, 150, 100)$ after correction; what was its original color? (c) Now suppose a buggy transform used $M' = \begin{bmatrix}1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1\end{bmatrix}$ (averaging-like). Show $M'$ is singular and explain, in terms of lost information, why the original colors cannot be recovered.

9.30. (Circuits / linear models) A resistor network's node voltages $\mathbf{v}$ satisfy $G\mathbf{v} = \mathbf{i}$, where $G$ is the (symmetric) conductance matrix and $\mathbf{i}$ is the vector of injected currents. For $G = \begin{bmatrix}3 & -1 & -1 \\ -1 & 2 & -1 \\ -1 & -1 & 2\end{bmatrix}$ and $\mathbf{i} = (5, 0, 0)$: (a) Is $G$ invertible? (b) Find the node voltages by solving $G\mathbf{v} = \mathbf{i}$ with np.linalg.solve (not by inverting). (c) Explain in one sentence why an engineer simulating thousands of current scenarios on the same network might still precompute and store $G^{-1}$ — i.e. when the inverse-as-object is genuinely worth it (see §9.8).