Farther and nearest points from an ellipse to the a line segment.

83 Views Asked by At

I really need your help in math, I've solved this problem in several ways, but I'm not getting anywhere...

Given a straight line $x-3y-9=0$ and an ellipse $x^2/9 +y^2/4 = 1$, find the nearest and farthest points. As I understand it, the problem that I presented to you above can be solved using the Lagrange method (conditional extremes). However, the teacher did not like this option and she said that it was wrong, although the answer from the textbook is the same as mine.

I was told that I need to find the the farthest and closest distance using this $(x-X)^2+(y-Y)^2$, find derivatives, solve the system and find the determinants. I decided, but I didn't get an answer. Is it possible to solve it this way? If so, how? If not, how else is it possible? This is the progress of solving the task from my teacher.

herway

I will be very grateful if you can help me!

2

There are 2 best solutions below

0
On

Another method that is closer to what your teacher wants is as follows.

Let $(x,y)$ be on the line, then

$x - 3 y - 9 = 0 \tag{1} $

And let $(X, Y)$ be on the ellipse, then

$ \dfrac{X^2}{9} + \dfrac{Y^2}{4} = 1 \tag{2}$

The distance squared between $(x,y)$ and $(X, Y)$ is

$ f(x,y, X, Y) = (x - X)^2 + (y - Y)^2 \tag{3}$

Define the vector $V = (x, y, X, Y) $, then

$ f(V) = V^T A V \tag{4}$

where

$ A = \begin{bmatrix} 1 && 0 && -1 && 0 \\ 0 && 1 && 0 && -1 \\ -1 && 0 && 1 && 0 \\ 0 && -1 && 0 && 1 \end{bmatrix} \tag{5}$

Now define the Lagrange function as follows

$ g(V) = f(V) + \lambda_1 L(V) + \lambda_2 Q(V) \tag{6}$

where

$L(V) = a^T V + b \tag{7}$

with

$ a = \begin{bmatrix} 1 \\ -3 \\ 0 \\ 0 \end{bmatrix} \tag{8}$

and

$ b = -9 \tag{9} $

And,

$Q(V) = V^T B V - 1 \tag{10} $

where

$ B = \begin{bmatrix} 0 && 0 && 0 && 0 \\ 0 && 0 && 0 && 0 \\ 0 && 0 && \dfrac{1}{9} && 0 \\ 0 && 0 && 0 && \dfrac{1}{4} \end{bmatrix} \tag{11} $

The gradient vector of $g(V)$ is

$ \nabla_V g = 2 A V + \lambda_1 a + 2 \lambda_2 B V = \mathbf{0} \tag{12}$

In addition, we have

$ \nabla_{\lambda_1} g = a^T V + b = 0 \tag{13}$

And

$ \nabla_{\lambda_2} g = V^T B V - 1 = 0 \tag{14}$

Note that $A$ is not invertible. Define $u_1 = [1, 0, 1, 0]^T$ and $u_2 = [0,1,0,1]^T$ Then

$ u_1^T A = \mathbf{0} $ and $u_2^T A = \mathbf{0} $

Therefore, pre-multiplying $(12)$ by $u_1^T$ and $u_2^T$ gives us the following two equations:

$ \lambda_1 + \lambda_2 [0, 0, \dfrac{1}{9}, 0 ] V = 0 \tag{15} $

$ -3 \lambda_1 + \lambda_2 [ 0, 0, 0, \frac{1}{4} ] V = 0 \tag{16}$

Furthermore, if we pre-multiply equation $(12)$ by $e_1^T = [1, 0, 0, 0]$, we would get

$ 2 [1, 0, -1, 0] V + \lambda_1 = 0 \tag{17}$

And pre-multiplying $(12)$ by $e_2^T = [0, 1, 0, 0]$, we would get

$ 2 [0, 1, 0, -1] V - 3 \lambda_1 = 0 \tag{18}$

Combining $(15)-(16)$ by eliminating $\lambda_1$ and using the fact that $\lambda_2 \ne 0 $, we get

$ [ 0 , 0, \dfrac{1}{3}, \dfrac{1}{4} ] V = 0 \tag{19} $

Similarly, eliminating $\lambda_1$ from equations $(17)-(18)$, gives us

$ [3, 1, -3, -1] V = 0 \tag{20} $

So now we have the following system of equations, repeated below for clarity

$ a^T V + b = 0 \tag{21}$

$ [ 0 , 0, \dfrac{1}{3}, \dfrac{1}{4} ] V = 0 \tag{22} $

$ [3, 1, -3, -1] V = 0 \tag{23} $

$ V^T B V - 1 = 0 \tag{24}$

Which is a system of $4$ equations, three of which are linear and $1$ nonlinear (quadratic), in the four unknown entries of $V$.

Equations $(21)-(22)-(23)$ give us the following linear system

$\begin{bmatrix} 1 && - 3 && 0 && 0 \\ 0 && 0 && 4 && 3 \\ 3 && 1 && -3 && -1 \end{bmatrix} \begin{bmatrix} x \\ y \\ X \\ Y \end{bmatrix} = \begin{bmatrix} 9 \\ 0 \\ 0 \end{bmatrix} \tag{25}$

Its solution is

$ V = \begin{bmatrix} x \\ y \\ X \\ Y \end{bmatrix} = \begin{bmatrix} 0.9 \\ -2.7 \\ 0 \\ 0 \end{bmatrix} + t \begin{bmatrix} - 3 \\ - 1 \\ - 6 \\ 8 \end{bmatrix}\tag{26} $

To determine the parameter $t$, we substitute solution $(26)$ into the quadratic equation $(24)$.

Let $u = [0.9, -2.7, 0, 0]^T $ and $v = [-3, -1, -6, 8] $

Then

$(u + t v)^T B (u + t v) - 1 = 0 \tag{27}$

So that

$ (v^T B v) \ t^2 + 2 (u^T B v) \ t + (u^T B u - 1) = 0 $

This can be solved for $t$, using the quadratic formula, the results are,

$ t_1 = - 0.223606798 $ and $ t_2 = 0.223606798 $

Substituting these in $(26)$ gives two sets of corresponding coordinates $V$ that correspond to the minimum distance and the maximum distance.

For $t_1$ we have

$ V_1 = \begin{bmatrix} 1.570820393 \\ -2.476393202 \\ 1.341640786 \\ -1.788854382 \end{bmatrix} $

And for $t_2$ we have

$ V_2 = \begin{bmatrix} 0.229179607 \\ -2.923606798 \\ -1.341640786 \\ 1.788854382 \end{bmatrix} $

The value of the squared distance function is given by equation $(3)$, so that

$f(V_1) = 0.525232922 $

$ f(V_2) = 24.67476708 $

So $V_1$ corresponds to the minimum distance, and $V_2$ corresponds to the maximum distance.

The ellipse and the line, together with the location of the minimum and maximum distances are shown below

enter image description here

3
On

This is probably the the most direct solution out of the three solutions that I've posted to this question.

It is based on the fact that at the minimum distance and at the maximum distance, the gradient vector (the normal vector to the ellipse) is along the normal vector to the given line. This is because the line segment connecting the two curves must be perpendicular to both.

The normal vector to the line is $ n = [1, -3]^T $

And the gradient vector to the ellipse is along

$ g = Q r \tag{1} $

where $r = [X, Y]^T$ is on the ellipse, and $ Q = \begin{bmatrix} \dfrac{1}{9} && 0 \\ 0 && \dfrac{1}{4} \end{bmatrix} $

Thus, we want

$ Q r = k n \tag{2}$

From which,

$ r = k Q^{-1} n \tag{3}$

Substituting this into the ellipse equation, which is

$ r^T Q r = 1 \tag{4}$

we get two values for $k$

$ k_1 = \dfrac{1}{\sqrt{ n^T Q^{-1} n } } $ and $ k_2 =-\dfrac{1}{\sqrt{ n^T Q^{-1} n } } $

So that, the two points on the ellipse corresponding to the minimum and maximum (not particularly in this order) are

$ r_1 = k_1 Q^{-1} n $

and

$ r_2 = k_2 Q^{-1} n $

Now $Q^{-1} = \begin{bmatrix} 9 && 0 \\ 0 && 4 \end{bmatrix} $

So

$ Q^{-1} n = \begin{bmatrix} 9 \\ -12 \end{bmatrix} $

And

$ n^T Q^{-1} n = 45 $

So

$ k_1 = \dfrac{1}{3 \sqrt{5}} $ and $k_2 = - \dfrac{1}{3 \sqrt{5}} $

Therefore,

$r_1 = \dfrac{1}{\sqrt{5}} \begin{bmatrix} 3 \\ - 4 \end{bmatrix}= \begin{bmatrix} 1.3416407865 \\ -1.788854382 \end{bmatrix} $

And

$ r_2 = - \dfrac{1}{\sqrt{5}} \begin{bmatrix} 3 \\ - 4 \end{bmatrix} = \begin{bmatrix} -1.3416407865 \\ 1.788854382 \end{bmatrix} $

Now we want to find the corresponding points on the line, so we set up a line from $r_1 $ and from $r_2$ that runs along $n$ (the normal vector to the line)

The parametric equation of the first line is

$ \ell_1 = r_1 + t n $ and of the second line is $ \ell_2 = r_2 + t n $

Intersect $ \ell_1 $ with our line which is $n^T r - 9 = 0$

This will give us,

$ n^T ( r_1 + t n ) - 9 = 0 $

So that

$ t_1 = \dfrac{ 9 - n^T r_1 }{ n^T n } = \dfrac{ 9 - \dfrac{1}{\sqrt{5}} (15) }{10} = 0.22917960675 $

And similarly

$ t_2 = \dfrac{ 9 - n^T r_2 }{n^T n } = \dfrac{ 9 + \dfrac{1}{\sqrt{5}} (15) }{10} = 1.57082039325 $

Therefore $r_1$ corresponds to the minimum distance and $r_2$ to the maximum distance.

The minimum distance is

$ d_1 = t_1 \| n \| = 0.22917960675 \sqrt{10} = 0.72472955059 $

Note that $d_1^2 = 0.5252329215 $ as obtained in the other solutions.

And the maximum distance is

$ d_2 = t_2 \| n \| = 1.57082039325 \sqrt{10} = 4.96737023771 $

Note that $d_2^2 = 24.6747670785 $ as obtained in the other solutions.

The coordinates (x,y) of the points on the line corresponding to the minimum and maximum distance are as follows: First, for the minimum

$ p_1 = r_1 + t_1 n = \begin{bmatrix} 1.3416407865 \\ -1.788854382 \end{bmatrix} + 0.22917960675 \begin{bmatrix} 1 \\ -3 \end{bmatrix} = \begin{bmatrix} 1.57082039325 \\ -2.47639320225 \end{bmatrix} $

Second, for the maximum

$ p_2 = r_2 + t_2 n = \begin{bmatrix} -1.3416407865 \\ 1.788854382 \end{bmatrix} + 1.57082039325 \begin{bmatrix} 1 \\ -3 \end{bmatrix} = \begin{bmatrix} 0.22917960675 \\ -2.92360679775 \end{bmatrix} $

The ellipse and the line together with the maximum distance and shortest distance are shown below

enter image description here