Solution (source code)

= Solution

If the integrand has no explicit $x$ dependence, differentiate $f-y'f_{y'}$ along a stationary path:
$$
\frac d{dx}(f-y'f_{y'})=f_x+y'\left(f_y-\frac d{dx}f_{y'}\right)=0.
$$
The last equality uses $f_x=0$ and the <Euler-Lagrange equation>. This proves the <Beltrami identity>, the <first integral> $\boxed{f-y'f_{y'}=C}$.