Finding Minimum Distance of a Point from Curve While finding the distance of a point from a curve (which is graph of a function), the usual method I saw is as follows: given a point and a curve $\{x,f(x)\}\colon c\in\mathbb{R}$ (where $f\colon\mathbb{R}\rightarrow \mathbb{R}$ is a function), the distance of $(x,f(x))$ from $(a,b)$ is $D(x)=\sqrt{(x-a)^2+(f(x)-b)^2}$. To obtain the shortest distance of $(a,b)$ from the curve, we solve $D'(x)=0$ for $x$ (and mostly we have onlyfinitely many solutions) and for these $x$, we compute distances of $(x,f(x))$ to $(a,b)$ and find the minimum.
I would like to see the theory behind the process "solving $D'(x)=0$, ...", since I couldn't notice why $D$ is differentiable?, and if it is differentiable, why $D'(x)$ should be taken zero to obtain closest point? Of course, there would be certain assumptions about differentiability of $f$, but I didn't find such Theory in most common calculus and analysis texts. 
Please suggest the references in which these questions are tackled 'theoretically'.
 A: The fundamental idea in problems of maximizing and minimizing is that at a peak of the graph of a function, or at the bottom of a trough, the tangent is horizontal. That is, the derivative $f′(x_i)$ is $0$ at points $x_i$ at which $f(x_i)$ is a maximum or a minimum. In finding the shortest distance, they usually assume the distance function to be monotonically increasing and instead of the square root distance, the squared function $D^2(x)$ is minimized. 
This method obviously has its own limitations like differentiability and the problem of local minimum/maximum in non-linear functions. This is the most widespread method of finding solution to optimization problem e.g. Newton's method.
These problems are mostly solved numerically and hence most optimization books are good references, like Numerical Optimization, by Nocedal & Wright.
A: Your question is not specific to the frame of a distance computation. You are in fact just trying to find the global minimum of some function.
Theory tells you that for a continuous function, this minimum occurs either at a stationary point, or at an endpoint of the domain. If the function has discontinuities, you also consider the values at these discontinuities.
A: As far as I know, there isn't much of a theory, except that the infinitesimal shift in the dependent variable causes nearly zero change.
To minimize any function of multiple variables we write $df=0.$ However, a minimum value locally is when the tangent line/plane becomes flat, because there is no rate of change: they are literally the largest or smallest values of $f$ in their locality, (in other words they are minimized or maximized,) which can be visualized graphically as a hill or a valley point; in higher dimensions this extends to add saddle points and other numerous variations.
So when we want to minimize distance from a curve to a point, or a curve to another curve, we want to minimize the distance function. Lets say we want to minimize the distance between $p(t),q(t')$, in other words to find the values of $t,t'$ that represent the closest points to each other on either curve, or that the line segment of shortest distance between any one point and another on either curve: we take
$$d|p-q|=0,\\\frac{\partial}{\partial t}|p-q|=0,\frac{\partial}{\partial t'}|p-q|=0.$$
The second understanding is that if we have a function $f(x)$, that $f(x+dx)$ and $f(x-dx)$ are only infinitesimally larger or smaller. In other words, $f\approx f(x+dx)=f+f'dx,$ or $f'=0.$ I've illustrated this case here:

and similarly for the maximum case. More practically, that $f(x-dx)=f(x)=f(x+dx),$ which also implies $f'=0.$
