What is the minimum distance between the curves $f(x) =e^x$ and $g(x) = \ln x$? I didn't understand how to solve the problem. Please help me.
Minimum distance between the curves $f(x) =e^x$ and $g(x) =\ln x$
2.5k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 3 best solutions below
On
Consider a point $(s, e^s)$ on one curve, and a point $(t, \ln t)$ on the other (for $s \in \mathbb R, t \in \mathbb R^{+}$). The squared distance between these is $$ d(s, t) = (s-t)^2 + (e^s - \ln t)^2 $$
The minimum of this function of two variables occurs at some point $(s_0, t_0)$, and the minimum distance between the curves is $\sqrt{d(s_0, t_0)}$.
You can find the minimum of $d$ by setting its gradient to zero and solving. You'll a few solutions at most, and the one where $d$ is smallest is the one you want.
On
Have a visualization:
The green curve is $f(x) = e^x$, the red curve is $g(x) = \ln(x)$. $P$ is a point on the graph of $f$, $Q$ is a point on the graph of $g$. Shown is the distance between $P$ and $Q$.
The obvious symmetry of the graphs results from the fact that $f$ and $g$ are inverse to each other, $\DeclareMathOperator{id}{id}f \circ g = g \circ f = \id$ which can be constructed as mirroring at the line $y = x$, thus the graph of $\id$.
The distance of the curves is the minimum (perhaps infimum) of all possible distances between a point of the graph of $f$ and a point of the graph of $g$. \begin{align} d(f, g) &= \min_{x, y} d((x, f(x)), (y, g(y)) \\ &= \min_{x, y} \sqrt{(x - y)^2 + (f(x) - g(y))^2} \end{align}
With $q = d^2$ we have $$ q = (x - y)^2 + (e^x - \ln(y))^2 $$ and $$ \DeclareMathOperator{grad}{grad} \grad q = (q_x, q_y) $$ with \begin{align} q_x &= 2 (x - y) + 2(e^x - \ln(y)) e^x \\ q_y &= 2 (x - y)(-1) + 2(e^x - \ln(y)) (-(1/y)) \end{align} To find out where the gradient vanishes (from the graph it seems $(0,1)$), we solve \begin{align} 0 &= x - y + e^x - \ln(y) \\ 0 &= x - y + (e^x - \ln(y))/y \end{align} From this we get $$ 0 = (e^x-\ln(y))(1 - 1/y) \iff \\ 1 - 1/y = 0 \vee e^x - \ln(y) = 0 \iff \\ y = 1 \vee e^x = \ln(y) $$ Inserting $y = 1$ we get $$ 0 = x - 1 + e^x \\ 1 - x = e^x \\ $$ which means $x = 0$. So $(0,1)$ is a critical point. Going on analytically would mean to look at the second partial derivatives, and check for the positive defniteness at $(0,1)$ to establish the local minimum.
We get \begin{align} q_{xx} &= 2 + 2 (e^x)^2 + 2 (e^x - \ln(y)) e^x \\ q_{xy} &= -2 - 2 e^x / y \\ q_{yy} &= 2y + 2 (1/y)^2 + 2(e^x - \ln(y))(1/y^2) \\ \end{align} so \begin{align} q_{xx}(0,1) &= 2 + 2 + 2 = 6 \\ q_{xy}(0,1) &= -4 \\ q_{yy}(0,1) &= 2 + 2 + 2 = 6 \end{align} and $$ \left. H \right|_{(0,1)} = \left. \begin{pmatrix} q_{xx} & q_{yx} \\ q_{xy} & q_{yy} \end{pmatrix} \right|_{(0,1)} = \begin{pmatrix} 6 & -4 \\ -4 & 6 \end{pmatrix} $$ Using linear algebra or a computer algebra system (me lazy) one finds the eigenvalues $2$ and $10$, both positive, so the Hesse matrix is positive definite at $(0,1)$ and it must be a minimum.

Both graphs are reflections of each other in the line $y=x$, so the line joining the closest points in perpendicular to this and is normal to both curves. Hence at the closest points the tangents to each curve are parallel and have gradient $1$ and this only occurs at the points where the graphs meet the coordinate axes. So the shortest distance is $\sqrt{2}$