Uge 6: Extremum and Optimization#

Key Terms#

  • Image/range of a continuous function

  • Extremum (minimum or maximum)

  • Global extremum

  • Local extremum

  • Stationary points and other conditions

  • Extremum determination

  • Second-order test and Hessian

  • Positive (semi-)definite matrices

Preparation and Syllabus#


Exercises – Long Day#

1: Stationary Points and Extremum Values#

A function \(f: \mathbb{R}^2 \to \mathbb{R}\) is given by

\[\begin{equation*} f(x,y)=xy(2-x-y)+1. \end{equation*}\]

Question a. By Hand#

Find all stationary points of \(f\). Compute the function value at all stationary points.

Question b. With SymPy#

Plot the level curves of the function and describe their form. You do not have to provide a precise mathematical description of these level curves.

Question c#

Determine a parametric representation \(\pmb{r}(t)\), \(t \in \mathbb{R}\), of a straight line through one of the stationary points. Plot the graph of the composite function \(f \circ \pmb{r}\).

Question d#

Repeat question c with another straight line through a stationary point.

Question e#

We will on Short Day learn methods for determination of whether stationary points are maximum points, minimum points, or neither. Based on what you know about the function, e.g. from looking at the plot, we are today only asking you to give an educated guess on whether the found stationary points are maximum points, minimum points, or neither.

2: A Return to Theme Exercise 1#

In Theme 1: The Gradient Method we considered three functions of the form \(f_i: \mathbb{R}^2 \to \mathbb{R}\). All of the functions had precisely one minimum but no maximum since they grew towards infinity. You may use this information without proof.

We will here use the functions (with their standard values) given in Python by:

# Variables and parameters that are involved in the functions
x1, x2 = symbols('x1 x2', real=True)
a, lambda1 = symbols('a lambda1',  positive=True)
def f1(x1, x2, a = S(1/2)):
    return a * x1**2 + 1 * x2**2

def f2(x1, x2, lambda1 = 0.5):
    Q = 1/sqrt(2) * Matrix([[1,1],[1,-1]])
    A = Q.T * Matrix([[lambda1,0],[0,1]]) * Q
    b = Matrix([-2,4])
    x = Matrix([x1,x2])
    q = x.T * A * x + x.T * b
    return q[0] 

def f3(x1, x2):
    return (1 - x1)**2 + 100*(x2 - x1**2)**2

In the Theme Exercise we used the gradient method to look for the minimum point and the minimum value. This is a good method for some functions, for instance when the function has many (maybe infinitely many) points at which it is not differentiable. But for “nice” functions (such as functions that are infinitely many times differentiable - also known as smooth), like the three functions in the question, it is much easier to simply find the points at which the gradient is equal to the zero vector.

Find all stationary points and their corresponding minimum values for each of the three functions. State the image of each function.

3: Extremum or not. By Hand#

Let \(f: \mathbb{R}^2 \to \mathbb{R}\) be given by

\[\begin{equation*} f(x,y)=x^2 y + y. \end{equation*}\]

Determine all local extrema of \(f\).

4: A Function that is not Differentiable Everywhere#

Let \(f: \mathbb{R}^2 \to \mathbb{R}\) be given by

\[\begin{equation*} f(x,y)=-|x| ((y-1)^2+1). \end{equation*}\]

Question a#

Find all points where the function can attain an extremum value.

Question b#

Find the global maximum and minimum values of the function.

5: Global Maximum and Global Minimum#

Let \(f: A \to \mathbb{R}\) be given by:

\[\begin{equation*} f(x,y)=xy(2-x-y)+1. \end{equation*}\]

where \(A \subset \mathbb{R}^2\) denotes the region in the \((x,y)\) plane where \(x\in\left[ 0,1\right]\) and \(y\in\left[ 0,1\right]\). Note that the functional expression of \(f\) is the same as in 1: Stationary Points and Extremum Values.

Question a#

Find by hand all stationary points of \(f\) in the interior of \(A\).

Question b#

Determine the global maximum and minimum values of \(f\) as well as the points at which these values are attained.

Question c#

This exercise concerns a differentiable function of two variables defined on \([0,1]^2\). How would you solve this exercise if it was concerning a differentiable function of five variables defined on \([0,1]^5\)? Discuss a possible approach. You may include a chatbot such as https://copilot.microsoft.com/ in your discussion.

Question d#

Determine the range of \(f\).

Question e#

Plot the graph of \(f\) along with the points that show where on the graph the largest and smallest values are attained, and check that your results look decent.

6: Global Maximum and Global Minimum again#

Consider the function \(f:\mathbb{R}^2\rightarrow\mathbb{R}\) given by

\[\begin{equation*} f(x,y)=x^2-3y^2-3xy \end{equation*}\]

as well as the set \(A=\lbrace(x,y) \in \mathbb{R}^2 \,| \, x^2+y^2\leq 1\rbrace\).

Justify that \(f\) has both a global maximum and a global minimum on \(A\), and compute these values as well as the points at which they are attained.

7: Stationary Points of Quadratic Forms#

Let \(q : \mathbb{R}^n \to \mathbb{R}\) be a quadratic form. In other words, \(q\) has the functional expression

\[\begin{equation*} q(\pmb{x}) = \pmb{x}^T A \pmb{x} + \pmb{b}^T \pmb{x} + c, \end{equation*}\]

where \(A\) is an \(n \times n\) matrix (and not the zero matrix), \(\pmb{b} \in \mathbb{R}^n\) is a column vector, and \(c \in \mathbb{R}\).

It applies that \(q\) is a differentiable function with \(\nabla q(\pmb{x}) = (A + A^T) \pmb{x} + \pmb{b}\), according to this example. You do not have to show this (not until the final question, that is).

Question a#

Write out a system of equations whose solution describes the stationary points. Argue that \(q\) can have either zero, one, or infinitely many stationary points.

Question b#

Assume that \(A + A^T\) is invertible. Argue that \(q\) has exactly one stationary point. Find the stationary point (you must find the formula or expression for the stationary point).

Question c#

Assume that \(A\) is symmetric. Argue that \(q\) has exactly one stationary point if and only if \(0\) is not an eigenvalue of \(A\).

Question d#

Derive the formula that we assumed to begin with: \(\nabla q(\pmb{x}) = (A + A^T) \pmb{x} + \pmb{b}\).

8: A Challenge in Linear Algebra#

Let \(A\) be an \(n \times n\) matrix. Does it apply that the symmetric matrix \(A + A^T\) is invertible if \(A\) is invertible? Prove this, or provide a counterexample to disprove it!


Exercises – Short Day#

1: Application of Hessian Matrix. By Hand#

Consider the function \(f:\mathbb{R}^2\rightarrow\mathbb{R}\) given by

\[\begin{equation*} f(x,y)=x^2+4y^2-2x-4y. \end{equation*}\]

Question a#

Justify that the function \(f\) has exactly one extremum. Determine this extremum point and compute the extremum value.

Question b#

What is the difference between an extremum and a strict extremum (also known as a proper extremum)? Is the found extremum a strict extremum?

2: Local extrema and Approximating Second-Degree Polynomial#

A function \(f:\mathbb{R}^2\rightarrow\mathbb{R}\) is given by the expression

\[\begin{equation*} f(x,y)=x^3+2y^3+3xy^2-3x^2. \end{equation*}\]

Question a#

Show that the points \(A=(2,0)\), \(B=(1,-1)\), and \(C=(0,0)\) are stationary points of \(f\) and determine for each of them whether it is a local maximum point or a local minimum point. If so, then state the corresponding local maximum/minimum value, and determine whether it is strict.

Question b#

Show that the approximating second-degree polynomial for \(f\) with expansion point \(A\) can be written as an equation in the unknowns \(x,y\), and \(z\) in the form:

\[\begin{equation*} z-c_3=\frac 12\lambda_1(x-c_1)^2+\frac 12\lambda_2(y-c_2)^2. \end{equation*}\]

Which surface does this equation describe, and what do the constants represent?

Question c#

Draw the graph of \(f\) along with the graph of the approximating second-degree polynomials for \(f\) with the expansion points \(A\), \(B\), and \(C\). Discuss whether one, based on the eigenvalues of the Hessian matrix at the three points, can determine which type of conic section these second-degree polynomials describe.

3: A Return to Theme Exercise 1, yet again#

We consider the quadratic form \(f_2: \mathbb{R}^2 \to \mathbb{R}\) from Theme 1: The Gradient Method. This is given by \(q: \mathbb{R}^2 \to \mathbb{R}\) with the expression

\[\begin{equation*} q(\pmb{x}) = \pmb{x}^T A \pmb{x} + \pmb{b}^T \pmb{x}, \end{equation*}\]

where \(A\) is a \(2 \times 2\) matrix that depends on \(\lambda_1 \in \mathbb{R}\). The following information is given:

\[\begin{equation*} A = Q^T \Lambda Q, \quad Q = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}, \quad \Lambda = \begin{bmatrix} \lambda_1 & 0 \\ 0 & 1 \end{bmatrix}, \end{equation*}\]

and \(\pmb{b} = - 2 A [1,2]^T\). The changes that we do here compared to the Theme Exercise are: 1) \(\lambda_1\) must be zero or negative, and 2) we use a new definition of \(\pmb{b}\).

Question a. By Hand#

Compute the eigenvalues of \(A\).

Question b. By Hand#

Find all stationary points of \(q\) when \(\lambda \neq 0\).

Question c#

How are \(A\) and the Hessian matrix \(\pmb{H}_f\) related? Find the resultat in the book if you cannot remember. Describe the stationary points for each of the three cases: \(\lambda_1 > 0\), \(\lambda_1 = 0\), and \(\lambda_1 < 0\).

Question d#

How is \(q\) and the approximating second-degree polynomial (with an arbitrary expansion point) related? Plot \(q\) for each of the three cases: \(\lambda_1 > 0\), \(\lambda_1 = 0\), and \(\lambda_1 < 0\). Which normal forms are we dealing with here (refer to https://en.wikipedia.org/wiki/Quadric#Euclidean_space).

4: Global Extrema of Function of Three variables#

We consider the function \(f:\mathbb{R}^3\rightarrow \mathbb{R}\) Given by

\[\begin{equation*} f(x,y,z)=\sin(x^2+y^2+z^2-1)-x^2+y^2-z^2 \end{equation*}\]

as well as the solid unit sphere

\[\begin{equation*} \mathcal{K}=\left\{(x,y,z)\in \mathbb{R}^3|x^2+y^2+z^2\leq 1\right\}. \end{equation*}\]

Question a#

Show that \(f\) in the interior of \(\mathcal{K}\) only has one stationary point, that being \(O=(0,0,0)\), and investigate whether \(f\) has extremum at \(O\).

Question b#

Compute the global maximum value and the global minimum value of \(f\) on \(\mathcal{K}\) as well as the points where these values are attained.

Question c#

Determine the range of \(f\) on \(\mathcal{K}\).

5: Where is the Global Maximum? Minimum?#

A function \(f:\mathbb{R}^2\rightarrow\mathbb{R}\) is given by the expression

\[\begin{equation*} f(x,y)=\exp(x^2+y^2)-4xy. \end{equation*}\]

Remember that \(\exp(x^2+y^2) = \mathrm{e}^{x^2+y^2}\).

Question a#

Find all stationary points of \(f\).

Question b#

Find all local extrema.

Question c#

Determine whether the function \(f\) has a global maximum or minimum, and compute the values of these if they exist.

Question d#

State the range of the function.