<s>[INST] How do you find the shortest distance from the point $\left(-1,7\right)$ to a given $\mbox{curve}\ ?$ I find this difficult to solve. It involves maxima and minima of differential calculus.
Since it's requiring the shortest distance, I have to find $y'$ and set it to zero.
Here's how I did it, but I still can't seem to find the correct answer.
$$
9x^2+25y^2-18x+100y-116=0\quad \mbox{is the given curve.}
$$
I resolved it into an equation of an ellipse,

*

*Completing the square
$$
9x^2-18x  + 25y^2+100y    = 116
$$
$$
9(x^2-2x+1) + 25(y^2+4y+4) = 116+9+100
$$


*Equation of ellipse:
$$\tag{1}
\frac{(x-1)^2}{25} + \frac{(y+2)^2}{9} = 1
$$


*I used the distance formula between two points
$$\tag{2}
d = \sqrt{(x+1)^2 + (y-7)^2}
$$
Let $x$ be $\sqrt{(225-25(y+2)^2) / 9)} + 1 $ from the curve equation


*I input $x$ into the distance formula, and this is the result.
$$
d = \sqrt{(-\frac{16}{9}y^2 -\frac{226}{9}y + \frac{602}{9} + \frac{20}{3} \sqrt{-y^2 -4y+5} }
$$
I find its derivative so it will be equal to zero to be the shortest distance to the curve.
The derivative is $\frac {-32}{9}y -\frac {226}{9} + [\frac {\frac {20}{3}(\frac 12)(-2y-4)}{ \sqrt(-y^2-4y+5)}]$
Equating the derivative of the curve equation to zero,
$$y = 0.921$$
$$x = 2.14$$
Input the values into distance formula,
$d = 6.84$ units
The correct answer is $6.14$ units.
Where could the error be? Please guide me.
 [/INST] The ellipse equation is
$ Q_1(x,y) = 9 x^2 + 25 y^2 - 18 x + 100 y -116 = 0 $
The objective function (to be minimized) is the square of the distance between $(x,y)$ and $(-1, 7)$
$ f(x,y) = Q_2(x,y) = (x + 1)^2 + (y - 7)^2 $
So this is a quadratic optimization subject to a quadratic constraint problem.
Using Lagrange multiplier method, the objective function is modified to include the constraint, as follows
$ g(x,y) = Q_2(x,y) + \lambda Q_1(x,y) $
Differentiating $g(x,y)$ with respect to $x, y, \lambda$ gives us
$ g_x = Q_{2x} + \lambda Q_{1x} = 0 $
$ g_y = Q_{2y} + \lambda Q_{1y} = 0 $
$ g_{\lambda} = Q_1 $
Eliminating $\lambda$ from the first two equations results in
$ Q_{2x} Q_{1y} - Q_{2y} Q_{1x} = 0 \hspace{30pt}(1)$
and, in addition, from the third equation, we have,
$ Q_1 = 0 \hspace{30pt} (2)$
Equations $(1), (2)$ are as follows for this particular problem
$ 2 (x + 1) (50 y + 100) - 2 (y - 7) (18 x - 18) = 0 $
which simplifies to
$ (x + 1)(25 y + 50) - (y - 7) (9 x - 9) = 0 \hspace{30pt}(3) $, and
$ 9 x^2 + 25 y^2 - 18 x + 100 y -116 = 0 \hspace{30pt}(4)$
Feeding these equations to wolframalpha.com gives the following two solutions
$ (x,y) = (-0.143256,  0.920525) $
and
$ (x,y) = (3.90826, -4.44032) $
The distances associated with these two points are
$ d_1 = \sqrt{ (-0.143256 + 1 )^2 + (0.920525 - 7)^2 } = 6.139546 $
$ d_2 = \sqrt{ (3.90826 + 1 )^2 + (-4.44032 - 7)^2 } = 12.44877$
So the first pair is the point on the ellipse that is closest to $(-1,7)$ while the second point is the farthest.
</s>