How to write a certain expression as a total derivative? I would like to write the expression $g'(g'')^2$ as a total derivative, i.e. I would like to find some (analytical) expression, call it $h$, so that $h' = g'(g'')^2$. The expression $h$ can involve $g$ and any of its derivatives, as well as special functions, logarithms, etc.
Disclaimer: I don't know if this is even possible. If it's impossible, a reasonable argument why that's the case would be appreciated.
Thanks so much!
EDIT:
Editing to include the entire expression:
$\frac{1}{8}[2(g')^2g'']'-g'(g'')^2$
I would like to interpret this as the gradient of some potential — if this is impossible I will likely need to find an alternative way to look at the expression.
 A: You are after some $h$ such that
\begin{align}
h'&=g'(g'')^2.
\end{align}
Well, $h$ would have to be some function of $x$, $g$, $g'$, and $g''$: $h(x,g,g',g'')$. We can then write the total derivative out using the chain rule
\begin{align}
h'&=\frac{\partial h}{\partial x}+\frac{\partial h}{\partial g}\frac{\partial g}{\partial x}+\frac{\partial h}{\partial g'}\frac{\partial g'}{\partial x}+\frac{\partial h}{\partial g''}\frac{\partial g''}{\partial x}\\
&=\frac{\partial h}{\partial x}+\frac{\partial h}{\partial g}g'+\frac{\partial h}{\partial g'}g''+\frac{\partial h}{\partial g''}g'''.
\end{align}
Now we can match up the two equations to see if such a function exists.
\begin{align}
h'=g'(g'')^2=\frac{\partial h}{\partial x}+\frac{\partial h}{\partial g}g'+\frac{\partial h}{\partial g'}g''+\frac{\partial h}{\partial g''}g'''.
\end{align}
Unless $g=ae^x$ or $a$, $g'\neq g''\neq g'''$, so then
\begin{align}
0=\frac{\partial h}{\partial g''}g'''.
\end{align}
One must equal zero, so
\begin{align}
g'''=0 \ \ \ \ \ \text{or} \ \ \ \ \ \frac{\partial h}{\partial g''}=0.
\end{align}
Again if $g$ doesn't satisfy this condition,
Remaining is that
\begin{align}
g'(g'')^2=\frac{\partial h}{\partial x}+\frac{\partial h}{\partial g}g'+\frac{\partial h}{\partial g'}g''.
\end{align}
Perhaps the last factor will allow us to find $h$?
\begin{align}
g'(g'')^2&=\frac{\partial h}{\partial g'}g''\\
g'g''&=\frac{\partial h}{\partial g'}\\
\frac{1}{2}(g')^2g''+f(x,g)&=h(x,g,g').
\end{align}
$h$ is cannot be a function of $g''$, yet that is the only way for $h'=g'(g'')^2$, the other two terms don't help. So there is no function $h$ such that $h'=g'(g'')^2$ in general. (I didn't check the three cases I eliminated $g=ae^x$, $g=a$, $g'''=0$).
