Exercise set G#
Please, see the general comment on the tutorial exercises
Question G.1#
Solve the following constrained maximization problem using the Lagrange method, including the second order conditions.
Hint
Write down the Lagrangian function \(\mathcal{L}({\bf x},{\bf \lambda})\)
Find all stationary points of \(\mathcal{L}({\bf x},{\bf \lambda})\) with respect to \({\bf x}\) and \({\bf \lambda}\), i.e. solve the system of first order equations
Derive the bordered Hessian \(H \mathcal{L}({\bf x},{\bf \lambda})\) and compute it value at the stationary points
Using second order conditions, check if the stationary points are local optima
Compare the function values at all identified local optima to find the global one
Question G.2#
Solve the following constrained maximization problem using the Karush-Kuhn-Tucker method. Verify that the found stationary/critical points satisfy the second order conditions.
Hint
Write down the Lagrangian function \(\mathcal{L}({\bf x},{\bf \lambda})\)
Solve the KKT first order conditions to find the stationary points of \(\mathcal{L}({\bf x},{\bf \lambda})\) with respect to \({\bf x}\), together with the non-negativity of KKT multipliers and complimentary slackness conditions
Using second order conditions using the subset of binding constraints, check if the stationary points at the boundary are local optima. Similarly, using the second order conditions for the unconstrained problem to investigate the interior stationary points
Compare the function values at all identified local optima to find the global one
Solutions
Question G.1
Let \(f(x,y)= x^3/3 - 3y^2 + 2x\) and \(g(x,y)=4x-y^3\) for all \(x,y∈\mathbb{R}\). The constraint set is \(\{(x,y): g(x,y)=0\}\). The Lagrangian function is
The first order partial derivatives are
The bordered Hessian matrix is
Observe that \(\mathrm{rank}(Dg)) = \mathrm{rank}((-4, 3 y^2)) = 1\) for all \(x,y ∈ \mathbb{R}\). That is, the constrained qualification holds for all points on the constraint.
The first order conditions are
Observe that if \(\lambda=0\), then the FOCs imply \(x^2+2-4\lambda = x^2+2 = 0\), which is a contradiction since \(x^2+2 ≥ 2\). It must be that \(\lambda ≠ 0\). Next, from the equation \(-6y+3\lambda y^2 = 3y(\lambda y -2)=0\), it is either \(y=0\) or \(y = \lambda/2\).
Case 1: Suppose that \(y=0\). Then, from the constraint \(4x=y^3\) we get \(x=0\). Also, the FOC yields \(x^2+2 - 4\lambda = 0+2-4\lambda=0\) so that \(\lambda=1/2\). Hence, the optimizer is \((x^*, y^*, \lambda^*)=(0,0,1/2)\). The corresponding bordered Hessian matrix is
Since there are two variables \(N=2\) and one constraint \(K=1\), it suffices to check the last (\(N-K=1\)) leading principal minor, i.e., the determinant of the full bordered Hessian matrix. The determinant follows
It has the same sign as \((-1)^N=(-1)^2\). Therefore, the bordered Hessian matrix is negative definite and \((x^*, y^*, \lambda^*)=(0,0,1/2)\) is a local maximizer on the constraint set.
Case 2: Suppose that \(y=2/\lambda\). Then, by \(\lambda = 2/y\) and \(x = y^3/4\), the FOCs yield
Let \(h(y)=y^7 + 32 y - 128\). Since \(h'(y)=7 y^6+32 >0\), function \(h\) is strictly increasing. Note that the solution for \(h(y)=0\) is strictly positive since \(y^7\) and \(y\) have the same sign. We can verify that \(y^* ≈ 1.8325\) solves \(h(y)=0\). The optimizer is \((x^*, y^*,\lambda^*)=(\bar{y}^{3}/4, \bar{y}, 2/\bar{y})\) where \(\bar{y}\) satisfies \(h(\bar{y})=0\). The corresponding bordered Hessian is
The determinant is
where the last inequality holds since \(\bar{y}\) is positive. Therefore, \(H\mathcal{L}\) has the same sign as \((-1)^K= -1\) so that it is positive definite. Hence, \((x^*, y^*,\lambda^*)=(\bar{y}^{3}/4, \bar{y}, 2/\bar{y})\) is a local minimizer on the constraint set.
Finally, since \(f(x,y) = x^3/3-3y^2+2x = x^3-3(4x)^{1/3}+2x → \infty\) as \(x→\infty\), there is no global maximizer. The local maximizer on the constraint is \((x,y)=(0,0)\).
Question G.2
The constraint is \(g(x,y) := x^2-y^2 - 1≤ 0\). The Lagrangian function is
The necessary KKT conditions are given by the following system of equations and inequalities
To solve this system, we start from checking the two possible cases: \(\lambda=0\) and \(\lambda>0\).
Case 1. \(\lambda=0\): the constraint could not be binding. Then, the FOCs imply \(x=y=0\). The unconstrained Hessian matrix is
We have \(\det(H)=0\) and \(trace(H)=0\) so that there is no sufficient information to conclude the property of the stationary point.
Case 2. \(\lambda>0\): the constraint is binding. Then, the problem is the optimization with equality constraint, given two control variables \(N=2\) and one constraint \(K=1\). From the FOCs, we have
Since further we have the constraint \(x^2+y^2=1\), there are three cases: “\(x=0, y<0\)”, “\(x>0, y=0\)” or “\(x>0, y<0\)”.
(i) If \(x>0, y<0\), then it follows from the above conditions that
Since \(x^2+y^2=1\) and \(x>0, y<0\), we have \(x=1/\sqrt{2}, y=-1/\sqrt{2}\) and then \(\lambda= 3/(2\sqrt{2})\).
Observe that \(\mathrm{rank}(Dg)) = \mathrm{rank}((2x, 2y)) = 1\) for \(x≠ 0\) or \(y\neq0\), so the constrained qualification holds for any point on the boundary.
The bordered Hessian matrix is
Now, the bordered Hessian at \((x,y,\lambda) = (1/\sqrt{2}, -1/\sqrt{2}, 3/(2\sqrt{2}))\) is
It suffices to check the last leading principal minor. The determinant is
which has the same sign as \((-1)^K=(-1)\). Therefore, it is positive definite and we have a local minimum on the boundary.
(ii) If \(x=0, y<0\), then from \(x^2+y^2=1\), we have \(y=-1\). Also, \(\lambda=-3y/2 = 3/2\). The border Hessian is
The determinant is \(\det (H\mathcal{L})=12 >0\), which has the same sign as \((-1)^2\) and then the Hessian matrix is negative definite. Therefore, \((0, -1)\) is a local maximum.
(iii) If \(x>0, y=0\), then from \(x^2+y^2=1\), we have \(x=1\). Also, \(\lambda=3x/2 = 3/2\). The border Hessian is
The determinant is \(\det (H\mathcal{L})=12 >0\), which has the same sign as \((-1)^2\) and then the Hessian matrix is negative definite. Therefore, \((1, 0)\) is a local maximum.
Finally, the objective values for the local maximums are \(f(1,0)=f(0,-1)=1\) and note that the constrained set is compact. Therefore, these two local maximizers are also global maximizers.
Graphical representation of question G.1#
Show code cell source
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
f = lambda x: x[0]**3/3 - 3*x[1]**2 + 2*x[0]
gx = lambda y: y**3/4
gy = lambda x: (4*x)**(1/3)
x = y = np.linspace(-5.0, 5.0, 100)
X, Y = np.meshgrid(x, y)
zs = np.array([f((x,y)) for x,y in zip(np.ravel(X), np.ravel(Y))])
Z = zs.reshape(X.shape)
ymax = gy(5.0)
y = np.linspace(-ymax, ymax, 100)
X1,Y1 = gx(y),y
zs = np.array([f((x,y)) for x,y in zip(np.ravel(X1), np.ravel(Y1))])
Z1 = zs.reshape(X1.shape)
fig = plt.figure(dpi=160)
ax1 = fig.add_subplot(111)
ax1.set_aspect('equal', 'box')
ax1.contour(X, Y, Z, 50,
cmap=cm.jet)
ax1.plot(X1, Y1)
plt.setp(ax1, xticks=[],yticks=[])
fig = plt.figure(dpi=160)
ax2 = fig.add_subplot(111, projection='3d')
ax2.plot_wireframe(X, Y, Z,
rstride=2,
cstride=2,
alpha=0.7,
linewidth=0.25)
f0 = f(np.zeros((2)))+0.1
ax2.plot(X1, Y1, Z1, c='red')
plt.setp(ax2,xticks=[],yticks=[],zticks=[])
ax2.view_init(elev=18, azim=-160)
plt.show()
Graphical representation of question G.2#
Show code cell source
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
f = lambda x: (x[0])**3 - (x[1])**3
lb,ub = -1.5,1.5
x = y = np.linspace(lb,ub, 100)
X, Y = np.meshgrid(x, y)
zs = np.array([f((x,y)) for x,y in zip(np.ravel(X), np.ravel(Y))])
Z = zs.reshape(X.shape)
a,b=1,1
# (x/a)^2 + (y/b)^2 = 1
theta = np.linspace(0, 2 * np.pi, 100)
X1 = a*np.cos(theta)
Y1 = b*np.sin(theta)
zs = np.array([f((x,y)) for x,y in zip(np.ravel(X1), np.ravel(Y1))])
Z1 = zs.reshape(X1.shape)
fig = plt.figure(dpi=160)
ax2 = fig.add_subplot(111)
ax2.set_aspect('equal', 'box')
ax2.contour(X, Y, Z, 50,
cmap=cm.jet)
ax2.plot(X1, Y1)
plt.setp(ax2, xticks=[],yticks=[])
fig = plt.figure(dpi=160)
ax3 = fig.add_subplot(111, projection='3d')
ax3.plot_wireframe(X, Y, Z,
rstride=2,
cstride=2,
alpha=0.7,
linewidth=0.25)
f0 = f(np.zeros((2)))+0.1
ax3.plot(X1, Y1, Z1, c='red')
plt.setp(ax3,xticks=[],yticks=[],zticks=[])
ax3.view_init(elev=18, azim=154)
plt.show()