Difficult integration by parts in deriving Euler-Lagrange equations I am doing some reading about the calculus of variations and I am finding it really difficult to see how the integrals are being manipulated. I sense it is due to an application of integration by parts (or some multivariable calculus) but I've been staring at this for some time and am not making any progress.
In this situation, I should say that $F = F(x,y,y',y'')\in C^3(D)$ for some $D \subseteq \mathbb{R}^4$ and that $\eta \in C^4([a,b])$ is arbitrary, except that it satisfies $\eta(a) = \eta(b) = \eta'(a) = \eta'(b) = 0$.
The book I am reading (Differential and Integral Equations by P.J. Collins, pp 202) says

Because we are treating $x,y,y',y''$ as independent variables, I can see what happens to the last two terms inside the first integral - both the $\eta$ and $\eta'$ are integrated whilst the $F_{y''}$ is treated as a constant, explaining why those two terms come up in the first box on the second line. However, I am incredibly stumped what happens after that.
In particular, I am not sure how the integral on the second line arises.
Is it some application of a product/chain rule-type thing?
Any insight into this would help a lot. Thanks!
 A: The OP understands that 
$$\eta'F_{y'}+\eta''F_{y''}=\frac{d}{dx}\left(\eta F_{y'}+\eta' F_{y''}\right)-\eta \frac{dF_{y'}}{dx}-\eta' \frac{dF_{y''}}{dx}\tag 1$$
Integrating both sides of $(1)$ reveals
$$\begin{align}
\int_a^b \eta'F_{y'}+\eta''F_{y''}\, dx&=\int_a^b \left(\frac{d}{dx}\left(\eta F_{y'}+\eta' F_{y''}\right)-\eta \frac{dF_{y'}}{dx}-\eta' \frac{dF_{y''}}{dx}\right)\,dx\\\\
&=\left.\left(\eta F_{y'}+\eta' F_{y''}\right)\right|_a^b-\int_a^b \left(\eta \frac{dF_{y'}}{dx}+\eta'\frac{dF_{y''}}{dx}\right)\,dx \\\\
&=\left.\left(\eta F_{y'}+\eta' F_{y''}\right)\right|_a^b-\int_a^b \left(\eta \frac{dF_{y'}}{dx}+\frac{d}{dx}\left(\eta \frac{dF_{y''}}{dx}\right)-\eta \frac{d^2F_{y''}}{dx^2}\right)\,dx\\\\
&=\left.\left(\eta F_{y'}+\eta' F_{y''}-\eta \frac{dF_{y''}}{dx}\right)\right|_a^b-\int_a^b \left(\eta \frac{dF_{y'}}{dx}-\eta \frac{d^2F_{y''}}{dx^2}\right)\,dx
\end{align}$$
A: It's integration by-parts again. You have
$$\int_a^b\left(-\eta'\frac{d}{dx}\,F_{y''}\right)dx=-\eta\,\frac{d}{dx}\,F_{y''}\Bigg|_a^b+\int_a^b\eta\,\frac{d^2}{dx^2}\,F_{y''}\,dx.$$
The goal of all this by-parts integration, incidentally, is to make $\eta$ appear inside the integral without any derivatives. This allows us to invoke the Fundamental Lemma of the Calculus of Variations, and conclude that whatever's multiplying the $\eta$ must be zero.
A: It's all integration by parts: $$\int_{a}^b (\underbrace{\eta F_y}_{\text{first}}+\underbrace{\eta' F_{y'}}_{\text{second}}+\underbrace{\eta'' F_{y''}}_{\text{third}})dx$$
let's study the second and third integral with integration by parts


*

*(Second integral) Let $f'=\eta'$ and $g=F_{y'}$ then $$\int_a^b\eta' F_ydx = [\eta F_{y'}]_a^b-\int_a^b\eta\frac{d}{dx}F_{y'}dx$$

*(Third integral) Let $f' = \eta''$ and $g=F_{y''}$ then $$\int_a^b\eta'' F_{y''}dx = [\eta'F_{y''}]_a^b-\int_a^b\eta'\frac{d}{dx}F_{y''}dx$$


Plugging all into the initial equation we get $$\int_a^b(\eta F_y+\eta'F_{y'}+\eta'' F_{y''})dx = \\ \underbrace{\int_a^b \eta F_ydx}_{\text{first}} + \underbrace{[\eta F_{y'}]_a^b-\int_a^b\eta\frac{d}{dx}F_{y'}}_{\text{second}} +\underbrace{[\eta'F_{y''}]_a^b-\int_a^b\eta'\frac{d}{dx}F_{y''}dx}_{\text{third}}$$
Then rearranging the terms we get $$[\eta F_{y'}+\eta' F_{y''}]_a^b + \int_a^b \left[\eta(F_y-\frac{d}{dx}F_{y'})+\eta'\frac{d}{dx}F_{y''}\right]dx$$
Now I think you can get the last formula in the same manner
