A calculus-based "proof" that the shortest distance between two points is the line segment. Is the argument valid? I saw a "proof" about the statement

The shortest distance between two points $A$ and $B$ is the line segment $AB$.

It denoted $y$ as the function of a path between $A$ and $B$. Then it used calculus and found that $y^{\prime\prime}=0$, concluding that $y$ is the line segment $AB$. This proof is verified to have no mistake in calculus. Although I don't have much knowledge about it, I suppose there exist such two suspicion points:

*

*The path may not have a form $y=f(x)$ because it might be tangled up too much to express in a way where each "$x$" can only map to a single "$y$". Such a pass is seemingly not the shortest, but this is left to be proved.

*A line segment being defined as a path whose function's second derivative is $0$ may be inappropriate. On the contrary, if a segment is defined as the shortest path between two points and a line is defined as infinitively extending a segment might be better. (In this way, the proof is regarding the question


Prove that a line's function $y=f(x)$ has $y^{\prime\prime}=0$.

In order that the users can judge the proof better, here's a translation. (Chinese originally)

$$\text ds=\sqrt{(\text dx)^2+(\text dy)^2}=\text dx\cdot\sqrt{1+\left(\dfrac{\text dy}{\text dx}\right)^2}.$$
From $A$ to $B$:
$$S_{AB}=\int_A^B\sqrt{1+y'^2}~\text dx.$$
Plug in the Euler-Lagrange function to get
\begin{align*}&\frac{\partial \sqrt{1+\left(y^{\prime}\right)^{2}}}{\partial x}=0,\\&\frac{\partial \sqrt{1+\left(y^{\prime}\right)^{2}}}{\partial y^{\prime}}=\frac{y^{\prime}}{2 \sqrt{1+\left(y^{\prime}\right)^{2}}}.\end{align*}
When $S_{AB}$ reaches minimum,
$$\frac{\partial L}{\partial y}-\frac{\partial}{\partial x}\left(\frac{\partial L}{\partial y'}\right)=0.$$
Solving gives $y''=0$.

 A: A path from $A$ to $B$ can be any continuous map $f$ defined on some interval $[a,b]$ with $f(a)=A$ and $f(b)=B$. How do we define the length of a path? For a line segment, we define it as the distance between the end points; for a poly line we define it as the sum of the length of its line segments; for the general case we define it as supremum over all poly line approximations (i.e., poly lines through vertices $f(t_i)$, $0\le i\le n$ where $a=t_0<\ldots<t_n=b$. It is immediate from the triangle inequality that every finite polyline is at least as long as the direct line, hence so is the infinite over such polylines. Unless our path is the straight line (and never gives “backwards”), there is an intermediate point $C$ not on the line segment, and again by triangle inequality, the path length is strictly longer than the direct segment.
This shows that the straight line is shortest without assuming $f$ differentiable.
Incidentally, $f(t)=(t^3,t^3)$ is a valid way to describe a path along the main diagonal. It is shortest, but of course, the second derivative by time is not zero.
A: Here's a strategy:

*

*Argue that we should minimize the arclength functional $\int_{t_A}^{t_B}\! dt~ \sqrt{\dot{x}^2+\dot{y}^2}$, cf. above comment by Intelligenti pauca.


*Argue that we might as well minimize the non-square root functional
$\int_{t_A}^{t_B}\! dt~ (\dot{x}^2+\dot{y}^2)$, cf. e.g. this Math.SE post.


*Derive the Euler-Lagrange (EL) equations $\ddot{x}=0=\ddot{y}$.


*Deduce that this is a line segment.
