Exact Equations

The differential equation $$${M}{\left({x},{y}\right)}{d}{x}+{N}{\left({x},{y}\right)}{d}{y}={0}$$$ is exact, if there exists a function $$${f{}}$$$ such that $$${d}{f{=}}{M}{\left({x},{y}\right)}{d}{x}+{N}{\left({x},{y}\right)}{d}{y}$$$.

In this case, the equation can be rewritten as $$${d}{f{=}}{0}$$$, which gives the solution $$${f{=}}{C}$$$.

Test for exactness: if $$${M}{\left({x},{y}\right)}$$$ and $$${N}{\left({x},{y}\right)}$$$ are continuous functions and have continuous first partial derivatives on some rectangle of the xy-plane, the differential equation is exact, if and only if $$$\frac{{\partial{M}{\left({x},{y}\right)}}}{{\partial{y}}}=\frac{{\partial{N}{\left({x},{y}\right)}}}{{\partial{x}}}$$$.

To solve this equation, we use the facts that $$$\frac{{\partial{f{{\left({x},{y}\right)}}}}}{{\partial{x}}}={M}{\left({x},{y}\right)}$$$ and $$$\frac{{\partial{f{{\left({x},{y}\right)}}}}}{{\partial{y}}}={N}{\left({x},{y}\right)}$$$. We integrate the first equation with respect to $$${x}$$$ to obtain $$${f{{\left({x},{y}\right)}}}$$$ through $$${x}$$$ and an unknown function $$${g{{\left({y}\right)}}}$$$. We then differentiate the result with respect to $$${y}$$$ and use the second equation. After this, we find $$${g{{\left({y}\right)}}}$$$ and thus $$${f{{\left({x},{y}\right)}}}$$$. The solution, as already stated above, is given as $$${f{{\left({x},{y}\right)}}}={C}$$$.

Example 1. Solve $$${\left({x}+{\sin{{\left({y}\right)}}}\right)}{d}{x}+{\left({x}{\cos{{\left({y}\right)}}}-{2}{y}\right)}{d}{y}={0}$$$.

Here, $$${M}{\left({x},{y}\right)}={x}+{\sin{{\left({y}\right)}}}$$$, $$${N}{\left({x},{y}\right)}={x}{\cos{{\left({y}\right)}}}-{2}{y}$$$. Since $$$\frac{{\partial{M}}}{{\partial{y}}}={\cos{{\left({y}\right)}}}$$$ and $$$\frac{{\partial{N}}}{{\partial{x}}}={\cos{{\left({y}\right)}}}$$$, we have that $$$\frac{{\partial{M}}}{{\partial{y}}}=\frac{{\partial{N}}}{{\partial{x}}}$$$ and the differential equation is exact.

Thus, there exists a function $$${f{}}$$$ such that $$$\frac{{\partial{f}}}{{\partial{x}}}={M}{\left({x},{y}\right)}={x}+{\sin{{\left({y}\right)}}}$$$ and $$$\frac{{\partial{f}}}{{\partial{y}}}={N}{\left({x},{y}\right)}={x}{\cos{{\left({y}\right)}}}-{2}{y}$$$.

Integrate the first equation with respect to $$${x}$$$ to obtain that $$${f{=}}\int{\left({x}+{\sin{{\left({y}\right)}}}\right)}{d}{x}=\frac{{1}}{{2}}{{x}}^{{2}}+{x}{\sin{{\left({y}\right)}}}+{g{{\left({y}\right)}}}$$$.

Note that here, the constant of integration can depend on $$${y}$$$ (because we integrate with respect to $$${x}$$$).

Now, differentiate the resulting equation with respect to $$${y}$$$:

$$$\frac{{\partial{f}}}{{\partial{y}}}={0}+{x}{\cos{{\left({y}\right)}}}+{g{'}}{\left({y}\right)}$$$.

On the other hand, $$$\frac{{\partial{f}}}{{\partial{y}}}={N}{\left({x},{y}\right)}={x}{\cos{{\left({y}\right)}}}-{2}{y}$$$.

So, $$${x}{\cos{{\left({y}\right)}}}+{g{'}}{\left({y}\right)}={x}{\cos{{\left({y}\right)}}}-{2}{y}$$$, or $$${g{'}}{\left({y}\right)}=-{2}{y}$$$. Integrating it, we obtain that $$${g{{\left({y}\right)}}}=-{{y}}^{{2}}+{c}_{{1}}$$$.

Thus,

$$${f{=}}\frac{{1}}{{2}}{{x}}^{{2}}+{x}{\sin{{\left({y}\right)}}}-{{y}}^{{2}}+{c}_{{1}}$$$. The solution is given as $$$\frac{{1}}{{2}}{{x}}^{{2}}+{x}{\sin{{\left({y}\right)}}}-{{y}}^{{2}}+{c}_{{1}}={C}$$$,

Or $$$\frac{{1}}{{2}}{{x}}^{{2}}+{x}{\sin{{\left({y}\right)}}}-{{y}}^{{2}}={c}_{{2}}$$$, where $$${c}_{{2}}={C}-{c}_{{1}}$$$.

We obtain an implicit solution, and there is no way to find an explicit solution.

Let's work another example.

Example 2. Solve $$${y}'=\frac{{{2}+{y}{{e}}^{{{x}{y}}}}}{{{2}{y}-{x}{{e}}^{{{x}{y}}}}}$$$.

First, rewrite it into the differential form: $$$\frac{{{d}{y}}}{{{d}{x}}}=\frac{{{2}+{y}{{e}}^{{{x}{y}}}}}{{{2}{y}-{x}{{e}}^{{{x}{y}}}}}$$$, or $$${\left({2}+{y}{{e}}^{{{x}{y}}}\right)}{d}{x}+{\left({x}{{e}}^{{{x}{y}}}-{2}{y}\right)}{d}{y}={0}$$$.

Here, $$${M}{\left({x},{y}\right)}={2}+{y}{{e}}^{{{x}{y}}}$$$, and $$${N}{\left({x},{y}\right)}={x}{{e}}^{{{x}{y}}}-{2}{y}$$$.

Since $$$\frac{{\partial{M}}}{{\partial{y}}}={{e}}^{{{x}{y}}}+{x}{y}{{e}}^{{{x}{y}}}$$$ and $$$\frac{{\partial{N}}}{{\partial{x}}}={{e}}^{{{x}{y}}}+{x}{y}{{e}}^{{{x}{y}}}$$$, we have that$$$\frac{{\partial{M}}}{{\partial{y}}}=\frac{{\partial{N}}}{{\partial{x}}}$$$ and the differential equation is exact.

So, there exists a function $$${f{}}$$$ such that $$$\frac{{\partial{f}}}{{\partial{x}}}={M}{\left({x},{y}\right)}={2}+{y}{{e}}^{{{x}{y}}}$$$ and $$$\frac{{\partial{f}}}{{\partial{y}}}={N}{\left({x},{y}\right)}={x}{{e}}^{{{x}{y}}}-{2}{y}$$$. In the previous example, we took the first equation and integrated it with respect to $$${x}$$$. Actually, we could take the second equation and integrate it with respect to $$${y}$$$. The final answer is the same. In this example, we will take the second equation and integrate it with respect to $$${y}$$$:

$$${f{=}}\int{\left({x}{{e}}^{{{x}{y}}}-{2}{y}\right)}{d}{y}={{e}}^{{{x}{y}}}-{{y}}^{{2}}+{g{{\left({x}\right)}}}$$$. Note that the constant of integration depends on $$${x}$$$, since we integrate with respect to $$${y}$$$.

Now, differentiate the resulting equation with respect to $$${x}$$$:

$$$\frac{{\partial{f}}}{{\partial{x}}}={y}{{e}}^{{{x}{y}}}+{g{'}}{\left({x}\right)}$$$.

On the other hand, $$$\frac{{\partial{f}}}{{\partial{x}}}={2}+{y}{{e}}^{{{x}{y}}}$$$; so, $$${y}{{e}}^{{{x}{y}}}+{g{'}}{\left({x}\right)}={2}+{y}{{e}}^{{{x}{y}}}$$$, or $$${g{'}}{\left({x}\right)}={2}$$$.

Integrating with respect to $$${x}$$$ gives $$${g{{\left({x}\right)}}}={2}{x}+{c}_{{1}}$$$.

So, $$${f{=}}{{e}}^{{{x}{y}}}-{{y}}^{{2}}+{g{{\left({x}\right)}}}={{e}}^{{{x}{y}}}-{{y}}^{{2}}+{2}{x}+{c}_{{1}}$$$.

And the solution is $$${{e}}^{{{x}{y}}}-{{y}}^{{2}}+{2}{x}+{c}_{{1}}={C}$$$ or $$${{e}}^{{{x}{y}}}-{{y}}^{{2}}+{2}{x}={c}_{{2}}$$$, where $$${c}_{{2}}={C}-{c}_{{1}}$$$.

Sometimes, an equation can be not exact, but it can be transformed into an exact one by multiplying the equation by the integrating factor.

So, $$${I}{\left({x},{y}\right)}$$$ is the integrating factor for the differential equation, if $$${I}{\left({x},{y}\right)}{\left({M}{\left({x},{y}\right)}{d}{x}+{N}{\left({x},{y}\right)}{d}{y}\right)}={0}$$$ is exact.

There are 2 conditions that allow to find the integrating factor easily:

If $$$\frac{{1}}{{N}}{\left(\frac{{\partial{M}}}{{\partial{y}}}-\frac{{\partial{N}}}{{\partial{x}}}\right)}={g{{\left({x}\right)}}}$$$, a function of $$${x}$$$ alone, then $$${I}{\left({x},{y}\right)}={{e}}^{{\int{g{{\left({x}\right)}}}{d}{x}}}$$$.

If $$$\frac{{1}}{{M}}{\left(\frac{{\partial{M}}}{{\partial{y}}}-\frac{{\partial{N}}}{{\partial{x}}}\right)}={h}{\left({y}\right)}$$$, a function of $$${y}$$$ alone, then $$${I}{\left({x},{y}\right)}={{e}}^{{-\int{h}{\left({y}\right)}{d}{y}}}$$$.

Now, let's do some more work with another example

Example 3. Solve $$${\left({y}+{1}\right)}{d}{x}-{x}{d}{y}={0}$$$.

Here, $$${M}{\left({x},{y}\right)}={y}+{1}$$$, and $$${N}{\left({x},{y}\right)}=-{x}$$$. Since $$$\frac{{\partial{M}}}{{\partial{y}}}={1}$$$ and $$$\frac{{\partial{N}}}{{\partial{x}}}=-{1}$$$, we have that $$$\frac{{\partial{M}}}{{\partial{y}}}\ne\frac{{\partial{N}}}{{\partial{x}}}$$$ and the equation is not exact. However, note that $$$\frac{{1}}{{N}}{\left(\frac{{\partial{M}}}{{\partial{y}}}-\frac{{\partial{N}}}{{\partial{x}}}\right)}=\frac{{1}}{{-{x}}}{\left({1}-{\left(-{1}\right)}\right)}=-\frac{{2}}{{x}}={g{{\left({x}\right)}}}$$$.

So, $$${I}{\left({x},{y}\right)}={{e}}^{{\int-\frac{{2}}{{x}}{d}{x}}}={{e}}^{{-{2}{\ln{{\left({x}\right)}}}}}=\frac{{1}}{{{x}}^{{2}}}$$$.

Multiplying the differential equation by the integrating factor gives: $$$\frac{{{y}+{1}}}{{{x}}^{{2}}}{d}{x}-\frac{{1}}{{x}}{d}{y}={0}$$$.

This equation is exact; so, there exists a function $$${f{}}$$$ such that $$${d}{f{=}}\frac{{{y}+{1}}}{{{x}}^{{2}}}{d}{x}-\frac{{1}}{{x}}{d}{y}$$$. Using the fact that $$$\frac{{\partial{f}}}{{\partial{x}}}=\frac{{{y}+{1}}}{{{x}}^{{2}}}$$$, we find that $$${f{=}}\int\frac{{{y}+{1}}}{{{x}}^{{2}}}{d}{x}=-\frac{{{y}+{1}}}{{x}}+{g{{\left({y}\right)}}}$$$. Now, differentiating with respect to $$${y}$$$ gives: $$$\frac{{\partial{f}}}{{\partial{y}}}=-\frac{{1}}{{x}}+{g{'}}{\left({y}\right)}$$$. On the other hand, $$$\frac{{\partial{f}}}{{\partial{y}}}=-\frac{{1}}{{x}}$$$; so, $$$-\frac{{1}}{{x}}+{g{'}}{\left({y}\right)}=-\frac{{1}}{{x}}$$$, or $$${g{'}}{\left({y}\right)}={0}$$$.

Solving it, we obtain that $$${g{{\left({y}\right)}}}={C}_{{1}}$$$.

So, $$${f{{\left({x},{y}\right)}}}=-\frac{{{y}+{1}}}{{x}}+{g{{\left({y}\right)}}}=-\frac{{{y}+{1}}}{{x}}+{C}_{{1}}$$$.

Therefore, the solution is $$$-\frac{{{y}+{1}}}{{x}}+{C}_{{1}}={C}$$$, or $$${y}={c}_{{2}}{x}-{1}$$$, where $$${c}_{{2}}={C}_{{1}}-{C}$$$.

Let's solve another equation.

Example 4. Solve $$${2}{x}{y}{d}{x}+{{y}}^{{2}}{d}{y}={0}$$$.

Here, $$${M}{\left({x},{y}\right)}={2}{x}{y}$$$, and $$${N}{\left({x},{y}\right)}={{y}}^{{2}}$$$. Since $$$\frac{{\partial{M}}}{{\partial{y}}}={2}{x}$$$ and $$$\frac{{\partial{N}}}{{\partial{x}}}={0}$$$, we have that $$$\frac{{\partial{M}}}{{\partial{y}}}\ne\frac{{\partial{N}}}{{\partial{x}}}$$$ and the differential equation is not exact.

However, note that $$$\frac{{1}}{{M}}{\left(\frac{{\partial{M}}}{{\partial{y}}}=\frac{{\partial{N}}}{{\partial{x}}}\right)}=\frac{{1}}{{{2}{x}{y}}}{\left({2}{x}-{0}\right)}=\frac{{1}}{{y}}={h}{\left({y}\right)}$$$.

So, the integrating factor is $$${I}{\left({x},{y}\right)}={{e}}^{{-\int\frac{{1}}{{y}}{d}{y}}}={{e}}^{{-{\ln{{\left({y}\right)}}}}}=\frac{{1}}{{y}}$$$.

Multiplying the differential equation by the integrating factor yields $$$\frac{{1}}{{y}}{\left({2}{x}{y}{d}{x}+{{y}}^{{2}}{d}{y}\right)}={0}$$$, or $$${2}{x}{d}{x}+{y}{d}{y}={0}$$$.

This equation is exact. Using the fact that $$$\frac{{\partial{f}}}{{\partial{x}}}={2}{x}$$$, we have that $$${f{=}}\int{\left({2}{x}\right)}{d}{x}={{x}}^{{2}}+{h}{\left({y}\right)}$$$. Differentiating the last eqaution with respect to $$${y}$$$ gives: $$$\frac{{\partial{f}}}{{\partial{y}}}={h}'{\left({y}\right)}$$$.

On the other hand, $$$\frac{{\partial{f}}}{{\partial{y}}}={y}$$$; so, $$${h}'{\left({y}\right)}={y}$$$, or $$${h}{\left({y}\right)}=\int{y}{d}{y}=\frac{{1}}{{2}}{{y}}^{{2}}+{c}_{{1}}$$$.

Hence, $$${f{=}}{{x}}^{{2}}+{h}{\left({y}\right)}={{x}}^{{2}}+\frac{{1}}{{2}}{{y}}^{{2}}+{c}_{{1}}$$$, and the solution is $$${{x}}^{{2}}+\frac{{1}}{{2}}{{y}}^{{2}}+{c}_{{1}}={C}$$$, or $$${{x}}^{{2}}+\frac{{1}}{{2}}{{y}}^{{2}}={c}_{{2}}$$$, where $$${c}_{{2}}={C}-{c}_{{1}}$$$.

Another case when the integrating factor can be found easily is when $$${M}={y}{f{{\left({x}{y}\right)}}}$$$ and $$${N}={x}{g{{\left({x}{y}\right)}}}$$$. In this case, $$${I}{\left({x},{y}\right)}=\frac{{1}}{{{x}{M}-{y}{N}}}$$$.

Example 5. Solve $$${y}{\left({1}-{x}{y}\right)}{d}{x}+{x}{d}{y}={0}$$$.

The equation is not exact; however, note that $$${M}{\left({x},{y}\right)}$$$ is in the form $$${y}{\left({1}-{x}{y}\right)}$$$ and $$${N}{\left({x},{y}\right)}={x}\cdot{1}$$$; so, the integrating factor is $$${I}{\left({x},{y}\right)}=\frac{{1}}{{{x}{y}{\left({1}-{x}{y}\right)}-{x}{y}}}=-\frac{{1}}{{{\left({x}{y}\right)}}^{{2}}}$$$. Multiplying by $$${I}{\left({x},{y}\right)}$$$ yields:

$$$\frac{{{x}{y}-{1}}}{{{{x}}^{{2}}{y}}}{d}{x}-\frac{{1}}{{{x}{{y}}^{{2}}}}{d}{y}={0}$$$. This equation is exact.

Using the fact that $$$\frac{{\partial{f}}}{{\partial{x}}}=\frac{{{x}{y}-{1}}}{{{{x}}^{{2}}{y}}}$$$, we have that $$${f{=}}\int{\left(\frac{{{x}{y}-{1}}}{{{{x}}^{{2}}{y}}}\right)}{d}{x}={\ln{{\left({\left|{x}\right|}\right)}}}+\frac{{1}}{{{x}{y}}}+{g{{\left({y}\right)}}}$$$.

Differentiating with respect to $$${y}$$$ gives: $$$\frac{{\partial{f}}}{{\partial{y}}}=-\frac{{1}}{{{x}{{y}}^{{2}}}}+{g{'}}{\left({y}\right)}$$$. On the other hand, $$$\frac{{\partial{f}}}{{\partial{y}}}=-\frac{{1}}{{{x}{{y}}^{{2}}}}$$$.

So, $$${g{'}}{\left({y}\right)}={0}$$$, or $$${g{{\left({y}\right)}}}={c}_{{1}}$$$.

Thus, $$${f{{\left({x},{y}\right)}}}={\ln{{\left({\left|{x}\right|}\right)}}}+\frac{{1}}{{{x}{y}}}+{c}_{{1}}$$$.

Finally, the solution is $$${\ln{{\left({\left|{x}\right|}\right)}}}+\frac{{1}}{{{x}{y}}}+{c}_{{1}}={C}$$$, or $$${\ln{{\left({\left|{x}\right|}\right)}}}+\frac{{1}}{{{x}{y}}}={c}_{{2}}$$$, where $$${c}_{{2}}={C}-{c}_{{1}}$$$.

Below is the list of common integrating factors:

Group of terms $$${I}{\left({x},{y}\right)}$$$ Exact differential $$${d}{g{{\left({x},{y}\right)}}}$$$
$$${y}{d}{x}-{x}{d}{y}$$$ $$$-\frac{{1}}{{{x}}^{{2}}}$$$ $$$-\frac{{{y}{d}{x}-{x}{d}{y}}}{{{x}}^{{2}}}={d}{\left(\frac{{y}}{{x}}\right)}$$$
$$${y}{d}{x}-{x}{d}{y}$$$ $$$\frac{{1}}{{{y}}^{{2}}}$$$ $$$\frac{{{y}{d}{x}-{x}{d}{y}}}{{{y}}^{{2}}}={d}{\left(\frac{{x}}{{y}}\right)}$$$
$$${y}{d}{x}-{x}{d}{y}$$$ $$$-\frac{{1}}{{{x}{y}}}$$$ $$$-\frac{{{y}{d}{x}-{x}{d}{y}}}{{{x}{y}}}={d}{\left({\ln{{\left(\frac{{y}}{{x}}\right)}}}\right)}$$$
$$${y}{d}{x}-{x}{d}{y}$$$ $$$-\frac{{1}}{{{{x}}^{{2}}+{{y}}^{{2}}}}$$$ $$$-\frac{{{y}{d}{x}-{x}{d}{y}}}{{{{x}}^{{2}}+{{y}}^{{2}}}}={d}{\left({\operatorname{arctan}{{\left(\frac{{y}}{{x}}\right)}}}\right)}$$$
$$${y}{d}{y}+{x}{d}{x}$$$ $$$\frac{{1}}{{{x}{y}}}$$$ $$$\frac{{{y}{d}{y}+{x}{d}{x}}}{{{x}{y}}}={d}{\left({\ln{{\left({x}{y}\right)}}}\right)}$$$
$$${y}{d}{y}+{x}{d}{x}$$$ $$$\frac{{1}}{{{\left({x}{y}\right)}}^{{n}}},{n}>{1}$$$ $$$\frac{{{y}{d}{y}+{x}{d}{x}}}{{{\left({x}{y}\right)}}^{{n}}}=-{d}{\left(\frac{{1}}{{{\left({n}-{1}\right)}{{\left({x}{y}\right)}}^{{{n}-{1}}}}}\right)}$$$
$$${y}{d}{y}+{x}{d}{x}$$$ $$$\frac{{1}}{{{{x}}^{{2}}+{{y}}^{{2}}}}$$$ $$$\frac{{{y}{d}{y}+{x}{d}{x}}}{{{{x}}^{{2}}+{{y}}^{{2}}}}={d}{\left(\frac{{1}}{{2}}{\ln{{\left({{x}}^{{2}}+{{y}}^{{2}}\right)}}}\right)}$$$
$$${y}{d}{y}+{x}{d}{x}$$$ $$$\frac{{1}}{{{\left({{x}}^{{2}}+{{y}}^{{2}}\right)}}^{{n}}},{n}>{1}$$$ $$$\frac{{{y}{d}{y}+{x}{d}{x}}}{{{\left({{x}}^{{2}}+{{y}}^{{2}}\right)}}^{{n}}}=-{d}{\left(\frac{{1}}{{{2}{\left({n}-{1}\right)}{{\left({{x}}^{{2}}+{{y}}^{{2}}\right)}}^{{{n}-{1}}}}}\right)}$$$
$$${a}{y}{d}{x}+{b}{x}{d}{y}$$$ ($$${a}$$$ and $$${b}$$$ are constants) $$${{x}}^{{{a}-{1}}}{{y}}^{{{b}-{1}}}$$$ $$${{x}}^{{{a}-{1}}}{{y}}^{{{b}-{1}}}{\left({a}{y}{d}{x}+{b}{x}{d}{y}\right)}={d}{\left({{x}}^{{a}}{{y}}^{{b}}\right)}$$$

In general, integrating factors are difficult to uncover. If a differential equation doesn't have one of the forms given above, searching for the integrating factor will likely be unsuccessful, and one should resort to other solution methods.