Skip to main content
Contents
Dark Mode Prev Up Next
\(\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\dimens}{\operatorname{dim}}
\DeclareMathOperator{\row}{\operatorname{row}}
\DeclareMathOperator{\col}{\operatorname{col}}
\newcommand{\im}{\operatorname{im}}
\newcommand{\nulls}{\operatorname{null}}
\newcommand{\minor}{\operatorname{minor}}
\newcommand{\spans}{\operatorname{span}}
\newcommand{\nullity}{\operatorname{nullity}}
\newcommand{\kers}{\operatorname{ker}}
\newcommand{\proj}{\operatorname{proj}}
\newcommand{\diag}{\operatorname{diag}}
\newcommand{\Tr}{\operatorname{Tr}}
\newcommand{\rank}{\operatorname{rank}}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 5.9 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 Directional derivatives and gradient descent
Primary outcomes. U5-LO2, U5-LO3.
Competencies. P+C+T.
Subsection Symmetric matrices and quadratic forms
Primary outcomes. U5-LO4, U5-LO5.
Competencies. P+C.
Subsection Hessians and the second derivative test
Primary outcomes. U5-LO1, U5-LO5.
Competencies. P+C.
OpenStax 4.7 #319 openstax.org/books/calculus-volume-3/pages/4-7-maxima-minima-problems
OpenStax 4.7 #323 openstax.org/books/calculus-volume-3/pages/4-7-maxima-minima-problems
Subsection Additional applied and computational problems
These exercises connect the main Unit 5 ideas: critical points, directional derivatives, gradient descent, eigenvectors, Hessian eigenvalues, quadratic forms, least squares from gradients, fixed-hidden-layer training, and code interpretation. Solutions are collected in Appendix
C.5 .
Checkpoint 5.9.1 . Critical points are candidates.
Let
\begin{equation*}
f(x,y)=x^2-y^2.
\end{equation*}
Find all critical points of
\(f\text{.}\)
Evaluate
\(f(t,0)\) and
\(f(0,t)\text{.}\)
Explain why the critical point is not a local minimum or a local maximum.
Tags. [U5-LO1, U5-LO5 | C+R | Core]
Checkpoint 5.9.2 . Directional derivative as a dot product.
Suppose
\begin{equation*}
\nabla f(\mathbf{a})=
\begin{bmatrix}
6\\
8
\end{bmatrix}.
\end{equation*}
Let
\begin{equation*}
\mathbf{v}_1=
\begin{bmatrix}
1\\
0
\end{bmatrix},
\qquad
\mathbf{v}_2=
\begin{bmatrix}
0\\
1
\end{bmatrix},
\qquad
\mathbf{v}_3=
\frac{1}{5}
\begin{bmatrix}
3\\
4
\end{bmatrix},
\qquad
\mathbf{v}_4=
-\frac{1}{5}
\begin{bmatrix}
3\\
4
\end{bmatrix}.
\end{equation*}
Compute
\(D_{\mathbf{v}_i}f(\mathbf{a})\) for
\(i=1,2,3,4\text{.}\)
Which listed direction gives the largest directional derivative?
Which listed direction gives the smallest directional derivative?
Explain how this uses the Unit 1 dot product.
Tags. [U5-LO2 | P+C+R | Core]
Checkpoint 5.9.3 . Reading a gradient descent loop.
Assume
grad_f(x) computes
\(\nabla f(\mathbf{x})\text{.}\) Consider the code:
x = x0
for k in range(num_steps):
x = x - alpha * grad_f(x)
What mathematical update rule is represented?
Which quantity is the learning rate?
What shape must
grad_f(x) have?
What would change if the minus sign were a plus sign?
Does this code prove that a minimum has been found?
Tags. [U5-LO2, U5-LO3 | C+T | Core]
Checkpoint 5.9.4 . Learning-rate diagnosis.
For \(f(x)=x^2\text{,}\) start at \(x_0=4\) and use
\begin{equation*}
x_{k+1}=x_k-\alpha f'(x_k).
\end{equation*}
The table shows the loss values \(f(x_k)\) for three learning rates.
\begin{equation*}
\begin{array}{c|ccc}
k \amp \alpha=0.05 \amp \alpha=0.20 \amp \alpha=1.05\\
\hline
0 \amp 16.000 \amp 16.000 \amp 16.000\\
1 \amp 12.960 \amp 5.760 \amp 19.360\\
2 \amp 10.498 \amp 2.074 \amp 23.426\\
3 \amp 8.503 \amp 0.746 \amp 28.345
\end{array}
\end{equation*}
Which learning rate is making slow but steady progress?
Which learning rate is making faster useful progress?
Which learning rate appears unstable?
Does a decreasing loss table prove that the global minimum has been found?
Tags. [U5-LO3 | C+T | Core]
Checkpoint 5.9.5 . Eigenvectors as special directions.
Let
\begin{equation*}
A=
\begin{bmatrix}
3\amp1\\
0\amp2
\end{bmatrix},
\qquad
\mathbf{v}_1=
\begin{bmatrix}
1\\
0
\end{bmatrix},
\qquad
\mathbf{v}_2=
\begin{bmatrix}
-1\\
1
\end{bmatrix}.
\end{equation*}
Compute
\(A\mathbf{v}_1\text{.}\)
Compute
\(A\mathbf{v}_2\text{.}\)
Identify the eigenvalue for each eigenvector.
Explain what the matrix map does to these two special directions.
Tags. [U5-LO4 | P+C+R | Core]
Checkpoint 5.9.6 . Quadratic form and definiteness.
Checkpoint 5.9.7 . Hessian eigenvalue classification.
Suppose
\(\mathbf{a}\) is a critical point of a scalar-valued function
\(f\text{.}\) For each possible list of Hessian eigenvalues, classify the critical point as a local minimum, local maximum, saddle point, or inconclusive.
Explain why the zero eigenvalue case is different.
Tags. [U5-LO5 | C+R | Core]
Checkpoint 5.9.8 . Least squares from gradients.
Let
\begin{equation*}
A=
\begin{bmatrix}
1\amp0\\
1\amp1\\
1\amp2
\end{bmatrix},
\qquad
\mathbf{b}=
\begin{bmatrix}
1\\
2\\
2
\end{bmatrix}.
\end{equation*}
Define
\begin{equation*}
h(\mathbf{x})=\|A\mathbf{x}-\mathbf{b}\|^2.
\end{equation*}
Compute
\(A^T A\) and
\(A^T\mathbf{b}\text{.}\)
Use
\(\nabla h(\mathbf{x})=2A^T(A\mathbf{x}-\mathbf{b})\) to write the normal equations.
Solve the normal equations.
Compute the residual
\(\mathbf{r}=\mathbf{b}-A\hat{\mathbf{x}}\text{.}\)
Check that
\(A^T\mathbf{r}=\mathbf{0}\text{.}\)
Tags. [U5-LO6, U4-LO4 | P+C+R | Core]
Checkpoint 5.9.9 . Residual orthogonality in code.
xhat = np.linalg.lstsq(A, b, rcond=None)[0]
r = b - A @ xhat
A.T @ r
What condition is checked by
A.T @ r?
Does
A.T @ r being close to zero mean that
r is close to zero?
Which earlier unit used this same condition?
Tags. [U5-LO6, U4-LO4 | C+T | Core]
Checkpoint 5.9.10 . Fixed-hidden-layer design matrix.
Let \(\sigma(t)=\tanh(t)\text{,}\) and define
\begin{equation*}
N_{\mathbf{c}}(t)=c_0+c_1\sigma(t)+c_2\sigma(t-1)+c_3\sigma(t+1).
\end{equation*}
Use the input values \(t=-1,0,1\text{.}\)
Write the design matrix
\(A\) for the model
\(A\mathbf{c}\approx \mathbf{y}\text{.}\)
Why is this a least-squares problem?
Is the model linear as a function of
\(t\text{?}\)
Is the model linear as a function of
\(\mathbf{c}\text{?}\)
Tags. [U5-LO6, U5-LO7 | C+M+R | Core]
Checkpoint 5.9.11 . Rank-one update.
Let
\begin{equation*}
\mathbf{g}=
\begin{bmatrix}
1\\
-2\\
3
\end{bmatrix},
\qquad
\mathbf{h}=
\begin{bmatrix}
4\\
0
\end{bmatrix}.
\end{equation*}
Compute
\(\mathbf{g}\mathbf{h}^T\text{.}\)
What is the shape of
\(\mathbf{g}\mathbf{h}^T\text{?}\)
Explain why
\(\mathbf{g}\mathbf{h}^T\) has rank at most one.
Interpret the update
\(W_{\mathrm{new}}=W-\alpha \mathbf{g}\mathbf{h}^T\text{.}\)
In NumPy, why is
np.outer(g, h) appropriate when
g and
h are stored as one-dimensional arrays?
Tags. [U5-LO7, U2-LO3 | P+C+T | Core]