closest point to on $y=1/x$ to a given point I feel like I'm missing something basic - given a point $(a,b)$ how do I find the closest point to it on the curve $y=1/x$? I tried the direct approach of pluggin in $y=1/x$ into the distance formula but it leads to an order-4 polynomial...
I tried the direct approach of pluggin in y=1/x into the distance formula but it leads to an order-4 polynomial...


That is not a mistake. The ellipse has two maxima and two minima of the distance to $P$ for most locations of point $P$.  This leads to a degree $4$ polynomial when solving for the coordinates of the extrema.  There is no special geometric relationship between the distance extrema that might make the polynomial easier to solve than the general quartic equation.
The slope of $y = 1/x$ at $x$ is $-1/x^2$,
so the tangent at $(p, 1/p)$ is
$(y-1/p)/(x-p) = -1/p^2$
or $y = 1/p - (x-p)/p^2$.
At $y = 0$, $(x-p)/p^2 = 1/p$
or $x = 2p$;
at $x = 0$, $y = 1/p + p/p^2 = 2/p$.
The intercept points are thus
$(0, 2/p)$ and $(2p, 0)$.

I will minimize the distance by making
the line from $(a, b)$ to
$(p, 1/p)$ perpendicular to this tangent
at $(p, 1/p)$
and do this by making their
dot product zero.

The dot product of the vector
from $(a, b)$ to $(p, 1/p)$
with the tangent is

$\begin{align}
(p-a, 1/p-b)\cdot (2p, -2/p)
&amp;= 2p(p-a) - 2/p^2+2b/p \\
&amp;= (2p^3(p-a) - 2 + 2pb)/p^2 \\
&amp;= (2p^4 - 2ap^3 + 2bp-2)/p^2 \\
&amp;= 2(p^4 - ap^3 + bp-1)/p^2
\end{align}
$

and this is zero when
$f(p; a, b) = p^4 - ap^3 + bp-1 = 0$.

I will consider the special case $a = b$
to check this;
there should be a root at $p = 1$.

If $a = b$,

$\begin{align}
f(p; a, a) &amp;= p^4 - ap^3 + ap-1 \\
&amp;= (p^4-1) - a(p^3-1) \\
&amp;= (p-1)(p^3+p^2+p^1 - a(p^2+p+1)) \\
&amp;= (p-1)(p^3 + (1-a)(p^2+p+1))
\end{align}
$

which has a root at $p = 1$
(as expected) and,
if $a &gt; 1$
(so $(a, a)$ is to the right and above the hyperbola),
 another positive real root
since $p^3 + (1-a)(p^2+p+1) &lt; 0$
for small $p$
and $p^3 + (1-a)(p^2+p+1) &gt; 0$
for large $p$.

If $a &lt; 1$,
so $(a, a)$ is between the hyperbola and the origin,
there are no other positive real roots
since $p^3 + (1-a)(p^2+p+1) &gt; 0$
for all $p \ge 0$.

I could argue further about
where the real roots
of $f(p; a, b)$
are using
$f(1/p; a, b) = (1/p)^4 - a(1/p)^3 + b/p-1
= (1 - ap + bp^3 - p^4)/p^4
= -f(p; b, a)/p^4
$
so the roots of
$f(1/p, a, b)$ are the same as the roots of
$f(p; b, a)$,
but that's enough for now for me.

In general, I find it much easier
algebraically to make two vectors
orthogonal by making their dot product zero
than minimizing their distance
using the Pythagorean theorem.