Skip to main content

MATH 345: Linear Algebra and Optimization

Section 6.7 Exercises

Exercise tags. The tags below identify the primary outcomes and competency types for each exercise group. Individual problems may also involve earlier outcomes.

Subsection Lagrange multipliers and parallel gradients

Primary outcomes. U6-LO1, U6-LO2. Competencies. P+C+M.

Subsection Singular value decomposition

Primary outcomes. U6-LO3, U6-LO4, U6-LO5, U6-LO6. Competencies. P+C.
  • Nicholson 8.6.9(b)
     19 
    math.libretexts.org/Bookshelves/Linear_Algebra/Linear_Algebra_with_Applications_(Nicholson)/08%3A_Orthogonality/8.06%3A_The_Singular_Value_Decomposition/8.6E%3A_The_Singular_Value_Decomposition_Exercises

Subsection Additional applied and computational problems

These exercises connect the main Unit 6 ideas: absolute extrema on closed bounded regions, Lagrange multipliers, maximum stretch, singular values, SVD, fundamental subspaces, rank-\(k\) reconstruction, energy retained, redundant features, low-rank updates, and code interpretation. Solutions are collected in Appendix C.6.

Checkpoint 6.7.1. Candidate table on a rectangle.

Let
\begin{equation*} f(x,y)=x^2+y^2-2x+4y \end{equation*}
on the rectangle
\begin{equation*} D=\{(x,y):0\leq x\leq 3,\ -3\leq y\leq 1\}. \end{equation*}
  1. Find the critical point of \(f\) in the interior of \(D\text{.}\)
  2. Find the boundary candidates on each of the four edges.
  3. Include the four corner points.
  4. Make a candidate table with the source of each candidate and the value of \(f\text{.}\)
  5. Find the absolute maximum and absolute minimum of \(f\) on \(D\text{.}\)
Tags. [U6-LO1 | P+C+R | Core]

Checkpoint 6.7.2. Parallel gradients on a circle.

Let
\begin{equation*} f(x,y)=3x+4y \end{equation*}
and constrain the input to the circle
\begin{equation*} x^2+y^2=25. \end{equation*}
  1. Write the constraint as \(g(x,y)=25\text{.}\)
  2. Solve
    \begin{equation*} \nabla f=\lambda\nabla g. \end{equation*}
  3. Find the constrained critical points.
  4. Evaluate \(f\) at the constrained critical points.
  5. Which point gives the absolute maximum? Which point gives the absolute minimum?
  6. Explain geometrically why \(\nabla f\) is parallel to \(\nabla g\) at those points.
Tags. [U6-LO2 | P+C+R | Core]

Checkpoint 6.7.3. Quadratic form on the unit circle.

Let
\begin{equation*} B= \begin{bmatrix} 5\amp 0\\ 0\amp 2 \end{bmatrix} \end{equation*}
and
\begin{equation*} q(\mathbf{x})=\mathbf{x}^TB\mathbf{x}. \end{equation*}
Write
\begin{equation*} \mathbf{x}= \begin{bmatrix} x\\ y \end{bmatrix}. \end{equation*}
  1. Write \(q(\mathbf{x})\) in terms of \(x\) and \(y\text{.}\)
  2. Maximize \(q(\mathbf{x})\) subject to
    \begin{equation*} \|\mathbf{x}\|=1. \end{equation*}
  3. Minimize \(q(\mathbf{x})\) subject to
    \begin{equation*} \|\mathbf{x}\|=1. \end{equation*}
  4. Which unit vectors give the extreme values?
  5. How do the answers relate to eigenvalues and eigenvectors of \(B\text{?}\)
Tags. [U6-LO2, U6-LO3 | P+C+R | Core]

Checkpoint 6.7.4. Maximum stretch of a matrix.

Let
\begin{equation*} A= \begin{bmatrix} 1\amp 2\\ 2\amp 1 \end{bmatrix}. \end{equation*}
  1. Compute \(A^TA\text{.}\)
  2. Find the eigenvalues of \(A^TA\text{.}\)
  3. Find the singular values of \(A\text{.}\)
  4. Find a unit right singular vector corresponding to the largest singular value.
  5. What is
    \begin{equation*} \max_{\|\mathbf{x}\|=1}\|A\mathbf{x}\|? \end{equation*}
  6. Which input direction is stretched most?
Tags. [U6-LO3, U6-LO6 | P+C+R | Core]

Checkpoint 6.7.5. Reading an SVD.

Suppose
\begin{equation*} A=U\Sigma V^T, \end{equation*}
where
\begin{equation*} U= \begin{bmatrix} 1\amp 0\\ 0\amp 1 \end{bmatrix}, \qquad \Sigma= \begin{bmatrix} 5\amp 0\amp 0\\ 0\amp 2\amp 0 \end{bmatrix}, \end{equation*}
and
\begin{equation*} V= \begin{bmatrix} 1/\sqrt2\amp 0\amp 1/\sqrt2\\ 1/\sqrt2\amp 0\amp -1/\sqrt2\\ 0\amp 1\amp 0 \end{bmatrix}. \end{equation*}
Thus the right singular vectors are
\begin{equation*} \mathbf{v}_1= \frac{1}{\sqrt2} \begin{bmatrix} 1\\ 1\\ 0 \end{bmatrix}, \qquad \mathbf{v}_2= \begin{bmatrix} 0\\ 0\\ 1 \end{bmatrix}, \qquad \mathbf{v}_3= \frac{1}{\sqrt2} \begin{bmatrix} 1\\ -1\\ 0 \end{bmatrix}. \end{equation*}
  1. What are the singular values of \(A\text{?}\)
  2. What is \(\operatorname{rank}(A)\text{?}\)
  3. Compute \(A\mathbf{v}_1\text{,}\) \(A\mathbf{v}_2\text{,}\) and \(A\mathbf{v}_3\) using the SVD.
  4. Which input direction is forgotten?
  5. Which input directions are transmitted?
Tags. [U6-LO4, U6-LO5, U6-LO6 | C+R | Core]

Checkpoint 6.7.6. Fundamental subspaces from an SVD.

Use the SVD data from the previous checkpoint.
  1. Give an orthonormal basis for \(\operatorname{row}(A)\text{.}\)
  2. Give an orthonormal basis for \(\operatorname{null}(A)\text{.}\)
  3. Give an orthonormal basis for \(\operatorname{col}(A)\text{.}\)
  4. Give an orthonormal basis for \(\operatorname{null}(A^T)\text{.}\)
  5. Check that the dimensions agree with rank-nullity.
Tags. [U6-LO5 | C+R | Core]

Checkpoint 6.7.7. Energy retained.

Suppose the nonzero singular values of a matrix are
\begin{equation*} 10,\ 4,\ 1,\ 0.5. \end{equation*}
  1. Compute the total squared singular-value energy.
  2. Compute the energy retained by \(k=1\text{.}\)
  3. Compute the energy retained by \(k=2\text{.}\)
  4. Find the smallest \(k\) that retains at least \(95\%\) of the energy.
  5. Explain what is discarded by that rank-\(k\) reconstruction.
Tags. [U6-LO6, U6-LO7 | C+M | Core]

Checkpoint 6.7.8. Code interpretation: rank-\(k\) reconstruction.

The following code computes a rank-one reconstruction.
import numpy as np

A = np.array([[3., 0.],
              [0., 1.]])

U, s, Vt = np.linalg.svd(A, full_matrices=False)

k = 1
Ak = U[:, :k] @ np.diag(s[:k]) @ Vt[:k, :]

s, Ak
  1. What are the singular values of \(A\text{?}\)
  2. Which singular value is kept when \(k=1\text{?}\)
  3. What is the shape of U[:, :k]?
  4. What is the shape of np.diag(s[:k])?
  5. What is the shape of Vt[:k, :]?
  6. What is the rank of Ak?
  7. Which input direction is discarded?
Tags. [U6-LO4, U6-LO7 | R+T | Core]

Checkpoint 6.7.9. Debugging an SVD slice.

A student tries to compute a rank-one reconstruction using this code.
A = np.array([[3., 0.],
              [0., 1.]])

U, s, Vt = np.linalg.svd(A, full_matrices=False)

k = 1
Ak_wrong = U[:, :k] @ np.diag(s[:k]) @ Vt[:, :k]
  1. Which slice is wrong?
  2. What should the last slice be?
  3. Explain the shape problem.
  4. Explain the mathematical problem.
Tags. [U6-LO4, U6-LO7 | C+T | Core]

Checkpoint 6.7.10. Redundant features revisited by singular values.

Return to the Unit 2 redundant-feature matrix
\begin{equation*} X= \begin{bmatrix} 1\amp 2\amp 3\\ 2\amp 4\amp 6\\ 0\amp 1\amp 1\\ 1\amp -1\amp 0 \end{bmatrix}. \end{equation*}
The third column is the sum of the first two columns.
  1. Verify that
    \begin{equation*} X \begin{bmatrix} 1\\ 1\\ -1 \end{bmatrix} = \mathbf{0}. \end{equation*}
  2. What does this say about \(\operatorname{null}(X)\text{?}\)
  3. What does this say about the rank of \(X\text{?}\)
  4. What singular value should appear because of this redundancy?
  5. If \(X\mathbf{c}=\mathbf{y}\text{,}\) what is
    \begin{equation*} X\left(\mathbf{c}+t \begin{bmatrix} 1\\ 1\\ -1 \end{bmatrix}\right)? \end{equation*}
  6. Explain how this revisits the Unit 2 idea of nonunique coefficient vectors.
Tags. [U2-LO6, U6-LO5, U6-LO6 | C+R+M | Core]

Checkpoint 6.7.11. Low-rank update storage.

Let
\begin{equation*} W\in\mathbb R^{5000\times 3000}, \qquad B\in\mathbb R^{5000\times 8}, \qquad C\in\mathbb R^{8\times 3000}. \end{equation*}
Define
\begin{equation*} W_{\text{new}}=W+BC. \end{equation*}
  1. What is the shape of \(BC\text{?}\)
  2. What is the largest possible rank of \(BC\text{?}\)
  3. How many numbers are needed to store \(W\text{?}\)
  4. How many numbers are needed to store \(B\) and \(C\text{?}\)
  5. Why is \(BC\) called a low-rank update?
  6. Does this mean \(W_{\text{new}}\) must have low rank? Explain.
Tags. [U6-LO7 | C+M | Core]