---
title: Problem set 6
heading: "Problem set 6: iterations, eigenvalues and the SVD"
eyebrow: A13 · Problem set 6
type: problems
---

::: hook
These problems use lessons 27 to 32: Jacobi, Gauss–Seidel and SOR, conjugate gradients, multigrid and preconditioning, power and inverse iteration, the QR algorithm, and the singular value decomposition. Most turn on one number: a spectral radius, a condition number, or a ratio of eigenvalues or singular values.
:::

::: pool
pick: 12

::: check
kind: parts
given: a = 3 | 5; b1 = 1 | 4; b2 = 2 | 3

## One Jacobi sweep on $\given{a}x_1 + x_2 = \given{b1}$, $x_1 + \given{a}x_2 = \given{b2}$ from zero.

::: part
answer: b1/a
tolerance: 0.5%

### What is the new $x_1$?

::: misses
- [any] From zero, $x_1 = b_1/a$.
:::
:::

::: part
answer: (b2 - b1/a)/a
tolerance: 0.5%

### What would Gauss–Seidel give for $x_2$, using the new $x_1$?

::: misses
- [b2/a] That's Jacobi's value; Gauss–Seidel uses the updated $x_1$.
- [any] $x_2 = \frac{b_2 - x_1}{a}$ with the new $x_1$.
:::
:::
:::

::: check
kind: parts
given: N = 20 | 50 | 100

## The 2D model problem on an {N} × {N} grid has $\rho_J = \cos\frac{\pi}{N + 1}$.

::: part
answer: cos(pi/(N + 1))^2
tolerance: 0.1%

### What is Gauss–Seidel's spectral radius?

::: misses
- [any] $\rho_J^2$.
:::
:::

::: part
answer: 2/(1 + sin(pi/(N + 1)))
tolerance: 0.1%

### What is the optimal SOR factor?

::: misses
- [any] $\frac{2}{1 + \sqrt{1 - \rho_J^2}} = \frac{2}{1 + \sin\frac{\pi}{N + 1}}$.
:::
:::
:::

::: check
kind: parts
given: k = 100 | 400 | 10000

## A symmetric positive definite system has κ = {k}.

::: part
answer: (sqrt(k) - 1)/(sqrt(k) + 1)
tolerance: 0.5%

### What is CG's convergence factor per step, in the standard bound?

::: misses
- [(k - 1)/(k + 1)] That's steepest descent's.
- [any] $\frac{\sqrt\kappa - 1}{\sqrt\kappa + 1}$.
:::
:::

::: part
answer: sqrt(k)/2*ln(2e6)
tolerance: 1%

### About how many steps for $\varepsilon = 10^{-6}$?

::: misses
- [any] $\frac{\sqrt\kappa}{2}\ln\frac2\varepsilon$.
:::
:::
:::

::: check
kind: parts
given: n = 3 | 5 | 8

## A symmetric matrix has only {n} distinct eigenvalues.

::: part
answer: n
tolerance: 0

### In exact arithmetic, at most how many CG steps solve it exactly?

::: misses
- [any] A degree-n polynomial can vanish on n distinct eigenvalues.
:::
:::
:::

::: check
kind: parts
given: w = 0.5 | 0.67 | 0.8

## Weighted Jacobi with ω = {w} on the 1D model problem.

::: part
answer: 1 - 2*w
tolerance: 0.5%

### What factor multiplies the roughest mode, θ = π?

::: misses
- [1 - w] That's θ = π/2.
- [any] $1 - 2\omega\sin^2\frac\pi2$.
:::
:::

::: part
answer: 1 - w
tolerance: 0.5%

### And the mode θ = π/2?

::: misses
- [any] $1 - 2\omega\sin^2\frac\pi4 = 1 - \omega$.
:::
:::
:::

::: check
kind: parts
given: d = 2 | 3; r = 0.1 | 0.15

## A V-cycle in d = {d} dimensions with one smoothing sweep per level cuts the error by {r}.

::: part
answer: 1/(1 - 2^(-d))
tolerance: 0.5%

### How many fine-grid sweeps' worth of smoothing does it cost?

::: misses
- [any] $\frac{1}{1 - 2^{-d}}$.
:::
:::

::: part
answer: ceil(10/(-log(r)))
tolerance: 0

### How many cycles gain 10 digits?

::: misses
- [any] Each cycle gains $-\log_{10}r$ digits.
:::
:::
:::

::: check
kind: parts
given: l1 = 10 | 4; l2 = 9 | 3

## A matrix's two largest eigenvalues are {l1} and {l2}.

::: part
answer: l2/l1
tolerance: 0.5%

### By what factor does power iteration's error shrink per step?

::: misses
- [any] $\lvert\lambda_2/\lambda_1\rvert$.
:::
:::

::: part
answer: ceil(ln(1e-10)/ln(l2/l1))
tolerance: 0

### How many steps reduce the error by $10^{10}$?

::: misses
- [any] Solve $(\lambda_2/\lambda_1)^n \le 10^{-10}$.
:::
:::
:::

::: check
kind: parts
given: d = 0.1 | 0.3; g = 1 | 2

## Inverse iteration uses a shift σ. The eigenvalue nearest σ is {d} from it, and the next nearest is {g} from it.

::: part
answer: d/g
tolerance: 0.5%

### By what factor does the error shrink per step?

::: misses
- [g/d] Inverse iteration amplifies the nearest eigenvalue most: the factor is below 1.
- [any] $\frac{\lvert\lambda_\text{nearest} - \sigma\rvert}{\lvert\lambda_\text{next} - \sigma\rvert}$.
:::
:::

::: part
answer: ceil(-10/log(d/g))
tolerance: 0

### How many steps gain 10 digits?

::: misses
- [any] Each step gains $-\log_{10}\frac dg$ digits.
:::
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 1 | 2; x = 1 | 2; y = 1 | -1

## The Rayleigh quotient of v = ({x}, {y}) for $\begin{pmatrix}\given{a} & \given{b}\\ \given{b} & \given{a}\end{pmatrix}$.

::: part
answer: (a*x^2 + 2*b*x*y + a*y^2)/(x^2 + y^2)
tolerance: 0.5%

### What is it?

::: misses
- [any] $\frac{v^TAv}{v^Tv}$.
:::
:::

::: part
answer: a + b
tolerance: 0.5%

### What is the largest eigenvalue, which the quotient approaches as v nears (1, 1)?

::: misses
- [any] For this matrix, (1, 1) is an eigenvector with eigenvalue a + b.
:::
:::
:::

::: check
kind: parts
given: a = 3 | 5; b = 1 | 2; d = 1 | 2

## The symmetric matrix $\begin{pmatrix}\given{a} & \given{b}\\ \given{b} & \given{d}\end{pmatrix}$.

::: part
answer: (a + d)/2 + sqrt(((a - d)/2)^2 + b^2)
tolerance: 0.5%

### What is its larger eigenvalue?

::: misses
- [any] $\frac{a + d}{2} + \sqrt{\left(\frac{a - d}{2}\right)^2 + b^2}$.
:::
:::

::: part
answer: ((a + d)/2 - sqrt(((a - d)/2)^2 + b^2))/((a + d)/2 + sqrt(((a - d)/2)^2 + b^2))
tolerance: 0.5%

### By what factor does unshifted QR shrink the off-diagonal entry per step?

::: misses
- [any] $\lambda_2/\lambda_1$.
:::
:::
:::

::: check
kind: parts
given: R = 5 | 10; L = 1 | 10; C = 1 | 10

## A series RLC circuit has R = {R} Ω, L = {L} mH, C = {C} µF.

::: part
answer: -R/(2*L*1e-3)
unit: s⁻¹
tolerance: 0.5%

### What is the real part of its (complex) poles, in s⁻¹?

::: misses
- [-R/(L*1e-3)] Divide by 2L.
- [any] $-\frac{R}{2L}$.
:::
:::
:::

::: check
kind: parts
given: p = 4 | 2; q = 3 | 1; r = 5 | 4

## $A = \begin{pmatrix}\given{p} & 0\\ \given{q} & \given{r}\end{pmatrix}$.

::: part
answer: sqrt(((p^2 + q^2 + r^2) + sqrt((p^2 + q^2 + r^2)^2 - 4*(p*r)^2))/2)
tolerance: 0.5%

### What is its largest singular value?

::: misses
- [any] The square root of the larger eigenvalue of $A^TA$.
:::
:::

::: part
answer: p*r/sqrt(((p^2 + q^2 + r^2) + sqrt((p^2 + q^2 + r^2)^2 - 4*(p*r)^2))/2)
tolerance: 0.5%

### And its smallest? ($\sigma_1\sigma_2 = \lvert\det A\rvert$.)

::: misses
- [any] $\frac{\lvert pr\rvert}{\sigma_1}$.
:::
:::
:::

::: check
kind: parts
given: s = 10 | 50; k = 3 | 6

## A matrix's singular values are $\sigma_i = \given{s}/i^2$.

::: part
answer: s/(k + 1)^2
tolerance: 0.5%

### What is the 2-norm error of its best rank-{k} approximation?

::: misses
- [s/k^2] The error is the first singular value left out, $\sigma_{k+1}$.
- [any] $\sigma_{k+1}$.
:::
:::
:::

::: check
kind: parts
given: m = 100 | 2000; n = 50 | 500; k = 5 | 20

## An {m} × {n} matrix is stored as its rank-{k} SVD.

::: part
answer: k*(m + n + 1)
tolerance: 0.5%

### How many numbers does that take?

::: misses
- [any] $k(m + n + 1)$.
:::
:::
:::

::: check
kind: parts
given: k = 1..7 int

## Least squares with $\kappa(A) = 10^{\given{k}}$ is solved two ways in double precision.

::: part
answer: 16 - 2*k
tolerance: 0.5%

### Through the normal equations, about how many digits survive?

::: misses
- [16 - k] Forming $A^TA$ squares κ.
- [any] $16 - \log_{10}\kappa^2$.
:::
:::

::: part
answer: 16 - k
tolerance: 0.5%

### Through QR or the SVD, about how many?

::: misses
- [any] These work with A itself: $16 - \log_{10}\kappa$.
:::
:::
:::
:::
