Finding the shortest distance between an arbitrary point and a parabola I'm attempting to find the shortest distance between a point and a parabola. The point in question is (0,b), for any b, and the parabola that we are given is$\ y = x^2 $.
How would you approach the problem and find the shortest distance for any given b?
What about if the point was (0,0,b), and the equation was $\ z = x^2 + y^2$?
 A: We seek $x\in\Bbb{R}$ to minimize the distance between $(0,b)$ and $(x,x^{2})$. This amounts to minimizing the value of $$\sqrt{(x-0)^{2}+(x^{2}-b)^{2}},$$ and this gives the same value as the problem of minimizing $$x^{2}+(x^{2}-b)^{2}.$$ To do this, we set the derivative equal to zero and solve:
\begin{eqnarray*}
2x + 4x(x^{2}-b) & = & 0,\\
\implies 2x[2x^{2}-2b+1]=0,\\
\implies x=0\:\text{ or }\:x^{2}=b-\tfrac{1}{2}.
\end{eqnarray*}
Of course, the latter is only valid for $b\geq 1/2$.
Therefore if $b<1/2$, then the minimum distance is $\sqrt{0+(0-b)^{2}}=|b|$. If $b\geq 1/2$, then the minimum distance is either $|b|$ or is $\sqrt{b-\tfrac{1}{4}}$, whichever is smaller, which by inspection is the latter.
As a check, note that $\lim_{b\to1/2^{-}}|b| = 1/2 = \lim_{b\to1/2^{+}}\sqrt{b-\frac{1}{4}}$, which satisfies our intuitions.
It is worth asking what the relevance is of the solution $x=0$ in the case $b\geq1/2$. Some thought (and perhaps a good diagram) shows that $x=0$ in fact gives a local maximum for the distance.
In $\mathbb{R}^{3}$, when we have $z=x^{2}+y^{2}$ and $(0,0,b)$, we can reduce the problem to the two dimensional one due to the rotational symmetry of the paraboloid and the fact that the point $(0,0,b)$ lies on the axis of symmetry. The major difference between the two situations is that instead of two points giving the same minimum distance ($x=\pm\sqrt{b-\frac{1}{2}}$ above), we instead have infinitely many (in fact, the points of minimum distance will form a circle, the intersection between some cone with vertex at $(0,0,b)$ and the paraboloid $z=x^{2}+y^{2}$).
A: Let the point on the parabola be $(x,x^2)$, so that the distance to the point is
$$d^2(x)=x^2+(b-x^2)^2.$$
To find the minimum value of this expression, derive on $x$ and equate to zero:
$$2x-4x(b-x^2)=0.$$
The possible solutions are $$x=0\lor x=\pm\sqrt{\frac12-b}.$$
The corresponding values of the distance are
$$b^2\text{ or }\frac12-b+(b-\frac12+b)^2.$$
You should be able to finalize the discussion.
A: 2D
We consider the distance between a query point $Q=(0,b)$ and some point $P(x) = (x, x^2)$ on the graph of the function. 
This leads to
$$
d(x) = d(Q, P(x)) = \sqrt{x^2 + (x^2 - b)^2}
$$
The distance to the graph is the minimum of those distances:
\begin{align}
d &= \min_{x \in \mathbb{R}} d(x) \\
  &= \min_{x \in \mathbb{R}} \lVert (x, x^2)) - (0,b)\rVert
\end{align}
So we look for local extrema via
$$
0 
= d'(x) 
= \frac{2x + 2(x^2 -b)\,2x}{2\sqrt{x^2 + (x^2 - b)^2}}
= \frac{2x^3+(1-2b)x}{\sqrt{x^2 + (x^2 - b)^2}}
$$
which happens for $x = 0$ or
$$
2x^2 = 2b - 1 \iff \\
x = \pm\sqrt{b - 1/2}
$$
which has real solutions for $b \ge 1/2$. The resulting distance for both of these solutions is 
$$
d 
= \sqrt{b - 1/2 + (b - 1/2 - b)^2} 
= \sqrt{b-1/4} 
= \sqrt{4b - 1 }/2
$$
while the distance for $x=0$ is between $(0,0)$ and $(0,b)$ thus $\lvert b \rvert$.
So the minimum distance is
$$
d = 
\begin{cases}
\min(\lvert b \rvert, \sqrt{4b - 1}/2 & \text{for } b > 1/2 \\
\lvert b \rvert  & \text{for } b \le 1/2
\end{cases} 
$$

(Large version)
3D
The above generalizes to three dimensions. Query point is $(0,0,b)$ and the points on the graph are $P(x,y) = (x, y, x^2 + y^2)$.
This leads to
$$
d(x,y) = d(Q, P(x,y)) = \sqrt{x^2 + y^2 + (x^2 + y^2 - b)^2}
$$
For local minima we look where the gradient vanishes:
\begin{align}
0 = \text{grad } d(x, y) 
&= \frac{1}{2\sqrt{x^2 + y^2 + (x^2 + y^2 - b)^2}}
(2x + 2(x^2 + y^2 - b)2x, 2y + 2(x^2 + y^2 - b)2y) \\
&= \frac{1}{\sqrt{x^2 + y^2 + (x^2 + y^2 - b)^2}}
(2x(x^2 + y^2) + (1-2b)x, 2y(x^2+y^2) + (1-2b)y)
\end{align}
This is the case for $(x,y) = (0,0)$ otherwise if
$$
2(x^2 + y^2) = 2b - 1 \iff \\
x^2 + y^2 = r^2 \wedge r = \sqrt{b - 1/2}
$$
which has real solutions for $b \ge 1/2$. The resulting distance for solutions on this circle in the $x$-$y$-plane with radius $r$ is:
$$
d = \sqrt{b - 1/2 + (b - 1/2 - b)^2} = \sqrt{4b-1}/2
$$
while the distance for $(x,y)=(0,0)$ is between $(0,0,0)$ and $(0,0,b)$ thus $\lvert b \rvert$.
So the minimum distance is again
$$
d = 
\begin{cases}
\min(\lvert b \rvert, \sqrt{4b - 1}/2 & \text{for } b > 1/2 \\
\lvert b \rvert  & \text{for } b \le 1/2
\end{cases} 
$$
A: Or, we can use a bit of geometry and say that the line of the shortest distance will be a normal from the point (0,b) to the parabola.
So, we take any arbitrary point (t,$t^2$) on the parabola and then find the slope of the normal at it,
Slope = -$dx/dy$ = -(1/2t).
Write the equation of the normal as
y-$t^2$=(-1/2t)(x-t).
This must pass through (0,b).
Satisfy the point in the equation to get,
t= $\sqrt {b-1/2}$
Now, the point on the parabola is-
($\sqrt{b-1/2}$, (b-1/2)).
Use the distance formula to get the shortest distance as $\sqrt{b-1/4}$
