1

In this question I am using the euclidean metric to determine the distance between two points.

I want to make a function $f(x)=$ the minimum distance between $y=x$ and $y=e^x$ at each given point x, is there an efficient way of doing this?

Second related question if i knew $e^x$ was the shortest distance between $g(x)$ and $y = x$ could I figure out closed form solution for $g(x)$

  • The minimum distance between $y=x$ and $y=e^x$ is a number, not a function of $x$. – quasi Feb 17 '18 at 01:01
  • I meant for each point x, f(x) is the distance between a point on $e^x$ and $x$ – shai horowitz Feb 17 '18 at 01:03
  • You mean $f(x)$ is the distance from the point $(x,x)$ to the curve $(t,e^t)$? – quasi Feb 17 '18 at 01:05
  • @quasi Yeah thats a good way of putting it – shai horowitz Feb 17 '18 at 01:06
  • 3
    So not "at each given x" as you wrote initially? That would be simply $|x- e^x|$. But the distance from a point to a curve is measured along a line perpendicular to the curve. The curve $y= e^t$ has derivative $e^t$ so a line perpendicular to that must have slope $-e^{-t}$. So a line through the point (a, a) (not (x, x) because I want to save x as the independent variable of the function) perpendicular to $y= e^x$ must be of the form $y= -e^{-t}(x- a)+ a$ for some value of t. We can determine that t by using the fact that the line must intersect the curve at the point with that slope. – user247327 Feb 17 '18 at 01:24
  • why is this a different answer then taking perpendicular lines from y=x to y=e^t i.e lines with derivative negative 1 – shai horowitz Feb 17 '18 at 01:26

2 Answers2

2

Consider the point $(x_1,g(x_1))$. At this point the distance to the line $y=x$ is $d(x_1)=\exp(x_1)$.

enter image description here

As we can see, for every $x$ there are two suitable points,

\begin{align} P_1&=(x_1,x_1+\sqrt2\,d(x_1)) \\ \text{and }\quad P_1&=(x_1,x_1-\sqrt2\,d(x_1)) , \end{align}
so at least there are two suitable continuous functions,

\begin{align} g_1(x)&=x+\sqrt2\,d(x) ,\\ g_2(x)&=x-\sqrt2\,d(x) . \end{align}

g.kov
  • 13,581
1

Okay so, for your first question, all the points in the form of the line $y=x$ is in the form $(a,a)$ (So this is our best alternative, keep in mind however that the $x$'s in $y=x$ is not the same as the $x$'s in $y=e^x$, as discussed in the comments). As you mentioned, you are using the Euclidean Metric. So we need to find the minimum distance between $(a,a)$ and $(x,e^x)$. We can start at: $$g(x) = \sqrt{(a-x)^2+(a-e^x)^2}$$ So we would like to find $x$ such that this distance is minimal for a given $a$. We can take the derivative of $g$, treating $a$ as a constant to find that: $$g'(x) = \frac{-2e^x(a-e^x)-2(a-x)}{2\sqrt{(a-e^x)^2+(a-x)^2}}$$ So we set $g'(x) = 0$ and then solving for $a$ would give us the closest point of the form $(a,a)$ for a given point $(x,e^x)$. We do the math and we find that: $$a = \frac{e^{2x}+2x}{e^x+2}$$ Since the $a$ minimizes the distance $g$ we just plug it back in. Therefore, the function that represents the minimum distance for each point in the form $(a,a)$ to the curve $y=e^x$, as you said, "for every $x$" is: $$g(x) = \sqrt{(\frac{e^{2x}+2x}{e^x+2}-x)^2+(\frac{e^{2x}+2x}{e^x+2}-e^x)^2}$$

Your second question is too unclear, and I'll have to make too many assumptions to answer it

BoolHool
  • 146