One of my textbooks includes the following question.
Find the most general Lagrangian function of the form ...
$$ L(t,x,x ̇)=f(t,x)x ̇^2 ̇+g(t,x) x ̇^3+h(t,x)x ̇^4 $$
... for which the extremals are straight lines.
Now superficially it doesn't look that hard - apply the Euler-Langrange equation and look for the constraints on f(t,x), g(t,x), and h(t,x) that lead to the ODE for a straight line, but hours later and I'm still battling.
I end up with the following equal to zero ... $$ 2x ̇^2∂f/∂t+x ̇^2 (∂f/∂x+3 ∂g/∂t)+2x ̇^3 (∂g/∂x+2 ∂h/∂t)+3x ̇^4∂h/∂x +2(f+3gx ̇+6hx ̇^2 )x ̈ $$
From this point on I'm clueless. Can anyone out there give me a push in the right direction?
Feedback
For those who might be interested - it turned out not to be so difficult. By assuming the the resulting ODE had to be of the form...
$$ x ̈= 0 $$
.. and so consequently by setting all other coefficients to zero, it turns out that the general form is ...
$$ L(t,x,x ̇)=(3ax^2+c)x ̇^2+(-2axt+b)x ̇^3+(2at^2+d)x ̇^4 ̈ $$
Where a,b,c, and d are just constants.
I) We assume that OP's variables $x$ is supposed to be a 1-dimensional real variable $x\in\mathbb{R}$. Consider a Lagrangian of the form
$$\tag{1} L(t, x,\dot{x})~=~\sum_{n\geq 0} f_n(t,x) \dot{x}^n, $$
where the coefficient functions $f_n$ depend on $x$ and $t$. The Euler-Lagrange (EL) equation becomes
$$\tag{2}0~=~\frac{d}{dt}\frac{\partial L}{\partial \dot{x}}- \frac{\partial L}{\partial x}~=~\ddot{x}\sum_{n\geq 2}n(n-1)f_n\dot{x}^{n-2} + \sum_{n\geq 0}\left[(n-1)\frac{\partial f_n}{\partial x}+(n+1)\frac{\partial f_{n+1}}{\partial t}\right]\dot{x}^n.\qquad$$
To ensure that the EL eq. (2) is equivalent to
$$\tag{3} \ddot{x}~=~0, $$
or equivalently, a straight line in an $(x,t)$-diagram, we impose that the square brackets in eq. (2) should vanish identically
$$\tag{4} \forall n\in \mathbb{N}_0:~~ (n-1)\frac{\partial f_n}{\partial x}+(n+1)\frac{\partial f_{n+1}}{\partial t}~=~0.$$
II) In OP's case only $f_2$, $f_3$, and $f_4$ are non-zero. The eq. (4) then leads to the eqs. system
$$\tag{5} \frac{\partial f_2}{\partial t}~=~0, \quad \frac{\partial f_2}{\partial x}+3\frac{\partial f_3}{\partial t}~=~0, \quad \frac{\partial f_3}{\partial x}+2\frac{\partial f_4}{\partial t}~=~0, \quad \frac{\partial f_4}{\partial x}~=~0. $$
Clearly, $f_2$ is only a function of $x$ and $f_4$ is only a function of $t$. The two middle eqs. imply
$$\tag{6} \frac{1}{3} t \frac{\partial f_2(x)}{\partial x}+g_2(x) ~=~-f_3(t,x)~=~2x\frac{\partial f_4(t)}{\partial t}+g_4(t), $$
where $x\mapsto g_2(x)$ and $t\mapsto g_4(t)$ are functions of $x$ and $t$, respectively. Differentiation of eq. (6) implies
$$\tag{7} \frac{\partial^2 f_2(x)}{\partial x^2}~=~ 6\frac{\partial^2 f_4(t)}{\partial t^2}. $$ Eq. (7) implies that the coefficient functions $f_2$ and $f_4$ are quadratic polynomials
$$\tag{8} f_2(x)~=~6a x^2 + b_2x +c_2\quad\text{and}\quad f_4(x)~=~a t^2 + b_4x +c_4 .$$
Eqs. (6) and (8) then yield
$$\tag{9} g_2(x)-2b_4x~=~c_3~=g_4(t)-\frac{b_2}{3}t$$
via separation of variables. From eqs. (6) and (9) we deduce that the middle coefficient function $f_3$ is of the form
$$\tag{10} -f_3(t,x)~=~4axt+2b_4x+\frac{b_2}{3}t+c_3 .$$
Altogether this is a 6-parameter solution for $L$.
III) Finally, it is interesting to note that the eq. (4) for $f_0$ and $f_1$
$$ \tag{11} \frac{\partial f_0}{\partial x}~=~\frac{\partial f_1}{\partial t} $$ decouples from the other coefficient functions $f_{n\geq 2}$. Eq. (11) has a local solution
$$ \tag{12} f_0~=~\frac{\partial F}{\partial t}\quad\text{and}\quad f_1~=~\frac{\partial F}{\partial x} $$
for some function $(t,x)\mapsto F(t,x)$. This reflects the fact that the EL eq. is unchanged if we shift the Lagrangian
$$ \tag{13} L~ \leadsto~ L-\frac{dF}{dt}$$
with a total derivative term
$$\tag{14} \frac{dF}{dt}~=~\frac{\partial F}{\partial t}+\dot{x}\frac{\partial F}{\partial x} ~=~f_0+f_1\dot{x}. $$