For learning purposes, I'm trying to prove that the shortest function passing through the two points $(x\_1, y\_1)$, $(x\_2, y\_2)$ is a straight line, without using the Euler-Lagrange equation.

My attempt at a proof is below. I think I have most of it, but I get stuck at the end.  

How do I finish the proof?

---

### My attempt:

Assume $y$ is the function of $x$ to be determined, which satisfies $y(x\_1) = y\_1$ and $y(x\_2) = y\_2$.  

I define the length to be minimized as follows:

$$L(y) = \int\_{x\_1}^{x\_2} \sqrt{1 + \left(\frac{dy}{dx}\right)^2} \,dx$$

Consider perturbing $y$ by some multiple $\delta$ of an arbitrary deviation $w$ that vanishes at $x\_1$ and $x\_2$:

$$L(y, \delta) = \int\_{x\_1}^{x\_2} \sqrt{1 + \left(\frac{d(y + \delta w)}{dx}\right)^2} \,dx$$

$$L(y, \delta) = \int\_{x\_1}^{x\_2} \sqrt{1 + \left(\frac{dy}{dx} + \delta\frac{dw}{dx}\right)^2} \,dx$$

If $y$ minimizes $L$, then for any fixed $w$ the rate of change (i.e., derivative) of $L$ with respect to $\delta$ must approach zero as $\delta \to 0$:

$$
\frac{d}{d\delta}L(y, \delta)
= \frac{d}{d\delta}\int\_{x\_1}^{x\_2} \sqrt{1 + \left(\frac{dy}{dx} + \delta\frac{dw}{dx}\right)^2} \,dx \\
= \int\_{x\_1}^{x\_2} \frac{d}{d\delta} \sqrt{1 + \left(\frac{dy}{dx} + \delta\frac{dw}{dx}\right)^2} \,dx \\
= \int\_{x\_1}^{x\_2} \frac{\left(\frac{dy}{dx} + \delta\frac{dw}{dx}\right) \frac{dw}{dx}}{\sqrt{1 + \left(\frac{dy}{dx} + \delta\frac{dw}{dx}\right)^2}} \,dx \to 0
$$

Specifically, since this holds true when $\delta = 0$, we have:

$$
\int\_{x\_1}^{x\_2} \frac{\frac{dy}{dx} \frac{dw}{dx}}{\sqrt{1 + \left(\frac{dy}{dx}\right)^2}} \,dx = 0
$$

### Now here's where I get stuck:

I need to get rid of $w$ somehow. 

Because the equality above needs to hold for *all* $w$, I think I would prefer to *pick* $w$ to be something convenient that makes my life easier; say, $\frac{dw}{dx} = \sqrt{1 + \left(\frac{dy}{dx}\right)^2}$, to cancel the denominator.  

But I **cannot** assume this is possible, as $w$ must satisfy **two** boundary conditions:  

it must vanish at *both* $x\_1$ *and* at $x\_2$.

### How am I supposed to proceed?