Let $(X,d)$ be a metric space. Let $x,y\in X$.
How do we generally formulate the problem of finding the shortest path $\gamma :[0,1] \rightarrow X $ between $x,y$ ? Is it something like
$$\inf\limits_{\gamma \in C^0} [\sup_{t\in [0,1]}d(x,\gamma(t)) + d(y,\gamma(t))] $$
If so, how do we solve such an optimization problem ? Is there a more convenient way of writing it ?
Example: $X=\mathbb R^2$, $d(x,y)=\|x-y\|$
How do we see that the minimizer of
$$\inf\limits_{\gamma \in C^0} [\sup_{t\in [0,1]}\|x-\gamma(t)\| + \|y-\gamma(t)\|] $$
is the straight line passing through $x$ and $y$ ?
Edit: this question is about metric spaces. If possible, the answer should not involve Riemannian geometry in its full generality as I do not know any Riemannian geometry. Also, I know that variational calculus has to do something with this problem (from another angle). Any insight linking what I wrote to a variational problem is welcome.