Let $f \in C^1(\mathbb{R}^3)$ and $u \in C^2(\mathbb{R}^2)$. Prove that the two following functionals admit the same extremals:
$$I(y) = \int_a^b f(x,y,y')\; \text{d}x\text{ and }J(y) = \int_a^b f(x,y,y')+\frac{\partial u}{\partial x}(x,y)+ \frac{\partial u}{\partial y}(x,y)\,y'\, \text{d}x$$
I've tried writing the Euler-Lagrange equation for both these functionals but I'm not getting anywhere with the function $u$...
Denote $L(x,y,y')$ to be the integrand of $J(y)$. We'll compute the Euler Lagrange equations of $L$. In what follows, I'll be sloppy with the notation and the points of evaluation, because plugging in all the points will make it extremely cumbersome, and almost unreadable. We have: \begin{align} & \quad \dfrac{d}{dx} \dfrac{\partial L}{\partial y'} - \dfrac{\partial L}{\partial y} \\ &= \dfrac{d}{dx} \left(\dfrac{\partial f}{\partial y'} + \dfrac{\partial u}{\partial y} \right) - \left( \dfrac{\partial f}{\partial y} + \dfrac{\partial^2 u}{\partial y \partial x} + \dfrac{\partial^2 u}{\partial y^2} \cdot y' \right) \\ &= \left[\dfrac{d}{dx} \dfrac{\partial f}{\partial y'} - \dfrac{\partial f}{\partial y} \right] + \dfrac{d}{dx} \dfrac{\partial u}{\partial y} - \left( \dfrac{\partial^2 u}{\partial y \partial x} + \dfrac{\partial^2 u}{\partial y^2} \cdot y' \right) \tag{*} \end{align}
Now, we apply the chain rule to compute $\dfrac{d}{dx} \dfrac{\partial u}{\partial y}$. Doing so yields: \begin{align} \dfrac{d}{dx} \dfrac{\partial u}{\partial y} &= \dfrac{\partial^2 u}{\partial x \partial y} + \dfrac{\partial^2 u}{\partial y^2} \cdot y' \end{align} Notice that this is almost identical to the last term in (*), the only difference being the order in which the mixed partials occur. However, since $u$ is assumed to be $C^2$, the order of mixed partials doesn't matter. Hence, it follows that \begin{align} \dfrac{d}{dx} \dfrac{\partial L}{\partial y'} - \dfrac{\partial L}{\partial y} &= \dfrac{d}{dx} \dfrac{\partial f}{\partial y'} - \dfrac{\partial f}{\partial y}. \tag{**} \end{align}
By (**), we now have the following equivalences: \begin{align} \text{$y$ is a stationary curve for $I$} & \iff \dfrac{d}{dx} \dfrac{\partial f}{\partial y'} - \dfrac{\partial f}{\partial y} = 0 \\ & \iff \dfrac{d}{dx} \dfrac{\partial L}{\partial y'} - \dfrac{\partial L}{\partial y} = 0 \\ & \iff \text{$y$ is a stationary curve for $J$} \end{align}
BTW I doubt the statement is true for extremal curves (i.e maxima/minima); i think we need to replace "extremal" by "stationary".