Euler-Lagrange solution of $L=\ddot{q}^2$? I'm new to Calculus of variations and have a very basic question.  Suppose we want to solve the Lagrangian $L=\ddot{q}^2$ using the Euler-Lagrange equation.
My intuition tells me that the solution should be $\ddot{q}=0$, as any other function would result in a larger functional value.  Indeed, if I were to substitute $w$ for $\ddot{q}$, we would have $L=w^2$, and applying the Euler-Lagrange equation we would get the solution $w=\ddot{q}=0$.
However, if we apply the higher-order Euler-Lagrange equation directly to $L=\ddot{q}^2$, we obtain $\frac{d^4 q}{dt^4} = 0$.  What's going on here?
 A: Usually the principle of stationary/least action does not make sense without adequate boundary conditions; however there are 2 exceptions:

*

*If the Lagrangian is of zeroth order. Then the EL equations become $\frac{\partial L}{\partial q}=0$.


*If the Lagrangian $L\geq k$ is bounded from below. Then the minimum can be found by solving $L=k$.
OP's title Lagrangian is of type 2. However be aware that in actual physical systems there are often physically relevant boundary conditions that cannot be ignored, which could render the 2nd method moot. To answer that question properly, we need physical context.
A: It's because when you make a change of variable $w=\ddot{q}$, you actually change the Lagrangian here.
If you know how to derive the Euler-Lagrange equation, you will know that the variation of the time derivative of generalized coordinates $\delta \partial_t^nq$ will be finally turned into $\delta q$ plus a boundary term $\partial_t(\quad)$.
The variation of the time derivative of generalized coordinates is somehow caused by the variation of coordinates.
$$\frac{\partial\mathcal{L}}{\partial \dot{q}}\delta \dot{q}=-\frac{\mathrm{d}}{\mathrm{d} t}\frac{\partial\mathcal{L}}{\partial \dot{q}}\delta q+\text{boundary term}$$
It's where you miss your time derivative. I believe you can continue if you write:
$$\delta\mathcal{L}=\frac{\partial\mathcal{L}}{\partial w}\frac{\mathrm{d}w}{\mathrm{d} \ddot{q}}\delta \ddot{q}$$
Ref:
老大中，变分法基础
