Calculus of variations confusion Let's say I have the lagrangian 
$$L(x,u,u')=u'$$
If apply the Euler-Lagrange equation for $L$, I have:
$$\frac{\partial L}{\partial u}-\frac{d}{dx}\frac{\partial L}{\partial u'}=0-\frac{d}{dx}(1)=0$$
If I choose to apply to $L^2$, I have:
\begin{equation}
\frac{\partial L^2}{\partial u}-\frac{d}{dx}\frac{\partial L^2}{\partial u'}=0-\frac{d}{dx}(2u')=-2u'' \tag{1}
\end{equation}
If I expand the Euler-Langrange equation for $L^2$, I get:
\begin{equation}
\frac{\partial L^2}{\partial u}-\frac{d}{dx}\frac{\partial L^2}{\partial u'}=2L\frac{\partial L}{\partial u}-\frac{d}{dx}(2L\frac{\partial L}{\partial u'})=2L(\frac{\partial L}{\partial u}-\frac{d}{dx}\frac{\partial L}{\partial u'})-2\frac{dL}{dx}\frac{\partial L}{\partial u'}
\end{equation}
$L$ does not explicitly depend on x, so:
\begin{equation}
\frac{\partial L^2}{\partial u}-\frac{d}{dx}\frac{\partial L^2}{\partial u'}=2L(\frac{\partial L}{\partial u}-\frac{d}{dx}\frac{\partial L}{\partial u'})=2L(0)=0?? \tag{2}
\end{equation}
Why does $(1)$ differ from $(2)$? What am I doing wrong?
 A: There are several issues to consider here:


*

*In general, changing a choice of Lagrangian from $L$ to $L^2$ doesn't preserve the equations of motion. For example, $L=\frac{1}{2}u'^2-V(u)\implies u''=-\partial_u V$, but $$L=\frac{1}{4}u'^4-u'^2 V(u) + V^2(u)\implies u''=-\frac{2V+u'^2}{2V-3u'^2}\partial_uV.$$These are only equivalent if $u'=0$.

*Probably the most famous example where squaring a Lagrangian does preserve the EOMs is $L=\sqrt{g_{\mu\nu}\partial_sx^\mu\partial_sx^\nu}$ when finding the geodesic deviation equation. Your comment on an existing answer suggests you thought this generalises. It does not. Even in the geodesic example, the only sense in which the two approaches are equivalent is that you can choose an affine parameter so as to equate the results. See the accepted answer to this existing question.

*Your original Lagrangian $u'$ is a total derivative, with the same vacuously true Euler-Lagrange equation as the choice $L=0$.

*In $L=u'$, $u$ has momentum $p=1$. This is a phase space constraint, which opens a can of worms. For example, if we tried to obtain the Hamiltonian for this Lagrangian, you'd just get $0$ until you include Dirac brackets viz. $H=f(u,\,p)(p-1)$ for some function $f$. This gives the Hamilton's equations $u'=f+(p-1)\partial_p f,\,0=p'=(1-p)\partial_u f$. The problem is we can't solve this for $f$.

*The Lagrangian $u'^2$ has equation of motion $u''=0$ anyway.

A: Let me define these two Lagrangians 
$$
L_1 = u' \tag{a}
$$
and 
$$
L_2 = (u')^2 \tag{b}
$$
As it turns out $L_1$ has its own equations of motion and they do not need to satisfy equation (b). In other words, a solution of Eq. (a) it is not the same as a solution of Eq. (b). With this in mind, the problem with your argument is that in your equation (1) you assume that the Lagrangian is $L_2 = L^2$, and in your equation (2) you then assume that the Lagrangian is $L_1 = L$, which clearly will lead to a problem!
