Find the closest point on $y=\frac{1}{e}x+e^2+1$ to the curve $y=\ln(x)$ I`m trying to find the closest point on 
$$y=\frac{1}{e}x+e^2+1$$
to the curve $$y=\ln(x)$$
what I tried is to make $\frac{d}{dx}$ to both of them like :
$$ \frac{1}{x} =  \frac{1}{e} \rightarrow x=e$$
so I insert $x=e$ in $y=\frac{1}{e}x+e^2+1$ and found the point $(e,e^2+2)$
and I want to know if its the right way to do that.
Thanks!
 A: An idea: you want the closest point of the form $\,(x\,,\,\log x)\;$ to the line $\frac1ex-y+e^2+1=0\;$ ,  distance given by the well known formula from anaytic geometry:
$$\frac{|\frac1ex-\log x+e^2+1|}{\sqrt{\frac1{e^2}+1}}=\frac{|x-e\log x+e^3+e|}{\sqrt{e^2+1}}$$
Now you want to minimize the above, which is the same as minimizing the numerator, so differentiating (check the signs of the following according to the sign inside the absolute value!):
$$\pm\left(1-\frac ex\right)=0\iff x=e\;,\;\text{ and the wanted point is}\;\;(e\,,\,e^2+2)$$
and thus the minimal distance is
$$\frac{e-e\log e+e^3+e}{\sqrt{e^2+1}}=e\sqrt{e^2+1}$$
Now, this is the same you got, yet I think your method won't work in the general case: what you did here is "to ask" (find out) where does the curve $\;y=\log x\;$ have tangent line with slope equal to the straight line's, which has constant slope equal to $\;\frac1e\;$ . This is, imo., pretty clear intuitively since then the corresponding points on both curve will be as close as possible, yet if one of the curves is not a straight line (or even worse: if not both functions are differentiable) this may not work. I'm lacking some geometric depth so perhaps someone else can complete/check all this.
A: Suppose we are given two differentiable functions $f,g:\mathbb{R}\to\mathbb{R}$, and we want to find $x,y$ such that the distance $$\Vert(x,f(x))-(y,g(y))\Vert$$ "between the curves" is minimized. Assume that there is such a minimum, and that it is attained for $x=x^*$ and $y=y^*$. Define \begin{align}
h(x,y) &= \Vert(x,f(x))-(y,g(y))\Vert^2 \\
&= (x-y)^2+(f(x)-g(y))^2 \\
&= x^2-2xy+y^2+f(x)^2-2f(x)g(y)+g(y)^2.
\end{align} Then $h$ has a global minimum at $(x^*,y^*)$, so $Dh(x^*,y^*)=0$. We compute $$Dh(x,y)=2\begin{bmatrix}x-y+f'(x)(f(x)-g(y)) & y-x+g'(y)(g(y)-f(x))\end{bmatrix},$$ so $$f'(x^*)=-\left(\frac{g(y^*)-f(x^*)}{y^*-x^*}\right)^{-1}=g'(y^*),$$ assuming that the quantities exist. Notice that the expression in the brackets is the slope of the line joining $(x^*,f(x^*))$ and $(y^*,g(y^*))$. Geometrically, this line is normal to both curves. (Using this observation along with symmetry would have shortened the above argument.)
So yes, your method is correct.
A: If you are trying to find the minimum vertical distance, then your method is correct, but your answer is not.  However, you do not seem to have a firm grip on the problem.  You seem to be hand waving a bit, so let's do this with no handwaving.
Recall that the distance between two points $(x_0,y_0)$ and $(x_1, y_1)$ is given by the Pythagorean Theorem:
$$\| (x_0,y_0) - (x_1,y_1)\| = \sqrt{(x_1 - x_0)^2 + (y_1 - y_0)^2}$$
Assuming you want to find the minimum vertical distance, then you want to find the minimum value of 
$$
f(x) = \| (x, x/e + e^2 + 1) - (x, \ln x)\| = \sqrt{ \left(\frac{x}{e} + e^2 + 1 - \ln x\right)^2 }
= \left| \frac{x}{e} + e^2 +1 - \ln x \right|
$$
Note that $\frac{x}{e} + e^2 + 1 - \ln x > 0$ on $x > 0$ so that $f(x) = \frac{x}{e} + e^2 + 1 - \ln x$.  Then, $f'(x) = \frac{1}{e} - \frac{1}{x}$, and so the minimum value occurs at $f(e) = \frac{e}{e} + e^2 + 1 - \ln(e)$.

By the way, to show that $\frac{x}{e} + e^2 + 1 - \ln x > 0$, we could define $g(x) = \frac{x}{e} + e^2 + 1 - \ln x$ and take derivatives.  We get $g'(x) = \frac{1}{x} - \frac{1}{e}$ so that $g$ has a critical point at $x = e$ (the value $x = 0$ is not a critical point as the function is undefined there).  Note that $f'(x) < 0$ when $0 < x < e$ and $f'(x) > 0$ when $x > e$.  This shows that $g(x)$ attains a minimum value at $x = e$.  Since $g(e) > 0$, and $g(e)$ is the minimum value of $g$, we have that $g(x) > 0$ for all $x > 0$.  
Alternatively, to show that $g(x) > 0$, you could note that $y = x/e + e^2 + 1$ and $\ln x$ never intersect so that the distance between them is always positive.  Since the two functions are continuous on $(0, \infty)$ and, say, $\frac{1}{e} + e^2 + 1 > \ln(1)$, then $x/e + e^2 + 1 > \ln x$ for all x > 0$.
