Chapter 16 Exercises — Change of Basis

Work the conceptual tiers first; they build the intuition the computational and proof problems lean on. Problems are graded ⭐ (conceptual) → ⭐⭐ (hand computation) → ⭐⭐⭐ (proof / coding) → ⭐⭐⭐⭐ (application). A problem marked [proof] asks for a rigorous argument; [code] asks for a short numpy script (and, where noted, a from-scratch implementation). Throughout, $P$ denotes a change-of-basis matrix whose columns are the new basis vectors written in the old coordinates, so $[\mathbf{v}]_{\text{old}} = P[\mathbf{v}]_{\text{new}}$ and $[\mathbf{v}]_{\text{new}} = P^{-1}[\mathbf{v}]_{\text{old}}$.

Tier 1 — Conceptual (⭐)

16.1 ⭐ In one sentence each, explain what the change-of-basis matrix $P$ does and what its inverse $P^{-1}$ does, in terms of "old" and "new" coordinates.

16.2 ⭐ A vector $\mathbf{v}$ has standard coordinates $(4, 2)$ and new-basis coordinates $(3, -1)$. Did the vector move? Explain what did change.

16.3 ⭐ True or false, with a one-line reason: "The columns of $P$ are the new basis vectors written in the new coordinates."

16.4 ⭐ Two matrices $A$ and $B$ are similar. Name three quantities that must be equal for both, and one structural property (e.g. being diagonal) that need not be.

16.5 ⭐ Why is the change-of-basis matrix $P$ always invertible? Tie your answer to a property of a basis.

16.6 ⭐ In the similarity formula $B = P^{-1}AP$, read right-to-left and describe the three "verbs" the formula performs on a new-coordinate input vector.

16.7 ⭐ A symmetric matrix is conjugated by some invertible $P$. Is the result necessarily symmetric? Give the conceptual reason (you may cite an example from the chapter).

Tier 2 — Hand computation (⭐⭐)

16.8 ⭐⭐ Let the new basis be $\mathbf{b}_1 = (3, 1)$, $\mathbf{b}_2 = (1, 1)$ (in standard coordinates). Write down $P$, compute $\det P$, and compute $P^{-1}$ by hand using the $2\times 2$ inverse formula.

16.9 ⭐⭐ Using your $P$ from 16.8, convert the standard vector $\mathbf{v} = (5, 3)$ to the new basis (compute $[\mathbf{v}]_{\text{new}} = P^{-1}\mathbf{v}$). Then verify by checking that your coefficients rebuild $\mathbf{v}$ as a combination of $\mathbf{b}_1, \mathbf{b}_2$.

16.10 ⭐⭐ For the same basis, run the round trip: take your $[\mathbf{v}]_{\text{new}}$ from 16.9 and compute $P[\mathbf{v}]_{\text{new}}$. Confirm you recover $(5,3)$, and state in one sentence why the round trip must return the original.

16.11 ⭐⭐ Let $\mathbf{b}_1 = (1, 2)$, $\mathbf{b}_2 = (2, 3)$. Find the new-basis coordinates of each standard basis vector $\mathbf{e}_1 = (1,0)$ and $\mathbf{e}_2 = (0,1)$. (Hint: these are the columns of $P^{-1}$.)

16.12 ⭐⭐ Given $A = \begin{bmatrix} 0 & 2 \\ 2 & 0 \end{bmatrix}$ and the basis $\mathbf{b}_1 = (1,1)$, $\mathbf{b}_2 = (1,-1)$, compute the similar matrix $B = P^{-1}AP$ by hand. Confirm that $\operatorname{tr}(B) = \operatorname{tr}(A)$ and $\det(B) = \det(A)$.

16.13 ⭐⭐ Two bases $\mathcal{U}$ and $\mathcal{W}$ of $\mathbb{R}^2$ are $\mathcal{U} = \{(1,0),(1,1)\}$ and $\mathcal{W} = \{(2,1),(1,2)\}$ (vectors given in standard coordinates). A vector has $\mathcal{U}$-coordinates $(3, 4)$. Find its $\mathcal{W}$-coordinates using $[\mathbf{v}]_{\mathcal{W}} = P_{\mathcal{W}}^{-1}P_{\mathcal{U}}[\mathbf{v}]_{\mathcal{U}}$.

16.14 ⭐⭐ For the staircase basis $\mathbf{b}_1=(1,0,0)$, $\mathbf{b}_2=(1,1,0)$, $\mathbf{b}_3=(1,1,1)$, write $P$ and $P^{-1}$, then convert the standard vector $(7, 4, 2)$ to the new basis by hand.

16.15 ⭐⭐ The matrix $A = \begin{bmatrix} 4 & 0 \\ 0 & 1 \end{bmatrix}$ is already diagonal in the standard basis. Conjugate it by the rotation basis $\mathbf{b}_1 = (1,1)/\sqrt2$, $\mathbf{b}_2 = (-1,1)/\sqrt2$ and show the result is no longer diagonal. What does this say about choosing the "wrong" basis?

Tier 3 — Proof and coding (⭐⭐⭐)

16.16 ⭐⭐⭐ [proof] Prove that the determinant is a similarity invariant: if $B = P^{-1}AP$ with $P$ invertible, then $\det(B) = \det(A)$. State which property of the determinant you use at each step.

16.17 ⭐⭐⭐ [proof] Prove the cyclic property of the trace: for any $n\times n$ matrices $X, Y$, $\operatorname{tr}(XY) = \operatorname{tr}(YX)$. Then use it to prove that the trace is a similarity invariant.

16.18 ⭐⭐⭐ [proof] Prove that similarity is a transitive relation: if $B = P^{-1}AP$ and $C = Q^{-1}BQ$, then $C = (PQ)^{-1}A(PQ)$. Conclude that $C$ is similar to $A$, and name the change-of-basis matrix that does it in one step.

16.19 ⭐⭐⭐ [proof] Show that if $A$ is invertible and $B = P^{-1}AP$, then $B$ is invertible and $B^{-1} = P^{-1}A^{-1}P$. (Interpretation: the inverse of "$A$ in the new basis" is "$A^{-1}$ in the new basis" — undoing a transformation is basis-independent.)

16.20 ⭐⭐⭐ [proof] Prove that $A$ and $A^{\mathsf{T}}$ are not generally equal, but show that similar matrices can fail to be symmetric even when $A$ is — i.e. exhibit a symmetric $A$ and an invertible $P$ for which $P^{-1}AP$ is not symmetric. (You may use a chapter example.)

16.21 ⭐⭐⭐ [code] Write a numpy script that takes the basis $\mathbf{b}_1 = (2,1)$, $\mathbf{b}_2 = (1,3)$ and a vector $\mathbf{v} = (5,5)$ (standard coordinates), computes $[\mathbf{v}]_{\text{new}}$, and verifies the round trip with np.allclose. Print all three of $P$, $[\mathbf{v}]_{\text{new}}$, and the round-trip result.

16.22 ⭐⭐⭐ [code] Implement change_basis_matrix(old_basis, new_basis) and to_new_coords(P, v_old) from scratch (pure Python, no numpy inside the functions — reuse your toolkit inverse from Chapter 9 and apply from Chapter 7). Verify against numpy that, for the standard old basis and new basis $\{(1,1),(-1,1)\}$, to_new_coords(P, [4,2]) returns [3,-1], and that the round trip to_old_coords(P, to_new_coords(P, v)) recovers v for five random vectors.

16.23 ⭐⭐⭐ [code] Using the recurring visualizer (imported verbatim from toolkit.visualizer), draw two figures of the same transformation $A = \begin{bmatrix} 3 & 1 \\ 0 & 2 \end{bmatrix}$: one of $A$ on the standard grid, and one of $B = P^{-1}AP$ where $P$ has columns $(1,0)$ and $(1,1)$. Print $B$ and confirm $\operatorname{tr}(B) = \operatorname{tr}(A)$ and $\det(B) = \det(A)$.

Tier 4 — Application (⭐⭐⭐⭐)

16.24 ⭐⭐⭐⭐ [code] (PCA preview.) The covariance matrix of a 2-D dataset is $C = \begin{bmatrix} 5 & 2 \\ 2 & 2 \end{bmatrix}$. Use np.linalg.eigh(C) to find the orthogonal eigenbasis, build $P$ from the eigenvectors, and compute $P^{-1}CP$. Confirm it is (approximately) diagonal, that the diagonal entries are the eigenvalues, and that they sum to $\operatorname{tr}(C) = 7$. Report what fraction of the total variance lies along the larger principal component, and explain in two sentences why diagonalizing the covariance is the heart of dimensionality reduction.

16.25 ⭐⭐⭐⭐ (Robotics frame.) A robot's camera frame is rotated $60°$ from the world frame. A landmark is at world coordinates $(2, 0)$. (a) Write the rotation matrix $R$ that maps frame coordinates to world coordinates. (b) Compute the landmark's coordinates in the camera frame using $R^{-1}$, and note that $R^{-1} = R^{\mathsf{T}}$ for a rotation. (c) A world-frame scaling $S = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}$ (stretch east–west) is applied; write the matrix $B = R^{-1}SR$ that represents the same scaling in the camera frame, and confirm $\operatorname{tr}(B) = 3$ and $\det(B) = 2$. Explain in two sentences why the trace and determinant did not change even though the matrix entries did.

16.26 ⭐⭐⭐⭐ [proof + code] (Powers via a good basis — Chapter 25 preview.) For $A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}$ and $P$ with columns $(1,1), (-1,1)$, you found $D = P^{-1}AP = \begin{bmatrix} 3 & 0 \\ 0 & 1 \end{bmatrix}$. (a) [proof] Show that $A^k = PD^kP^{-1}$ for every positive integer $k$ (induction or a telescoping product). (b) [code] Use this to compute $A^5$ without multiplying $A$ by itself five times (just raise the diagonal entries to the 5th power), and verify against np.linalg.matrix_power(A, 5). Report the entries of $A^5$ and explain why the diagonal form made the computation trivial.