Exact ordinary differential equations

We will say that the ODE $P(x,y)dx+Q(x,y)dy=0$ where $P, Q$ are functions of $x$ and $y$, it is exact if $P_y=Q_x$, where $P_y$ indicates the partial derivative of $P$ with respect to $y$ and $Q_x$, the partial derivative of $Q$ with respect to $x$.

An example of an exact ODE would be:$$(x^3+y^3) dx+3xy^2dy=0$$ In effect, calling $P(x,y)=(x^3+y^3), Q(x,y)=3xy^2$ we have $P_y=3y^2=Q_x$.

It is necessary to observe that not all the ODEs are exact, for example

$$-y^2\cdot dx +(x^2+xy) \cdot dy=0$$ This is not exact since calling $P(x,y)=-y^2, Q(x,y)=x^2+xy$, we have $$P_y=-2y\neq Q_x=2x+y$$.

To solve this type of equations we need to find $U(x,y)$ such that $U_x=P$ and $U_y=Q$ and the solution is given by $U(xy,y)=C$, where it $C$ is a constant.

To solve this type of equations we will proceed as follows.

We have:$U_x(x,y)=P(x,y)$. We integrate on both sides of the equality with respect to $x$: $$\displaystyle \int U_x(x,y) \ dx=\int P(x,y) \ dx \Rightarrow U(x,y)=\int P(x,y) \ dx +h(y)$$

Therefore we have the function we are looking for, except for the fact that we do not know $h$, a function that only depends on $y$. To find it, we derive the previous expression with respect to $y$: $$\displaystyle U_y(x,y)= \frac{d}{dy} \int P(x,y) dx + h'(y)$$ Also, we know that $U_y=Q$. Therefore equating terms we obtain a diifferentiable equation (that does not depend on $x$, since the ODE is exact) and we can find $h(y)$.

Once we know $h(y)$ , we add it to the expression of $U(x,y)$ which, equated to a constant, is the solution of our ODE.

Let's solve the ODE $$(x^3+y^3)dx+3xy^2dy=0$$ which we know to be exact.

We know that we are looking for a function $U(x,y)$ so that $U_x(x,y)=P(x,y)$. As we have already seen we have: $$U(x,y)=\int P(x,y) \ dx +h(y)=\int (x^3+y^3)dx+h(y)=\frac{x^4}{4}+y^3x+h(y)$$ where $h(y)$ is a function to be determined that only depends on $y$. To find this function, let's impose that $U$ is a solution, that is $U_y(x,y)=Q(x,y)$.

Deriving with respect to $y$ we obtain a solution by equating it to a constant: $$\left . \begin {array} {r} U_y=3y^2x+h'(y) \\ U_y=Q(x,y)=3xy^2 \end{array}\right\} \Rightarrow h'(y)=0 \Rightarrow h(y)=C$$ where $C$ is a constant that is not so important since we will also have a constant in the final solution.

And so, the solution to the ODE will be: $$\displaystyle U(x,y)=\frac{x^4}{4}+xy^3=C$$

Practice exercises