# Finding the maximal value of a function on a ellipse

How would you find the maximal value of $$f(x,y) = x - y^2$$ on $K = \left\{ (x,y) : \frac{x^2}{4} + \frac{y^2}{9} = 1 \right\}$?

-
How would I find the maximal value? I'd glance at $f$ and say, okay, you want $x$ to be big and $y$ to be zero, so the maximum is at $(x,y) = (2,0)$. – Rahul Jun 8 '12 at 16:50
Less facetiously, Lagrange multipliers. – Rahul Jun 8 '12 at 16:51
I like your first solution better. A little alertness and common sense pays off sometimes. – Stefan Smith Jun 8 '12 at 20:40

Because $\frac{x^2}4 + \frac{y^2}9 = 1$, we know $y^2 = 9\left(1 - \frac{x^2}4\right)$. Substitute this into $x-y^2$ should give a function depending on $x$ only, which you can easily find the maximum (and remember that $x\in[-2,2]$).

-
Why $x\in[-2,2]$? – Gigili Jun 8 '12 at 16:58
@Gigili: Because otherwise there is no real solution to $\frac{x^2}4+\frac{y^2}9=1$. – kennytm Jun 8 '12 at 17:00
Got it, thank you. – Gigili Jun 8 '12 at 17:03

Use the constraint $(9/4)x^2 - 9 = -y^2$ and plug in to $f(x,y)$. You will get

$f(x) = x + (9/4)x^2 - 9$.

Differentiate, $f'(x) = 1 + (9/2)x$,

solve $2 + 9x = 0$ and get $x = -\frac{2}{9}$.

Now you must perform a "sanity check" to see if $x$ is in $K$. Since $x \in \pi_xK$ iff $x^2 \le 4$, ifff $-2 \le x \le 2$, we see that $x=-(2/9)$ satisfy the condition and thus $(x,\mbox{the matching }y) \in K$.

Now, to see if it's a maximum or a minimum, differentiate again:

$f''(x) = 9/2 > 0$ so it is a minimum. Since $f(x)$ is continuous in a closed interval $[-2,2]$ (and in no other place the derivative is 0) it gets its maximum on one of the end points. Now, plug in $x = \pm 2$ in $f(x)$ and find which gives the bigger value of $f(x)$.

-