# variable endpoints - point-line distance

The set-up: I was reading 2.3 First-order necessary conditions for weak extrema and I got to the variable endpoint section and I got a bit confused and was hoping that someone could clarify. In 2.3.1 The author goes through minimizing the distance between two points (which I understand) by showing that the length functional (where $y=y(x)$) is

$$I = \int_a^b ds = \int_a^b dx \sqrt{1+\dot{y}^2}$$ hence the Lagrangian is $$L = \sqrt{1+\dot{y}^2}$$. We know that $$\frac{d}{dx}\bigg(\frac{\partial L}{\partial \dot{y}}\bigg) - \frac{\partial L}{\partial y} = 0$$ and it's plain to see that $\frac{\partial }{\partial y}L=0$, thus $$\frac{d}{dx}\bigg(\frac{\partial L}{\partial \dot{y}}\bigg) = \frac{d}{dx}\bigg(\frac{\dot{y}}{\sqrt{1+\dot{y}^2}} \bigg) = 0$$ or $$\frac{\dot{y}}{\sqrt{1+\dot{y}^2}} = C$$. Thus $$\dot{y}=a=\frac{c}{\sqrt{1-c^2}}$$. Integrating it's plain to see that $y=ax + b$, which is just the equation for a straight line.

This I all get, but here's where I get lost and where my question comes in. When the author gets to variable endpoints, he brings up in ex 2.4 that we should now consider the shortest path between a point and a vertical line:

I don't understand how this is different from what was done in the point-point distance situation... I'd just like it if someone could walk me through how the set-up is different and how we come to the conclusion a perpendicular line to the vertical line to the desired point is the shortest distance.

tl;dr: How does point-line distance differ from point-point distance, and how do we manipulate the Euler-Lagrange differential equation to express that? Walking me through this would be appreciated. Thank you for any help in advance.