# Optimize distance from the origin for an ellipse

• Sep 26th 2009, 12:35 PM
garymarkhov
Optimize distance from the origin for an ellipse
The question: Find the maximum distance from the origin to the ellipse $x^2+xy+y^2=3.3$.

My work: I figure that the distance to the origin is defined by the equation $\sqrt{x^2+y^2}$ so that is the function I need to maximize subject to the constraint defined by the equation of the ellipse.

So I've formed the Lagrangian $L= \sqrt{x^2+y^2} + \mu (x^2+xy+y^2-3.3)$ and taken the partials:

$\frac{\partial L}{\partial x}= \frac{2x}{2 \sqrt{x^2+y^2}}-2\mu x-\mu y$

$\frac{\partial L}{\partial y}= \frac{2y}{2 \sqrt{x^2+y^2}}-2\mu y-\mu x$

$\frac{\partial L}{\partial \mu}= -x^2-xy-y^2+3.3$

After setting all the partials equal to zero, I don't know where to go. No obvious algebraic solutions are coming to mind.
• Sep 26th 2009, 01:01 PM
galactus
You could do this without Lagrange by solving the ellipse equation for y and subbing into $x^{2}+y^{2}=L$, differentiating, setting to 0 and solving for x.

It will take some algebra, but it certainly doable.
• Sep 26th 2009, 01:29 PM
garymarkhov
Quote:

Originally Posted by galactus
You could do this without Lagrange by solving the ellipse equation for y and subbing into $x^{2}+y^{2}=L$, differentiating, setting to 0 and solving for x.

It will take some algebra, but it certainly doable.

Hmm, I'm not talented enough to solve $x^2+xy+y^2=3.3$ for y. Is it possible?

• Sep 26th 2009, 01:40 PM
galactus
Yes, it is. I get

$y=\frac{\sqrt{13.2-3x^{2}}-x}{2}, \;\ y=\frac{-\sqrt{13.2-3x^{2}}-x}{2}$
• Sep 26th 2009, 01:56 PM
garymarkhov
Quote:

Originally Posted by galactus
Yes, it is. I get

$y=\frac{\sqrt{13.2-3x^{2}}-x}{2}, \;\ y=\frac{-\sqrt{13.2-3x^{2}}-x}{2}$

That's great... can you show me how to do it?
• Sep 26th 2009, 02:37 PM
galactus
Actually, it is amazingly easy. Use the quadratic formula.

$y^{2}+\underbrace{x}_{\text{b}}\cdot y+\overbrace{x^{2}-3.3}^{\text{c}}=0$

$y=\frac{-x\pm\sqrt{x^{2}-4(1)(x^{2}-3.3)}}{2(1)}$

Just simplify a wee bit and that's it.

See there?.(Cool)
• Sep 26th 2009, 04:35 PM
garymarkhov
Quote:

Originally Posted by galactus
Actually, it is amazingly easy. Use the quadratic formula.

$y^{2}+\underbrace{x}_{\text{b}}\cdot y+\overbrace{x^{2}-3.3}^{\text{c}}=0$

$y=\frac{-x\pm\sqrt{x^{2}-4(1)(x^{2}-3.3)}}{2(1)}$

Just simplify a wee bit and that's it.

See there?.(Cool)

Very cool.

As for solving this thing, why would I want to sub my newly found y into $x^{2}+y^{2}=L$? The function I want to maximize is
$
\sqrt{x^2+y^2}=L
$
(where L is distance to origin) isn't it?

• Sep 27th 2009, 02:24 AM
galactus
It is better to maximize $x^{2}+y^{2}$ because there is no radical. Remember, the distance and the square of the distance have their max and min at the same point. Therefore, no need to differentiate the radical. Just differentiate $L=x^{2}+y^{2}$
• Sep 27th 2009, 09:11 AM
garymarkhov
Quote:

Originally Posted by galactus
It is better to maximize $x^{2}+y^{2}$ because there is no radical. Remember, the distance and the square of the distance have their max and min at the same point. Therefore, no need to differentiate the radical. Just differentiate $L=x^{2}+y^{2}$

That's a really super idea. Good insight.

So my solution is x=1.816, y=-1.816 and it looks roughly correct on a graph. Think it's right?
• Sep 27th 2009, 09:36 AM
galactus
Yeah, that looks good.
• Sep 27th 2009, 10:22 AM
garymarkhov
Quote:

Originally Posted by galactus
Yeah, that looks good.

Thanks for your fast responses and great help!