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)$

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