How do you apply Euler-Lagrange equations when you want to minimise the cost of travelling a distance of $L$ from a certain point, $0$, given some cost function $C(t)=f(y,y')$?
My trouble with this is that the derivation of Euler-Lagrange equations required a boundary term to be $0$, and to achieve this we assumed the boundary was fixed. Here we have some integral $$\int_0^{T}f(y,y')\,dt$$ but $\delta y(T)$ is not fixed.
The boundary terms don't necesarily need to be 0, when the boundary terms are not given to be zero extra boundary conditions arise. The best way to see this is to derive the Euler-Lagrange Equations. $$min\int_0^T f(y,y')dt$$ We want to find the optimal $y$ let's call it $\tilde{y}$. We can say $$y=\tilde{y}+\alpha v$$ $$y'=\tilde{y}'+\alpha v'$$ Where $v$ is an "admissible variation" and $\alpha$ is just a scalar multiplier. All we are really saying is that any $y$ can be expressed as the optimal $y$ plus the variation from the optimal. Now, since we want our integral to be minimized when $\alpha=0$ we can state that $$\frac{d}{d\alpha}\int_0^T f(\tilde{y}+\alpha v,\tilde{y}'+\alpha v')dt|_{\alpha=0}=0$$ From calculus we remember that $$\frac{df}{d\alpha}=\frac{\partial f}{\partial y}\frac{d y}{d \alpha} + \frac{\partial f}{\partial y'}\frac{d y'}{d \alpha}$$ Thus our equation becomes $$\int_0^T \frac{\partial f}{\partial y}(\tilde{y},\tilde{y}')v+\frac{\partial f}{\partial y'}(\tilde{y},\tilde{y}')v'dt=0$$ Note that I have set the alphas to 0. From this point on all my $y$s are really$\tilde{y}$ but i will neglect the tildes for the sake of cleaner notation. So we have the equation $$\int_0^T \frac{\partial f}{\partial y}v+\frac{\partial f}{\partial y'}v'dt=0$$ We don't like having derivatives of variations so we will use product rule (aka integration by parts) to get rid of them. $$\frac{\partial f}{\partial y'}v'=\frac{d}{dt}(\frac{\partial f}{\partial y'}v)-(\frac{d}{dt}\frac{\partial f}{\partial y'})v$$ Pluging this back in to the integral and simplifying we get $$\int_0^T v(\frac{\partial f}{\partial y}-\frac{d}{dt}\frac{\partial f}{\partial y'})dt + (\frac{\partial f}{\partial y'}v)|_0^T=0$$ Now, we are gonna set each of the parts equal to zero since we don't have much control over $v$. From setting the integral equal to zero we get our classic euler lagrange equation $$\frac{\partial f}{\partial y}-\frac{d}{dt}\frac{\partial f}{\partial y'}=0$$ Now for the boundary term. If we were given $y$ at $0$ and $T$, $v$ would have to be zero there since y does not vary. However if we are not given BCs at both ends then we still need that term to be zero two more conditions can arise. $$\frac{\partial f}{\partial y'}(t=T)=0$$ and $$\frac{\partial f}{\partial y'}(t=0)=0$$ If you are given a boundary condition at only one end (for example at 0)only use the extra BC for the other end (T in our example). One last note, the boundary conditions that we just got are sometimes called natural boundary conditions since they arise naturally from the derivation, while boundary conditions you are explicitly given are called essential boundary conditions.