# Integrating Factors Via Minimization

I am trying to algorithmize an idea to find integrating factors for inexact differential equations via optimization. Currently, I'm sticking to simple cases that can already be solved by other means. I'll use the example $$5xy\ dx + x^3\ dy = 0$$, and restrict the target integrating factor $$u(x)$$ to depend on $$x$$ but not $$y$$.

In this example, the quantity $$\frac{\partial N}{\partial x} - \frac{\partial M}{\partial y}$$, hereafter referred to as curl, evaluates to $$3x^2 - 5x$$; we need multiplication by $$u$$ to make it $$0$$. Intuition would suggest that the better an integrating factor simplifies the expression for curl, the closer we are to the goal. For instance, I would expect an integrating factor that yields a curl of $$2x$$ to be on the right track, but one that yields a curl of $$1000x^{8.4} + 123x^2 + 456x - x^{-20}$$ not so much. This has the vibe of a minimization problem, but since curl, viewed globally, returns an expression rather than a value, I want to minimize its length squared instead. Naively picking the inner product $$\int_{-1}^1 p(x)q(x)\ dx$$, the length squared of the curl after multiplying the ODE by $$u$$ should be $$\int_{-1}^1 (\frac{\partial (x^3u)}{\partial x} - \frac{\partial (5xyu)}{\partial y})^2\ dx$$, so my hypothesis is that the critical points occur at $$\frac{d(\int_{-1}^1 (\frac{\partial (x^3u)}{\partial x} - \frac{\partial (5xyu)}{\partial y})^2\ dx)}{du} = 0$$. However, I'm not sure if finding critical points by taking a derivative with respect to a function works, so perhaps I need to use the length squared of $$u$$ as well, as in $$\frac{d(\int_{-1}^1 (\frac{\partial (x^3u)}{\partial x} - \frac{\partial (5xyu)}{\partial y})^2\ dx)}{d(\int_{-1}^1 u^2\ dx)} = 0$$. In either case, the top expands to $$d(\int_{-1}^1 9x^4u^2 + 6x^5uu'+ x^6(u')^2 - 30 x^3u^2 - 10x^4uu' + 25x^2u^2\ dx)$$, which is tricky.

My first attempt, inspired by this transformation from $$dS$$ to $$dt$$ via algebraic manipulation of differentials, was to multiply $$dx$$ by $$\frac{du}{du}$$ to get $$\frac{dx}{du}\ du$$, and finally $$\frac{1}{u'}\ du$$. However, the idea has been stated to not work, and in any case, may not help much here since both $$x$$ and $$u$$ appear explicitly in every term.

Is there a way to make progress in computing this differential, or the whole derivative? If not, is there a different inner product that would define a more convenient notion of length for this task? As a last resort, if we find the solution through conventional means, in this case $$y = Ce^{5/x}$$, can we then find such an inner product, i.e., something involving a line integral over a solution curve?