Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

An ellipse is specified $ x^2 + 4y^2 = 4$, and a line is specified $x + y = 4$. I need to find the max/min distances from the ellipse to the line.

My idea is to find two points $(x_1, y_1)$ and $(x_2,y_2)$ such that the first point is on the ellipse and the second point is on the line. Furthermore, the line segment formed by these two points should be perpendicular to the line (slope = 1). This gives 3 constraints $g_i$ and an objective $f$.

$$ g_1: x_1 ^2 + 4y_1 ^2 - 4 = 0$$ $$ g_2: x_2 + y_2 - 4= 0 $$ $$ g_3:\frac{(y_2 - y_1)}{(x_2 - x_1)} - 1 = 0 $$ $$ f: (y_2 - y_1)^2 + (x_2- x_1)^2 $$

Then I compute $\nabla g_i$ and $\nabla f$:

$$ \nabla g_1 = (2x_1, 8y_1, 0, 0) $$ $$ \nabla g_2 = (0, 0, 1, 1)$$ $$ \nabla g_3 = ( (y_2 - y_1)(x_2 - x_1)^{-2}, -(x_2 - x_1)^{-1}, -(y_2 - y_1)(x_2 - x_1)^{-2}, (x_2 - x_1)^{-1} )$$ $$ \nabla f = (-2(x_2-x_1), -2(y_2-y_1), 2(x_2-x_1), 2(y_2 - y_1))$$

At this point I try to solve $\nabla f = \sum\lambda_i\nabla g_i$, which, together with the constraints, gives me 7 equations with 7 variables. I'm not sure how to solve this system.

$$\lambda_1 2 x_1 + \lambda_3(y_2-y_1)(x_2-x_1)^{-2} = -2(x_2-x_1)$$ $$\lambda_1 8 y_1 - \lambda_3 (x_2 - x_1)^{-1} = -2 (y_2 - y_1)$$ $$\lambda_2 - \lambda_3 (y_2 - y_1)(x_2 - x_1)^{-2} = 2(x_2 - x1)$$ $$\lambda_2 + \lambda_3 (x_2 - x_1)^{-1} = 2(y_2 -y_1)$$

Is there an easy way to see the solutions of this system in $x_1, y_1, x_2, y_2$? If not, is there an easier formulation of this optimization problem?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

The ellipse is

$$x^2+4y^2=4\iff \frac{x^2}{2^2}+y^2=1$$

and the line is $\,y=-x+4\,$ , which is then "above" the ellipse all the time and, in particular, in the first quadrant (draw an approximate sketck of the functions to see why is this relevant).

Thus, we can write down a point on the ellipse in the first quadrant as

$$\left(x\,,\,\frac{1}{2}\sqrt{4-x^2}\right)\;,\;\;x\ge 0$$

so using the formula for the distance between a point as above and the line $\,x+y-4=0\,$ we get

$$\frac{\left|\;x+\frac{1}{2}\sqrt{4-x^2}-4\;\right|}{\sqrt2}=\frac{\left|\;2x+\sqrt{4-x^2}-8\;\right|}{2\sqrt2}$$

But since the expression with the absolute value is always negative (in $\,0\le x\le 2\,$ , that is)(why?) , we must get the minimum of:

$$f(x)=\frac{-2x-\sqrt{4-x^2}+8}{2\sqrt 2}\implies f'(x)=\frac{-2+\frac{x}{\sqrt{4-x^2}}}{2\sqrt 2}=0\iff$$

$$-2\sqrt{4-x^2}+x=0\iff x^2=16-4x^2\iff x=\frac{4}{\sqrt 5}$$

Check the above indeed is a minimum point and input in the resp. equation...

Of course, the maximal distance is...

share|improve this answer
    
To find the maximal distance I would repeat your procedure but with the ellipse portion in the fourth quadrant. I think this leads to the same quadratic equation in the end, but since we have to find x negative, we must choose the other root of the equation. –  Mark Apr 17 '13 at 17:08
    
@Mark, the maximum distance is infinite: the ellipse is a closed, simple curve and thus bounded, whereas the straight line is an unbounded curve... –  DonAntonio Apr 17 '13 at 18:31
add comment

much easier. if your line and ellipse intersect, the minimum distance is zero. if not, it occurs on a line segment that is orthogonal to both your line and to the ellipse. which is not hard to find. there should be two such line segments, one gives the actual min, one gives a local max...draw some graphs! also, no max, there are points on the line arbitrarily far away from your ellipse.

share|improve this answer
    
Sorry I should have been more clear, the notion of distance here is perpendicular distance. So there is a unique distance from each point to a line. –  Mark Apr 16 '13 at 22:43
    
@Mark, my way includes that restriction... –  Will Jagy Apr 17 '13 at 3:00
    
@Mark, put another way: solve this problem any way you like. If you get it right, the minimum is at some point $P$ on the line, and some point $Q$ on the ellipse. If you then draw the line between $P$ and $Q,$ it will be perpendicular to the original line and to the ellipse (at the point of intersection). –  Will Jagy Apr 17 '13 at 3:33
    
In other words, to find the minimum distance, my $g_3$ constraint is redundant. However, to find the max distance I would still need to keep that constraint. –  Mark Apr 17 '13 at 16:33
1  
The word "height" might be best, height over the fixed line. –  Will Jagy Apr 17 '13 at 18:29
show 1 more comment

We can solve without using Lagrange Multiplier Method

We have $$\frac{x^2}4+\frac{y^2}1=1$$

So, any point$(P)$ on the ellipse can be represented as $(2\cos t,\sin t)$

SO, the distance from the line : $x+y-4=0$ from $P(2\cos t,\sin t)$

is $$\frac{|2\cos t+\sin t-4|}{\sqrt{1^2+1^2}}=\frac{\left|\sqrt5\cos\left(t-\arccos \frac2{\sqrt5}\right)-4\right|}{\sqrt2}$$ putting $2=r\cos A,1=r\sin A$ where $r>0$

Squaring and adding we get $R^2=5\implies r=\sqrt 5, A=\arccos \frac2r=\arccos \frac2{\sqrt5}$

As $-1\le \cos\left(t-\arccos \frac2{\sqrt5}\right)\le1, $

clearly, this will be maximum if $\cos\left(t-\arccos \frac2{\sqrt5}\right)=-1$ and minimum if $\cos\left(t-\arccos \frac2{\sqrt5}\right)=1$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.