Tutorials › Calculus III › Linear Optimization on an Ellipse

Lagrange Multipliers · Tutorial 461 of 999

Linear Optimization on an Ellipse

Derive the two extremal points and values for a linear objective on an ellipse using the Lagrange multiplier equations.

Intermediate 9 min read

What You'll Learn

  • State the assumptions on the ellipse and the linear objective.
  • Set up the Lagrange multiplier equations for this constraint.
  • Derive the candidate points and corresponding objective values.
  • Explain why the candidates give the global maximum and minimum.
  • Handle objectives with a zero coefficient or both coefficients zero.
  • Identify and correct common errors in solving the multiplier equations.

Introduction

A linear function changes at a constant rate in each coordinate, but its maximum and minimum depend on the shape of the constraint. On an ellipse, the longest and shortest values can be found directly from the one-constraint Lagrange equations.

We will maximize and minimize \(f(x,y)=ax+by\) subject to an ellipse with positive semiaxes \(A\) and \(B\). The calculation will produce both the extremal values and the points where they occur.

The ellipse and the objective

Assume throughout that \(A>0\) and \(B>0\). The ellipse is the set of points satisfying

$$ g(x,y)=\frac{x^2}{A^2}+\frac{y^2}{B^2}=1. $$

The positive numbers \(A\) and \(B\) are the lengths of the ellipse’s semiaxes along the \(x\)- and \(y\)-axes. The objective function is \(f(x,y)=ax+by\), where \(a,b\) are fixed real numbers. First suppose \(a\) and \(b\) are not both zero.

Definition: A constrained maximum (or minimum) of \(f\) on the ellipse is the largest (or smallest) value of \(f(x,y)\) among all points \((x,y)\) satisfying \(g(x,y)=1\). A point where that value occurs is an extremizing point.

The ellipse is closed and bounded, hence compact, and \(f\) is continuous. The extreme value theorem therefore guarantees that \(f\) attains both a maximum and a minimum on the ellipse. Also, \(\nabla g=(2x/A^2,2y/B^2)\) is never zero on the ellipse: if it were zero, then \(x=y=0\), which does not satisfy the constraint. Thus the regular-constraint Lagrange multiplier condition applies at each extremum.

Setting up the multiplier equations

For one equality constraint, the Lagrange condition is \(\nabla f=\lambda\nabla g\) at a constrained extremum, for some real multiplier \(\lambda\). Here \(\nabla f=(a,b)\), so the system is

$$ a=\frac{2\lambda x}{A^2}, \qquad b=\frac{2\lambda y}{B^2}, \qquad \frac{x^2}{A^2}+\frac{y^2}{B^2}=1. $$

Since \(a\) and \(b\) are not both zero, these equations imply \(\lambda\ne 0\). If \(\lambda=0\), the first two equations would give \(a=b=0\), contrary to the assumption. We can therefore solve the first two equations for \(x\) and \(y\) without dividing by a potentially zero coefficient:

$$ x=\frac{aA^2}{2\lambda}, \qquad y=\frac{bB^2}{2\lambda}. $$

Substituting these expressions into the ellipse equation determines the possible multiplier values.

Deriving the candidate points and values

1
Express the coordinates using the multiplier.
The stationarity equations give \(x=aA^2/(2\lambda)\) and \(y=bB^2/(2\lambda)\).
2
Impose the constraint.
Substitute those coordinates into \(x^2/A^2+y^2/B^2=1\), which fixes \(\lambda^2\).
3
Evaluate the objective.
Use each multiplier value to find its feasible point and the corresponding value of \(ax+by\).

Define the positive number \(S=\sqrt{a^2A^2+b^2B^2}\). It is positive because \(A,B>0\) and \(a,b\) are not both zero. Substitution into the constraint gives

$$ \frac{1}{A^2}\left(\frac{aA^2}{2\lambda}\right)^2 +\frac{1}{B^2}\left(\frac{bB^2}{2\lambda}\right)^2 = \frac{a^2A^2+b^2B^2}{4\lambda^2} = 1. $$

Consequently \(4\lambda^2=S^2\), so there are exactly two possible multiplier values: \(\lambda=S/2\) and \(\lambda=-S/2\). The corresponding points and objective values are as follows.

$$ \begin{aligned} \lambda=\frac{S}{2} &\quad\Longrightarrow\quad (x,y)=\left(\frac{aA^2}{S},\frac{bB^2}{S}\right), & f(x,y)&=\frac{a^2A^2+b^2B^2}{S}=S,\\[4pt] \lambda=-\frac{S}{2} &\quad\Longrightarrow\quad (x,y)=\left(-\frac{aA^2}{S},-\frac{bB^2}{S}\right), & f(x,y)&=-\frac{a^2A^2+b^2B^2}{S}=-S. \end{aligned} $$
Theorem: If \(A,B>0\) and \((a,b)\ne(0,0)\), the maximum of \(ax+by\) on \(x^2/A^2+y^2/B^2=1\) is \(\sqrt{a^2A^2+b^2B^2}\), attained at \((aA^2/S,bB^2/S)\). The minimum is \(-\sqrt{a^2A^2+b^2B^2}\), attained at the opposite point \((-aA^2/S,-bB^2/S)\), where \(S=\sqrt{a^2A^2+b^2B^2}\).

To see why these candidates are the global extrema, the existence argument guarantees that a maximum and minimum occur, and the regular-constraint condition requires each to solve the multiplier system. That system has only the two points just found. Both satisfy the ellipse constraint, as follows directly from the equation used to obtain \(S^2=4\lambda^2\). Their objective values are \(S\) and \(-S\), with \(S>0\). Thus the larger candidate is the maximum and the smaller is the minimum. This also verifies that the two points are feasible rather than merely formal solutions of part of the system.

Worked examples

Worked Example: A linear function with two nonzero coefficients

Find the maximum and minimum of \(3x+4y\) on \(x^2/4+y^2=1\). Here \(A=2\), \(B=1\), \(a=3\), and \(b=4\). First calculate

$$ S=\sqrt{a^2A^2+b^2B^2} =\sqrt{3^2\cdot 2^2+4^2\cdot 1^2} =\sqrt{36+16} =\sqrt{52} =2\sqrt{13}. $$

The maximizing point is

$$ (x,y)=\left(\frac{3\cdot 2^2}{2\sqrt{13}}, \frac{4\cdot 1^2}{2\sqrt{13}}\right) =\left(\frac{6}{\sqrt{13}},\frac{2}{\sqrt{13}}\right). $$

Its objective value is \(3(6/\sqrt{13})+4(2/\sqrt{13})=26/\sqrt{13}=2\sqrt{13}\). Check the constraint: \(x^2/4+y^2=(36/13)/4+4/13=9/13+4/13=1\). The multiplier is \(\lambda=S/2=\sqrt{13}\). The stationarity equations check as \(2\lambda x/A^2=2\sqrt{13}(6/\sqrt{13})/4=3\) and \(2\lambda y/B^2=2\sqrt{13}(2/\sqrt{13})=4\).

The minimizing point is the opposite point \((-6/\sqrt{13},-2/\sqrt{13})\). Its constraint value is still \(1\), its objective value is \(-26/\sqrt{13}=-2\sqrt{13}\), and it corresponds to \(\lambda=-\sqrt{13}\). Hence the maximum is \(2\sqrt{13}\) and the minimum is \(-2\sqrt{13}\).

Worked Example: A negative coefficient

Find the extrema of \(-x+2y\) on \(x^2/9+y^2/4=1\). We have \(A=3\), \(B=2\), \(a=-1\), and \(b=2\), so

$$ S=\sqrt{(-1)^2\cdot 3^2+2^2\cdot 2^2} =\sqrt{9+16}=5. $$

The maximizing point is \((aA^2/S,bB^2/S)=(-9/5,8/5)\). Verify the constraint:

$$ \frac{(-9/5)^2}{9}+\frac{(8/5)^2}{4} =\frac{81}{225}+\frac{64}{100} =\frac{9}{25}+\frac{16}{25} =1. $$

The objective there is \(-(-9/5)+2(8/5)=9/5+16/5=5\). For \(\lambda=S/2=5/2\), the first stationarity right-hand side is \(2\lambda x/A^2=5(-9/5)/9=-1\), and the second is \(2\lambda y/B^2=5(8/5)/4=2\), as required. The minimizing point is \((9/5,-8/5)\); it satisfies the same constraint and gives \(-(9/5)+2(-8/5)=-25/5=-5\). Thus the extrema are \(5\) and \(-5\).

Worked Example: One coefficient is zero

Find the extrema of \(2x\) on \(x^2+y^2/9=1\). Here \(A=1\), \(B=3\), \(a=2\), and \(b=0\). Then \(S=\sqrt{2^2\cdot1^2+0^2\cdot3^2}=2\). The maximizing point is \((2\cdot1^2/2,0\cdot3^2/2)=(1,0)\), where the objective is \(2\). The constraint check is \(1^2+0^2/9=1\), and with \(\lambda=1\), the stationarity equations give \(2\lambda x/A^2=2\) and \(2\lambda y/B^2=0\). The minimizing point is \((-1,0)\), which satisfies the constraint and gives \(-2\). The \(y\)-coordinate is zero at both extrema, even though the ellipse has a nonzero vertical semiaxis.

Why the method works and what can go wrong

The multiplier condition says that at an extremum the objective’s gradient is parallel to the constraint’s gradient. For this problem, \(\nabla f=(a,b)\) and \(\nabla g=(2x/A^2,2y/B^2)\). The resulting coordinate equations account for the different horizontal and vertical scales of the ellipse. In particular, the coordinates of the extremizing point contain \(A^2\) and \(B^2\), not just \(A\) and \(B\).

A common error is to use \(aA\) and \(bB\) in the coordinates instead of \(aA^2\) and \(bB^2\). For the first example, that incorrect rule would give \((3A/S,4B/S)=(3/\sqrt{13},2/\sqrt{13})\). But this point fails the ellipse constraint:

$$ \frac{(3/\sqrt{13})^2}{4}+(2/\sqrt{13})^2 =\frac{9}{52}+\frac{16}{52} =\frac{25}{52}\ne 1. $$

The correction is to solve the multiplier equations themselves: \(x=aA^2/(2\lambda)\) and \(y=bB^2/(2\lambda)\). The squared semiaxis factors follow from the derivatives of \(x^2/A^2\) and \(y^2/B^2\).

Another potential oversight is to keep only the positive multiplier. That finds the maximum but loses the minimum. The constraint determines \(\lambda^2\), not \(\lambda\), so both signs must be included. They produce opposite points and opposite objective values.

If \(a=b=0\), the objective is the constant function \(f(x,y)=0\). In that exceptional case every point on the ellipse is both a maximum and a minimum, and the formula using \(S\) would involve division by zero. This is why the theorem explicitly assumes that the coefficient pair is nonzero.

This result is useful whenever a linear quantity is optimized under an elliptical constraint. It gives an immediate way to calculate the extremal value and locate where it occurs, while also making the effect of each semiaxis explicit. The larger semiaxis contributes more strongly to the value when its corresponding objective coefficient is nonzero.

Check Your Understanding

Use the multiplier equations and the ellipse constraint to answer these questions.

  1. For \(2x-y\) on \(x^2/4+y^2/9=1\), what is \(S\), and where are the maximum and minimum attained?
  2. Why must the multiplier be nonzero when \(a\) and \(b\) are not both zero?
  3. What objective values correspond to the positive and negative multiplier candidates?
  4. For \(5y\) on \(x^2/16+y^2/4=1\), what are the extremizing points and values?
  5. What happens when both coefficients \(a\) and \(b\) are zero?