Finding the maximum value of a function on an ellipse

Let $x$ and $y$ be real numbers such that $x^2 + 9 y^2-4 x+6 y+4=0$. Find the maximum value of $\displaystyle \frac{4x-9y}{2}$.

My solution: the given function represents an ellipse. Rewriting it, we get $\displaystyle (x-2)^2 + 9(y+\frac{1}{3})^2=1$. To find the maximum of $\displaystyle \frac{4x-9y}{2}$, $x$ should be at its maximum and $y$ at its minimum. Solving the equations, I get that $x = 3$ and $\displaystyle y = -\frac{2}{3}$, but the answer i get is wrong. What am I doing wrong?


HINT : Letting $k=\frac{4x-9y}{2}$, this represents a line $y=\frac{4}{9}x-\frac{2}{9}k.$

Then, find the max $k$ such that the line is tangent to the ellipse.

You can set $y=\frac{4}{9}x-\frac{2}{9}k$ in the equation of the ellipse, then you'll get an equation of $x$. Then, find the condition that the equation has only one real solution. This gives you two $ks$. Then, the bigger $k$ is what you want.


This is a classic application of the so-called Lagrange Multiplier. We want to maximise the value of $2x-\tfrac{9}{2}y$ subject to the constraint $x^2 + 9 y^2-4 x+6 y+4=0$. We define

$$\Lambda(x,y,\lambda) = \left(2x-\tfrac{9}{2}y\right)+\lambda\left(x^2 + 9 y^2-4 x+6 y+4\right)$$

The point(s) you are looking for come from solving $\Lambda_x=\Lambda_y=\Lambda_{\lambda}=0$.

Calculating the three partial derivatives gives: $$(x,y,\lambda) = \left(\frac{6}{5},-\frac{2}{15},\frac{5}{4}\right) \ \ \text{and} \ \ \left(\frac{14}{5},-\frac{8}{15},-\frac{5}{4}\right)$$

The values $(x,y)=(6/5,-2/15)$ correspond to a minimum, where $2x-\tfrac{9}{2}y=3$.

The values $(x,y)=(14/5,-8/15)$ correspond to a maximum, where $2x-\tfrac{9}{2}y=8$.


Using parametric form, $\displaystyle x-2=\cos\phi,3\left(y+\frac13\right)=\sin\phi$

$\displaystyle\implies x=2+\cos\phi, 3y=\sin\phi-1 $

$\displaystyle\implies\frac{4x-9y}2=\frac{4(2+\cos\phi)-3(\sin\phi-1)}2=\frac{11+4\cos\phi-3\sin\phi}2$

Can you prove $$-\sqrt{a^2+b^2}\le a\cos \theta+b\sin\theta\le \sqrt{a^2+b^2}?$$


Here is yet another way to approach the problem, which fits somewhere between the methods described by Fly By Night and mathlove .

The expression we seek to maximize can be treated as a function of two variables $ \ z \ = \ f(x,y) \ = \ 2x \ - \ \frac{9}{2}y \ $ , which will produce as its level curves a family of parallel lines $ 2x \ - \ \frac{9}{2}y \ = \ c \ \ \Rightarrow \ \ y \ = \ \frac{4}{9}x \ - \ \frac{2}{9}c \ \ , $ as mathlove describes. Thus, the value of $ \ c \ $ corresponds to a change in the $ \ y-$intercept of the line; there is a minimal value of $ \ c \ $ for a line which is just tangent to the ellipse and a maximum value of $ \ c \ $ for a line tangent elsewhere (we will discuss those tangent points shortly).

Looking at this in three dimensions, the equation $ \ x^2 - 4x + 9y^2 + 6y + 4 \ = \ 0 \ $ represents an elliptic cylinder, the cross-section of which is everywhere the same as the ellipse in the $ \ xy-$plane. The function $ \ z \ = \ 2x \ - \ \frac{9}{2}y \ $ represents a plane slicing obliquely through this cylinder. The problem at hand asks for the maximum "height" $ \ z \ $ above the $ \ xy-$plane at which there is an intersection point between the cylinder and the plane.

enter image description here

Returning to the problem in two dimensions, we see then that we are seeking the point(s) at which the lines $ \ y \ = \ \frac{4}{9}x \ - \ \frac{2}{9}c \ $ are tangent to the ellipse, which requires us to find the locations on the ellipse which match the slope of the lines. (It will quickly be evident that there is no point in the interior of the ellipse that maximizes or minimizes $ \ c \ $ . ) By using implicit differentiation, we can find the slope of the tangent line to a point on the ellipse to be

$$ \frac{d}{dx} \ [ x^2 - 4x + 9y^2 + 6y + 4 ] \ = \ \frac{d}{dx} \ [ 0 ] \ \ \Rightarrow \ \ 2x - 4 + 18yy' + 6y' \ = \ 0 $$

$$ \Rightarrow \ y' \ = \ \frac{4 - 2x}{18y + 6} \ = \ \frac{2 - x}{3 \ (3y + 1)} \ . $$

It is this slope that we wish to set equal to the slope of the level curve lines:

$$ \frac{2 - x}{3 \ (3y + 1)} \ = \ \frac{4}{9} \ \Rightarrow \ 3 ( 2 - x ) \ = \ 4 ( 3y + 1 ) \ \Rightarrow \ y \ = \ \frac{1}{6} \ - \ \frac{1}{4}x \ . $$

The significance of this new linear equation is that the tangent points we are looking for lie on this line; what is also of interest is that we can write the equation as

$$ y \ - \ \frac{1}{6} \ + \ \frac{1}{2} \ = \ - \frac{1}{4} x \ + \ \frac{1}{2} \ \Rightarrow \ y \ + \frac{1}{3} \ = \ - \frac{1}{4} ( x - 2 ) \ ; $$

this means that the tangent points lie at opposite ends of a line segment passing through the center of the ellipse, as found from the equation in standard form which user117638 noted. (We see this sort of result in similar problems for locating the extrema of linear functions on curves with four-fold symmetry.) The matching of slopes of the tangent lines to the local slope of the ellipse is the essence of the Lagrange-multiplier method Fly By Night describes (what we are "really" doing is matching the gradient of the linear function to the local normal lines to points on the ellipse).

enter image description here

Now substituting $ \ y \ = \ \frac{1}{6} - \frac{1}{4}x \ $ into the equation of the ellipse, $ \ (x - 2)^2 \ + \ 9(y+\frac{1}{3})^2 \ = \ 1 \ $ leads to the quadratic equation $ \ \frac{25}{16}x^2 \ - \ \frac{25}{4}x \ + \ \frac{21}{4} \ = \ 0 \ . $ Solving the two equations simultaneously leads to the coordinate pairs $ \ ( \frac{14}{5} \ , \ - \frac{8}{15}) \ \ \text{and} \ \ ( \frac{6}{5} \ , \ - \frac{2}{15}) \ . $ Inserting these now into the tangent line equation $ \ y \ = \ \frac{4}{9}x \ - \ \frac{2}{9}c \ $ gives us the two parallel lines

$$ y \ = \ \frac{4}{9}x \ - \ \frac{16}{9} \ \Rightarrow \ c = 8 $$

and

$$ y \ = \ \frac{4}{9}x \ - \ \frac{6}{9} \ \Rightarrow \ c = 3 \ \ , $$

thereby presenting us with the maximal and minimal values of the linear function on the ellipse, respectively.