8 The Hessian
8.1 Introduction
8.2 Several variables
Explain how the chain rule is applied to get
(8.3)
.
Suppose that is given by
Then the gradient
and the Hessian
of are computed in the python cell below.
See the calculus tutorial in the sympy documentation for more.
Live Python
Verify (just this once) by hand the computations done by sympy in Example
8.3
.
Also, experiment with a few other functions in the python cell and compute their
Hessians.
Give a detailed explanation as to why
(8.4)
holds.
8.3 Newton's method for finding critical points
Let us watch
(8.6)
in action on the function from
Exercise
7.21
,
with gradient and Hessian
This function offers a rare luxury: the equation
can be solved by hand. The first coordinate
gives , and substituting this into the second,
so or . The two critical points are
Since we know the answers in advance, we can concentrate on how
Newton's method finds them. The cell below starts at v0 and
prints the point and the length of the gradient after every step of
(8.6)
.
Two things in the output are worth savoring. First, the speed.
Starting from the iteration converges to , and the
lengths of the gradients fall like
The exponent roughly doubles in every step, so the number of correct
digits doubles too. This quadratic convergence is the
trademark of Newton's method β compare with the small steps
gradient ascent needed in Example
7.33
.
Second, the destination depends on the start. From the
very same iteration converges to the other critical point
. Newton's method solves
and nothing else; it has no opinion on
whether the point it finds is a local minimum, a local maximum or
neither. So which of the three did we just find? The answer needs the
main character of this chapter, the Hessian: see
Example
8.14
and Exercise
8.18
.
Live Python
Run the cell in Example
8.6
with the initial point
v0 = [1/6, 1/6]. What goes wrong?
Show that is invertible if and only if
, so the failing initial points lie exactly on a
hyperbola in the plane. If you nudge the initial point to
v0 = [1/6 + 0.001, 1/6], which critical point does Newton's
method find?
8.4 The Hessian and critical points
A critical point is called a saddle point for if there exists two vectors , such that
as illustrated in the graphics below.
A symmetric matrix is called indefinite if there exists
with
Let be a symmetric matrix and an
invertible matrix. Then is
indefinite (positive definite, negative definite) if and only if
is indefinite (positive definite, negative definite).
Let be a critical point for . Then
- is a local minimum if is positive definite.
- is a local maximum if is negative definite.
- is a saddle point if is indefinite.
If is a local minimum, then is positive definite.
If is indefinite, then is a saddle point.
Every symmetric matrix is positive definite, negative definite or indefinite.
If is positive definite, then is a local minimum.
Consider, with our new technology in Theorem
8.12
, Exercise
7.21
once again.
Here we analyzed the point for the function
and showed (by a trick) that is neither a local maximum nor a local minimum for . The Hessian
matrix for at is
Now
Theorem
8.12
(ⅲ)
shows that is a saddle point, since
and
Live Python
Try plotting the graph for different values of a
1
a=4 shows the saddle point clearly.
in the python cell in
Example
8.14
. What do you observe for the point with
respect to the function? Does a have to be a number? Could it be an
expression in the variables x and y like a = -10*np.cos(x)*np.sin(y)?
Check the computation of the Hessian matrix in Example
8.14
by showing
that the Hessian matrix for at the point is
Newton's method in Example
8.6
also found the critical
point for
. Compute the Hessian of at this point
and use Theorem
8.12
to decide whether it is a local
minimum, a local maximum or a saddle point.
Give an example of a function having a local minimum at
, where is not positive definite.
Consider the function
Compute its critical points and decide on their types according to Theorem
8.12
.
Try to convince yourself that
for every .
Look at the minimization problem
subject to
where is a big number.
Live Python
Give an example of a function that has a local maximum, but where
there exists with for any given (large) number .
the prompt carries the passage above
8.5 Differentiable convex functions of several variables
Let be a differentiable function, where
is an open convex subset. Then is convex if
and only if
for every .
Suppose that
(8.9)
holds and let with
, where . To prove that is convex
we must verify the inequality
Let . Then
by
(8.9)
. If you multiply the first inequality by , the
second by and then add the two, you get
(8.10)
.
Suppose on the other hand that is a convex function. Let . Since is an open subset, it follows that for , where is
sufficiently small. Now define the function by
Being the composition of two differentiable functions, is
differentiable. Suppose that and . Then
showing that is a convex function. By Theorem
6.61
,
which translates into
by using the chain rule in computing .
Prove that a bounded convex differentiable function is
constant.
Let be a differentiable function with continuous
second order partial derivatives, where is a
convex open subset. Then is convex if and only if the Hessian
is positive semidefinite for every . If
is positive definite for every , then is
strictly convex.
We have done all the work for a convenient reduction to the one
variable case. Suppose that is convex. Then the same reasoning
as in the proof of Theorem
8.23
shows that
is a convex function for every and every from
an open interval to for suitable
. Therefore by
Theorem
6.54
. This proves that the matrix is
positive semidefinite for every . Suppose on the other hand
that is positive semidefinite for every .
Then Theorem
6.54
shows that is a convex
function from to for small
and , since
for . Therefore is a convex function, since
The same argument (using the last part of Theorem
6.54
on
strict convexity), shows that is strictly convex if
is positive definite. It follows that is strictly
convex if is positive definite for every .
Prove that
is a strictly convex function from to . Also, prove that
is a convex subset of .
Is strictly convex on some non-empty
open convex subset of the plane?
Show that given by
is a convex function. Is strictly convex?
Let be given by
where .
- Show that is a strictly convex function if and only if
and .This is a hint for the only if part. If is the Hessian for , then where - this is seen by a matrix multiplication computation. We know that is positive semidefinite. If was not positive definite, there would exist with . Now use to complete the proof that is positive definite by looking at .
- Suppose now that and . Show that has a unique global minimum and give a formula for this minimum in terms of and .
8.6 How to decide the definiteness of a matrix
Show that a diagonal matrix
is positive definite if and only if , positive semidefinite
if and only if and
indefinite if and only if there exists with and .
Let be a real symmetric matrix. Then there exists an
invertible matrix , such that is a diagonal matrix.
Suppose that . If has a non-zero entry in the upper
left hand corner i.e., , then
where is a real symmetric matrix and is the
invertible matrix
By induction on we may find an invertible matrix matrix such that
Putting
it follows that
We now treat the case of a zero entry in the upper left hand corner
i.e., . Suppose first that for
some . Let denote the identity matrix with the first and
-th rows interchanged. The operation amounts to
interchanging the first and -th columns in . Similarly
is interchanging that first and -th rows in .
The matrix is invertible and is a symmetric matrix
with and we have reduced to the case
of a non-zero entry in the upper left hand corner.
If for every we may assume that for some . Let denote the identity matrix where
the entry in the first column and -th row is . The operation
amounts to adding the -th column to the first
column in . Similarly is adding the -th row
to the first row in . All in all we get , where we have used that for . Again we have reduced to the case of a non-zero entry in the
upper left hand corner.
Consider the real symmetric matrix.
Here . Therefore the fundamental step in the
proof of Theorem
8.31
applies and
and again
Summing up we get
You are invited to check that
Let
Here , but the diagonal element . So we are in the second step of the proof of
Theorem
8.31
. Using the matrix
we get
As argued in the proof, this corresponds to interchanging the first
and third columns and then interchanging the first and third
rows. In total you move the non-zero to the upper left
corner in the matrix.
Consider the symmetric matrix
We have zero entries in the diagonal. As in the third step in the
proof of Theorem
8.31
we must find an invertible matrix
, such that the upper left corner in is
non-zero. In the proof it is used that every diagonal element is
zero: if we locate a non-zero element in the -th column in the
first row, we can add the -th column to the first column and then
the -th row to the first row obtaining a non-zero element in the
upper left corner. For above we choose and the matrix
becomes
so that
Let be any matrix. Show that
is positive semidefinite.
A symmetric matrix with a diagonal entry equal to cannot be positive definite.
is positive semidefinite for every matrix .
Every symmetric matrix is either positive semidefinite or negative semidefinite.
A symmetric matrix with all diagonal entries positive is positive definite.
Find inequalities defining the set
Same question with positive semidefinite. Sketch and compare the two
subsets of the plane .
Let denote the function given by
where . Let denote the Hessian of
in a point .
- Compute .
- Show that for and .
- Compute a non-zero vector , such that in the case, where . Is invertible in this case?
- Show that is strictly convex if .
-
Is strictly convex if ?HintConsider the line segment between and a suitable vector , where .
Why is the subset given by the inequalities
a convex subset of ?
8.7 A schematic procedure for transforming symmetric matrices
Here is the schematic procedure applied to Example
8.32
:
Here is the schematic procedure applied to Example
8.33
:
Here is the schematic procedure applied to Example
8.34
: