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!

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
