Euler-Lagrange equation with constraints outside the integral So I've been studying Euler-Lagrange equations, and on an assignment I have the problem to find them for
$J(y)=\int_a^bF(x,y,y')dx-By(b)+Ay(a)$
Where $y(a)$ and $y(b)$ are free, $A$ and $B$ are constant.
Without those terms outside the integral, this would be fairly straightforward.
My first instinct was to fall back to the Gateaux derivative, but that went nowhere. My second thought was to recognize that
$\int_a^bF-y'dx = \int_a^bFdx-y(b)+y(a)$
and thought that if I could move everything back into the integral, it would be again straightforward, but I cannot think of a way to incorporate the two constants int that without piece-wise functions.
We've not studied anything of this sort, and the professor is tight-lipped about help on it.
 A: When forming the Euler-Lagrange equations, the integral part of the functional translates into a PDE, while the contribution of boundary values translates into a boundary condition for that ODE. Let's see why: replacing $y$ with $y+\phi$ yields
$$
J(y+\phi)-J(y) = \int_a^b [F(x,y+\phi,y'+\phi')-F(x,y,y')]\,dx - B\phi(b) + A\phi(a)
$$ 
As usual, we linearize $F$ about $y$ and integrate by parts, turning the integral into 
$$\int_a^b [F_y(x,y,y')\phi+F_z(x,y,y')\phi']\,dx
= \int_a^b \left[F_y(x,y,y')-\frac{d}{dx} F_z(x,y,y')\right]\phi\,dx 
+F_z(x,y,y')\phi \bigg|_a^b
$$
Stationarity requires:


*

*The expression in square brackets must be identically zero, since $\phi$ could be a bump function 

*The coefficients of $\phi(a)$ and $\phi(b)$ must be zero, since these values of $\phi$ could be changed without affecting the integral part much.  


Part 1 gives the usual Euler-Lagrange equation, while part 2 supplies the boundary conditions
$$
F_z(a,y(a),y'(a)) = A,\qquad  F_z(b,y(b),y'(b)) = B
$$
Reference: chapter 2 of lecture notes "First variation" by Andrej Cherkaev.
