Consider the multitude of curves joining two point $P, Q$. Figure 2.5 shows a couple of these. We wish to find the curve that minimises the distance along the curve (the dashed *straight* line is obvious candidate, of course).

Given a curve, $C$, the distance, $S_C$, along $C$ is given by calculating the line integral $$ S_C = \int_{C} \mathrm{d}s$$ where $\mathrm{d}s$ is the Pythagorean differential, $$\begin{align*}\mathrm{d}s &= \sqrt{\mathrm{d}x^2 + \mathrm{d}y^2}\\ &= \mathrm{d}x \sqrt{1 + y'(x)^2}\end{align*}$$

Nb. We are assuming here that we can define $y'(x)$ along the whole curve. If that's not possible for a particular curve, we would merely chop the curve into pieces upon which we could define it.

We can use this form to find the Euler-Lagrange equation for the curve and hence solve for the function, $y(x)$.

The quantity that we will be minimising is the distance along the curve, $$ S_{PQ} = \int_{x_1}^{x_2} I(y, y') \mathrm{d}x $$ where $$I(y, y') = \sqrt{1 + y'^2}$$

Nb. It might be tempting to just set $y'(x) \equiv 0$ all along the curve, but this always results in a horizontal line, hence is not a general solution.

We can now make the following identifications in the Euler-Lagrange equations, $$\begin{align*}t & \to x\\ q & \to y\\ \dot{q_i} & \to y'\\ A & \to S\\ L(q, \dot{q_i}) & \to I(y, y')\end{align*}$$

Thus, we have $$0 = \frac{\partial I}{\partial y} - \frac{\mathrm{d}}{\mathrm{d} x} \left( \frac{\partial I}{\partial y'} \right)$$

But $$\frac{\partial I}{\partial y} = 0$$ so we must have $$\frac{\mathrm{d}}{\mathrm{d} x} \left( \frac{\partial I}{\partial y'} \right) = \frac{\mathrm{d}}{\mathrm{d} x} \left( \frac{y'}{\sqrt{1 + y'^2}} \right) = 0$$ which just means that the term in the brackets is constant, $$\frac{y'}{\sqrt{1 + y'^2}} = k$$

Solving for $y'$ gives $$y'(x) = \frac{k}{\sqrt{1 - k^2}}$$ which is also just a constant. Thus, the curve joining the points with the shortest distance must be a straight line.