Exactness of 2nd-Order Differential Equations via Differential Forms This (probably very elementary) question came up the last time I taught differential equations, and I've been toying with it for a while with no success:
A 1st-order differential equation $M(x,y)dx+N(x,y)dy=0$ is exact if $$M(x,y)dx+N(x,y)dy=f_x(x,y)dx+f_y(x,y)dy$$ for some differentiable function $f(x,y)$ defined on the domain of $\omega$.  In this case, we easily arrive at an implicitly-defined solution to the differential equation.  Importantly, there is a nice test for exactness stemming from Clairaut's theorem -- for everywhere smooth $M$ and $N$ (for simplicity/laziness...obvious generalizations abound), the differential equation is exact iff $N_y=M_x$.  Of course, this procedure is easily re-interpreted as saying that by the triviality of $H^1(\mathbb{R}^2)$, a one-form is closed if and only if it is exact.
Now let's move one degree higher.  Boyce and Di Prima define a 2nd-order differential equation $P(x)y''+Q(x)y'+R(x)y=0$ to be exact if there exists a differentiable function $f(x,y)$ such that the differential equation can be written
$$P(x)y''+Q(x)y'+R(x)y=[P(x)y']'+[f(x)y]'=0.$$
The analogous expression to Clairaut's theorem seems to be that (again, for sufficiently smooth inputs) an equation of that form is exact iff $P''(x)-Q'(x)+R(x)=0.$  Of importance is that such forms can be integrated once to leave us with a 1st-order differential equation.  So we've successfully lowered the degree of our problem.
This feels to me very much like an analogous $H^2$ calculation.  We have a condition on some coefficients that very much looks like an alternating sum coming from a $d$ map on forms, and lets us conclude that the equation "comes from" a one-degree-smaller differential equation.  
But! (and here's the question) I can't seem to fit any 2-forms into this picture that would explain this analogy.  Presumably there's some big story here linking the two notions of exactness about which I'd love to be enlightened.
Side remark:  I once received a partial response that there might be a link with Cartan tableau, which I've been unsuccessful in pursuing, if that helps spark an idea.
 A: What you are looking for nowadays goes by the name of the Rumin complex and is defined on any contact manifold.  Moreover, there is a vast generalization of this that sometimes goes by the name of 'the variational bicomplex' and sometimes by the name 'characteristic cohomology'.  Here is a brief description that is suited for the question you asked:
On $M = \mathbb{R}^3$ with coordinates $x,y_0,y_1$, consider the differential ideal $\mathcal{I}\subset\Omega^\ast(M)$ generated by the $1$-form $\omega = dy_0 - y_1\ dx$, i.e., $\mathcal{I}$ is the set of linear combinations of all multiples of $\omega$ and $d\omega$.  Note that $\mathcal{I}$ is a homogeneous ideal and equals $\Omega^\ast(M)$ in degrees 2 and 3.  Because $\mathcal{I}$ is closed under exterior derivative, it is a sub-complex of $\bigl(\Omega^\ast(M),d\bigr)$. Thus, there is a graded quotient complex, call it $\bigl(\mathcal{Q},\bar d\bigr)$, that vanishes in degrees above $1$.  Note that $\mathcal{Q}^0 = \Omega^0(M)= C^\infty(M)$, since $\mathcal{I}$ vanishes in degree $0$.
Now, say that an element $\phi \in \mathcal{Q}^1$ is exact if $\phi = \bar d f$ for some $f\in \mathcal{Q}^0 = \Omega^0(M)= C^\infty(M)$.  Unfortunately, unlike $\bigl(\Omega^\ast(M),d\bigr)$, the complex $\bigl(\mathcal{Q},\bar d\bigr)$ is not locally exact in positive degree.  In fact, $\bar d \phi =0$ for all $\phi\in\mathcal{Q}^1$, even though $\bar d: \mathcal{Q}^0\to \mathcal{Q}^1$ is not onto.
Let me pause just a moment to explain how this fits into your question.  Your equation $P(x)y'' + Q(x)y' +R(x)y = 0$ is encoded as the $1$-form $\phi = P(x) dy_1 + (Q(x)y_1 + R(x) y_0) dx$ (which represents the same class as the $1$-form $P(x) dy_1 + Q(x)dy_0 + R(x) y_0 dx$ in $\mathcal{Q}^1$), and you are asking when there is a function $f(x,y_0,y_1)$ such that $\phi = \bar d f$.  (You should verify that $f = P(x) y_1 + (Q(x)-P'(x))y_0$ works when your equation is satisfied and that, otherwise, nothing does.)
Now, how can we test for exactness in this sense?  This is where the Rumin complex (aka the variational bicomplex, etc.) comes in.  It turns out that there is a way to embed the operator $\bar d:\mathcal{Q}^0\to\mathcal{Q}^1$ into a complex that provides a fine resolution of the constant sheaf, the same way that the exterior derivative does for the full complex of exterior differential forms.  
What you do is this:  Let $\mathcal{E}^2\subset\Omega^2(M)$ be the set of multiples of $\omega$ and let $\mathcal{E}^3=\Omega^3(M)$.  
We now want to define a complex
$$
0\longrightarrow \mathcal{Q}^0
\buildrel{\bar d}\over\longrightarrow \mathcal{Q}^1
\buildrel{D}\over\longrightarrow \mathcal{E}^2
\buildrel{d}\over\longrightarrow \mathcal{E}^3
\longrightarrow 0.
$$
The map from $\mathcal{E}^2$ to $\mathcal{E}^3$ is the usual exterior derivative, so the only thing left to define is the map $D:\mathcal{Q}^1\to \mathcal{E}^2$.  To do this, we first define a (first-order) operator $\delta: \mathcal{Q}^1\to\Omega^1(M)$, by requiring that $\delta(\phi)$ be a 1-form representing $\phi$ in the quotient complex and that $d\bigl(\delta\phi\bigr)$ lie in $\mathcal{E}^2$, i.e., that it be a multiple of $\omega$.  (I'll let you write down the formula for $\delta$ in local coordinates.)  Now, define $D\phi$ to be $d\bigl(\delta\phi\bigr)$.  (Sounds almost trivial doesn't it?)  The operator $D$ is easily verified to be second order and linear.
Now, it is not hard to verity that this complex is locally exact in positive degrees.  (It also gives a fine resolution of the constant sheaf, so its cohomology on $M$ is canonically isomorphic to the deRham cohomology of $M$.)  In particular, the local condition that $\phi\in\mathcal{Q}^1$ be exact is that $D\phi=0$.  
You should verify (after you have defined $D$) that this reproduces your condition precisely in the linear case you asked about.
