Exact equations arise in physics when a conservation principle is at work.
Exact Equations
Suppose we have a differential equation in the form $$ M(x,y)\,dx+N(x,y)\,dy=0 $$ Then the equation is exact if for some function $F(x,y),$ $$ \frac{\partial F}{\partial x}=M\,\,\,\,\mbox{and}\,\,\,\,\frac{\partial F}{\partial y}=N $$ Here $F$ is called a potential function.
Exact Equations
The thing to notice about an exact equation is that $$ \begin{array}{ll} dF&=\displaystyle \frac{\partial F}{\partial x}\,dx+\frac{\partial F}{\partial y}\,dy\\ &=M(x,y)\,dx+N(x,y)\,dy\\ &=0\\ \end{array} $$ That is, the total differential of the potential function $F$ is zero, which means that the solutions of the equation lie on the level curves of $F(x,y)=c.$
For this reason, $F$ is a conserved quantity.
A Quick Note
The expression $$M(x,y)\,dx+N(x,y)\,dy$$ is a type of expression called a differential form.
For Students with a Vector Calculus Background
For an exact equation $$ M(x,y)\,dx+N(x,y)\,dy=0 $$ the vector field $$ \langle M(x,y),N(x,y)\rangle $$ is conservative with $F$ as a potential function. That is, $$ \langle M,N\rangle=\nabla F $$ where $F(x,y)=c$ is family of implicit solutions to the equation.
Also, letting $d{\bf r}=\langle dx,dy\rangle,$ we can write an exact equation in vector form $$ \nabla F\cdot d{\bf r}=0 $$
Alternative Form
Another form of an exact equation $$ M(x,y)\,dx+N(x,y)\,dy=0 $$ is $$ M(x,y)+N(x,y)\frac{dy}{dx}=0 $$
Example
Solve the exact differential equation $$ \frac{dy}{dx}=-\frac{2xy^2+1}{2x^2y} $$
We shall rewrite the equation in the form
$$
(2xy^2+1)\,dx+2x^2y\,dy=0
$$
We take $M=2xy^2$ and $N=2x^2y$ and we seek a potential function $F(x,y)$ which satisfies
$$
\frac{\partial F}{\partial x}=M=2xy^2+1\,\,\,\,\mbox{and}\,\,\,\,\frac{\partial F}{\partial y}=N=2x^2y
$$
We shall attempt to "undo" the partial differentiation by performing a "partial integration."
That is, we shall integrate with one variable while considering the other to be a constant.
Let's begin with $x.$ We shall integrate $\displaystyle\frac{\partial F}{\partial x}=M=2xy^2+1$ with respect to $x$ while considering $y$ to be a constant. $$ F(x,y)=\int 2xy^2+1 \, dx=x^2y^2+x+h(y) $$ When we take a partial derivative with respect to $x$, any function of $y$ alone will vanish.
This explains the "constant" of integration which we have labelled as $h(y)$ in the above.
We now take the partial derivative of our theoretical $F(x,y)$ function with respect to $y.$
Since the equation is exact, the result should give us $N=2x^2y$ and we express this as $$ \frac{\partial F}{\partial y}=\frac{\partial }{\partial y}(x^2y^2+x+h(y))=N=2x^2y $$ Thus $$ \begin{array}{lll} &\displaystyle 2x^2y+h'(y)=2x^2y &\mbox{}\\ \implies &\displaystyle h'(y)=0&\mbox{}\\ \implies &\displaystyle h(y)=C&\mbox{}\\ \end{array} $$ Since the general solution of the equation in the family of curves $F(x,y)=c,$ we can take $C=0$ in the above.
We then have $$ F(x,y)=x^2y^2+x $$ A quick check shows that we have found our potential function. $$ \frac{\partial F}{\partial x}=2xy^2+1=M $$ and $$ \frac{\partial F}{\partial y}=2x^2y $$ Thus, our the general solution to the exact equation is given implicitly as $$ x^2y^2+x=c $$
Question: How would we verify that this solves the original equation?
That is, we shall integrate with one variable while considering the other to be a constant.
Let's begin with $x.$ We shall integrate $\displaystyle\frac{\partial F}{\partial x}=M=2xy^2+1$ with respect to $x$ while considering $y$ to be a constant. $$ F(x,y)=\int 2xy^2+1 \, dx=x^2y^2+x+h(y) $$ When we take a partial derivative with respect to $x$, any function of $y$ alone will vanish.
This explains the "constant" of integration which we have labelled as $h(y)$ in the above.
We now take the partial derivative of our theoretical $F(x,y)$ function with respect to $y.$
Since the equation is exact, the result should give us $N=2x^2y$ and we express this as $$ \frac{\partial F}{\partial y}=\frac{\partial }{\partial y}(x^2y^2+x+h(y))=N=2x^2y $$ Thus $$ \begin{array}{lll} &\displaystyle 2x^2y+h'(y)=2x^2y &\mbox{}\\ \implies &\displaystyle h'(y)=0&\mbox{}\\ \implies &\displaystyle h(y)=C&\mbox{}\\ \end{array} $$ Since the general solution of the equation in the family of curves $F(x,y)=c,$ we can take $C=0$ in the above.
We then have $$ F(x,y)=x^2y^2+x $$ A quick check shows that we have found our potential function. $$ \frac{\partial F}{\partial x}=2xy^2+1=M $$ and $$ \frac{\partial F}{\partial y}=2x^2y $$ Thus, our the general solution to the exact equation is given implicitly as $$ x^2y^2+x=c $$
Question: How would we verify that this solves the original equation?
General Method For Solving Exact Equations
To find an implicit family of curves $F(x,y)=c$ which solves the exact equation $$M(x,y)\,dx+N(x,y)\,dy=0$$ 1. Integrate $M$ with respect to $x.$ This results in a function of the form $g(x, y) + h(y),$ where $h(y)$ is unknown "constant" of integration.
2. Take the partial derivative of $g(x, y) + h(y)$ with respect to $y,$ which results in the function $g_y (x, y) + h'(y).$
3. Use the equation $g_y (x, y) + h'(y) = N(x, y)$ to find $h'(y).$
4. Integrate $h'(y)$ to find $h(y).$
5. Any function of the form $F (x, y) = g(x, y) + h(y)=c$ is an implicit solution to the equation.
Special Note
In the above process, we integrate $M$ with respect to $x$ first (with constant of integration $h(y)$) and then set partial derivative with respect to $y$ of the result equal to $N.$
We could just as easily integrate $N$ with respect to $y$ first (with constant of integration $h(x)$) and then set partial derivative with respect to $x$ of the result equal to $M.$
Test For Exactness
Not all equations which have the form $$M(x,y)\,dx+N(x,y)\,dy=0$$ are exact.
However, there is a test for exactness which enables us to make the distinction.
Test For Exactness
If the equation $$M(x,y)\,dx+N(x,y)\,dy=0$$ is exact, then $$ \frac{\partial F}{\partial x}=M\,\,\,\,\mbox{and}\,\,\,\,\frac{\partial F}{\partial y}=N $$ Now if the mixed partials of $F$ are continuous, then $$ \frac{\partial M}{\partial y}=\frac{\partial^2 F}{\partial y\partial x}=\frac{\partial^2 F}{\partial x\partial y}=\frac{\partial N}{\partial x} $$
Theorem (Test For Exactness)
If the first partial derivatives of $M(x,y)$ and $N(x,y)$ are continuous in a rectangle $R,$ then the equation $$M(x,y)\,dx+N(x,y)\,dy=0$$ is exact if and only if $$ \frac{\partial M}{\partial y}=\frac{\partial N}{\partial x} $$ for all $(x,y)$ in $R.$
Example
Use the Test for Exactness to verify the equation we just solved $$ (2xy^2+1)\,dx+2x^2y\,dy=0 $$ is exact.
Since
$$
\frac{\partial M}{\partial y}=4xy=\frac{\partial N}{\partial x}
$$
the equation is exact.
Example
Use the Test for Exactness to show $$ (2xy-\sec^2 x)\,dx+(x^2+2y)\,dy=0 $$ is exact and solve the equation.
Since
$$
\frac{\partial M}{\partial y}=2x=\frac{\partial N}{\partial x}
$$
the equation is exact.
We now find the general solution.
Integrating with respect to $x$ first, $$ F(x,y)=\int (2xy-\sec^2 x) \,dx=x^2y-\tan x+h(y) $$ Then $$ \frac{\partial F}{\partial y}=\frac{\partial }{\partial y}(x^2y-\tan x+h(y))=N=x^2+2y $$ so that $$ \begin{array}{lll} &\displaystyle x^2+h'(y)=x^2+2y&\mbox{}\\ \implies &\displaystyle h'(y)=2y&\mbox{}\\ \implies &\displaystyle h(y)=y^2&\mbox{}\\ \end{array} $$ Thus $$ F(x,y)=x^2y-\tan x+y^2 $$ A quick mental check show that we have found a potential function $F,$ an so we conclude that $$ x^2y-\tan x+y^2=c $$ is the implicit family of solutions to the original equation.
Scenic Alternative
Let's find the general solution by integrating $N$ with respect to $y$ first, $$ F(x,y)=\int x^2+2y \,dy=x^2y+y^2+h(x) $$ Then $$ \frac{\partial F}{\partial x}=\frac{\partial }{\partial x}(x^2y+y^2+h(x))=M=2xy-\sec^2 x $$ so that $$ \begin{array}{lll} &\displaystyle 2xy+h'(x)=2xy-\sec^2 x&\mbox{}\\ \implies &\displaystyle h'(x)=-\sec^2 x&\mbox{}\\ \implies &\displaystyle h(x)=-\tan x&\mbox{}\\ \end{array} $$ Thus $$ F(x,y)=x^2y+y^2+h(x)=x^2y+y^2-\tan x $$ A quick mental check show that we have found a potential function $F,$ an so we conclude that $$ x^2y-\tan x+y^2=c $$ which is the same solution we obtained above.
We now find the general solution.
Integrating with respect to $x$ first, $$ F(x,y)=\int (2xy-\sec^2 x) \,dx=x^2y-\tan x+h(y) $$ Then $$ \frac{\partial F}{\partial y}=\frac{\partial }{\partial y}(x^2y-\tan x+h(y))=N=x^2+2y $$ so that $$ \begin{array}{lll} &\displaystyle x^2+h'(y)=x^2+2y&\mbox{}\\ \implies &\displaystyle h'(y)=2y&\mbox{}\\ \implies &\displaystyle h(y)=y^2&\mbox{}\\ \end{array} $$ Thus $$ F(x,y)=x^2y-\tan x+y^2 $$ A quick mental check show that we have found a potential function $F,$ an so we conclude that $$ x^2y-\tan x+y^2=c $$ is the implicit family of solutions to the original equation.
Scenic Alternative
Let's find the general solution by integrating $N$ with respect to $y$ first, $$ F(x,y)=\int x^2+2y \,dy=x^2y+y^2+h(x) $$ Then $$ \frac{\partial F}{\partial x}=\frac{\partial }{\partial x}(x^2y+y^2+h(x))=M=2xy-\sec^2 x $$ so that $$ \begin{array}{lll} &\displaystyle 2xy+h'(x)=2xy-\sec^2 x&\mbox{}\\ \implies &\displaystyle h'(x)=-\sec^2 x&\mbox{}\\ \implies &\displaystyle h(x)=-\tan x&\mbox{}\\ \end{array} $$ Thus $$ F(x,y)=x^2y+y^2+h(x)=x^2y+y^2-\tan x $$ A quick mental check show that we have found a potential function $F,$ an so we conclude that $$ x^2y-\tan x+y^2=c $$ which is the same solution we obtained above.
Example
Use the Test for Exactness to show $$ (x+3x^3\sin y)\,dx+(x^4\cos y)\,dy=0 $$ is NOT exact.
Since
$$
\frac{\partial M}{\partial y}=\frac{\partial }{\partial y}(x+3x^3\sin y)=3x^3\cos y
$$
$$
\frac{\partial N}{\partial x}=\frac{\partial }{\partial x}(x^4\cos y)=4x^3\cos y
$$
Since
$$
\frac{\partial M}{\partial y}\neq \frac{\partial N}{\partial x}
$$
the equation is not exact.
Test For Exactness (Vector-Calculus Version)
If the first partial derivatives of $M(x,y)$ and $N(x,y)$ are continuous in a rectangle $R,$ then the equation $$M(x,y)\,dx+N(x,y)\,dy=0$$ is exact if and only if $$ \mbox{curl }\langle M,N,0\rangle \cdot {\bf k}=0 $$ for all $(x,y)$ in $R.$
Example
Determine if the equation $$ -\frac{y}{x^2+y^2}\,dx+\frac{x}{x^2+y^2}\,dy $$ is exact.
We see that
$$
\begin{array}{lll}
\displaystyle \frac{\partial M}{\partial y}&\displaystyle=\frac{\partial }{\partial y} \left(-\frac{y}{x^2+y^2}\right)&\mbox{}\\
\displaystyle &\displaystyle=-\frac{(x^2+y^2)\cdot 1-y\cdot (2y)}{(x^2+y^2)^2} &\mbox{}\\
\displaystyle &\displaystyle=-\frac{x^2+y^2-2y^2}{(x^2+y^2)^2} &\mbox{}\\
\displaystyle &\displaystyle=-\frac{x^2-y^2}{(x^2+y^2)^2} &\mbox{}\\
\displaystyle &\displaystyle=\frac{y^2-x^2}{(x^2+y^2)^2} &\mbox{}\\
\end{array}
$$
and
$$
\begin{array}{lll}
\displaystyle \frac{\partial N}{\partial x}&\displaystyle=\frac{\partial }{\partial x}\frac{x}{x^2+y^2} &\mbox{}\\
\displaystyle &\displaystyle=\frac{(x^2+y^2)\cdot 1-x\cdot (2x)}{(x^2+y^2)^2} &\mbox{}\\
\displaystyle &\displaystyle=\frac{x^2+y^2-2x^2}{(x^2+y^2)^2} &\mbox{}\\
\displaystyle &\displaystyle=\frac{y^2-x^2}{(x^2+y^2)^2} &\mbox{}\\
\end{array}
$$
That is,
$$
\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}
$$
Conclusion????????????????
Whoa there, Tiger!
Not so fast!
The origin is a point of discontinuity of the partial derivatives $$ \frac{\partial M}{\partial y}\,\,\,\,\mbox{and}\,\,\,\,\frac{\partial N}{\partial x} $$ So, even if we exclude the origin from our domain, there are still issues.
Consider the line integral in the vector field $\displaystyle \left\langle-\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right \rangle$ along the unit circle centered at the origin, oriented counter clockwise. $$ \begin{array}{lll} \displaystyle \displaystyle \oint_{C} -\frac{y}{x^2+y^2}\,dx+\frac{x}{x^2+y^2}\,dy&=\displaystyle \oint_{C} \left\langle -\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right \rangle \cdot \langle dx, dy\rangle&\mbox{}\\ \displaystyle &\displaystyle=\oint_{C} {\bf F} \cdot d{\bf r}&\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} {\bf F}({\bf r}(t)) \cdot \frac{d{\bf r}}{dt}\,dt&\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \left\langle-\frac{y(t)}{x(t)^2+y(t)^2},\frac{x(t)}{x(t)^2+y(t)^2}\right \rangle \cdot \langle -\sin t, \cos t\rangle \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \left\langle-\frac{\sin t}{\cos^2 t+\sin^2 t},\frac{\cos t}{\cos^2 t+\sin^2 t}\right \rangle \cdot \langle -\sin t, \cos t\rangle \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \left\langle-\sin t,\cos t\right \rangle \cdot \langle -\sin t, \cos t\rangle \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \sin^2 t+\cos^2 t \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} 1 \,dt &\mbox{}\\ \displaystyle &\displaystyle=2\pi &\mbox{}\\ \end{array} $$ This proves that the vector field $\displaystyle \left\langle-\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right \rangle$ is NOT a conservative vector field in a rectangular domain $R$ which contains the point $(0,0).$
That is, the equation $$ -\frac{y}{x^2+y^2}\,dx+\frac{x}{x^2+y^2}\,dy=0 $$ is NOT exact if we're solving on a rectangle $R$ which contains the origin.
The Moral of the Story
If you haven't had a course in vector calculus, don't worry too much about it.
Just be careful when using heavy machinery.
That is, when you're wielding the mighty power of a Theorem, please make sure the hypotheses are satisfied.
Whoa there, Tiger!
Not so fast!
The origin is a point of discontinuity of the partial derivatives $$ \frac{\partial M}{\partial y}\,\,\,\,\mbox{and}\,\,\,\,\frac{\partial N}{\partial x} $$ So, even if we exclude the origin from our domain, there are still issues.
Consider the line integral in the vector field $\displaystyle \left\langle-\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right \rangle$ along the unit circle centered at the origin, oriented counter clockwise. $$ \begin{array}{lll} \displaystyle \displaystyle \oint_{C} -\frac{y}{x^2+y^2}\,dx+\frac{x}{x^2+y^2}\,dy&=\displaystyle \oint_{C} \left\langle -\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right \rangle \cdot \langle dx, dy\rangle&\mbox{}\\ \displaystyle &\displaystyle=\oint_{C} {\bf F} \cdot d{\bf r}&\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} {\bf F}({\bf r}(t)) \cdot \frac{d{\bf r}}{dt}\,dt&\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \left\langle-\frac{y(t)}{x(t)^2+y(t)^2},\frac{x(t)}{x(t)^2+y(t)^2}\right \rangle \cdot \langle -\sin t, \cos t\rangle \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \left\langle-\frac{\sin t}{\cos^2 t+\sin^2 t},\frac{\cos t}{\cos^2 t+\sin^2 t}\right \rangle \cdot \langle -\sin t, \cos t\rangle \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \left\langle-\sin t,\cos t\right \rangle \cdot \langle -\sin t, \cos t\rangle \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} \sin^2 t+\cos^2 t \,dt &\mbox{}\\ \displaystyle &\displaystyle=\int_0^{2\pi} 1 \,dt &\mbox{}\\ \displaystyle &\displaystyle=2\pi &\mbox{}\\ \end{array} $$ This proves that the vector field $\displaystyle \left\langle-\frac{y}{x^2+y^2},\frac{x}{x^2+y^2}\right \rangle$ is NOT a conservative vector field in a rectangular domain $R$ which contains the point $(0,0).$
That is, the equation $$ -\frac{y}{x^2+y^2}\,dx+\frac{x}{x^2+y^2}\,dy=0 $$ is NOT exact if we're solving on a rectangle $R$ which contains the origin.
The Moral of the Story
If you haven't had a course in vector calculus, don't worry too much about it.
Just be careful when using heavy machinery.
That is, when you're wielding the mighty power of a Theorem, please make sure the hypotheses are satisfied.
Integrating Factors
If the Test for Exactness fails for an equation $$M(x,y)\,dx+N(x,y)\,dy=0$$ not all hope is lost.
There might still be a way to transform it into an equation which is exact.
We shall consider a case for when we might be able to find an integrating factor $\mu$ which will result in an exact equation.
Integrating Factors
Let's consider an equation $$ M(x,y)\,dx+N(x,y)\,dy=0 $$ which might not be exact.
We want to find an integrating factor $\mu(x,y)$ such that $$ \mu(x,y)M(x,y)\,dx+\mu(x,y)N(x,y)\,dy=0 $$ is exact.
Note that any solution to second equation is a solution to the original.
Also note that some solutions can be lost along the way.
Integrating Factors
If the integrating factor $\mu(x,y)$ does what we hope it will do, then $$ \mu(x,y)M(x,y)\,dx+\mu(x,y)N(x,y)\,dy=0 $$ is will be exact
It follows from the Test for Exactness that $$ \frac{\partial}{\partial y}\left[\mu(x,y)M(x,y)\right]=\frac{\partial}{\partial x}\left[\mu(x,y)N(x,y)\right] $$ must hold.
Integrating Factors
Then from the product rule we have $$ \begin{array}{lll} &\displaystyle \frac{\partial \mu}{\partial y}M(x,y)+\frac{\partial M}{\partial y}\mu(x,y)=\frac{\partial \mu}{\partial x}N(x,y)+\frac{\partial N}{\partial x}\mu(x,y) &\mbox{}\\ \implies &\displaystyle M\frac{\partial \mu}{\partial y}-N\frac{\partial \mu}{\partial x}=\frac{\partial N}{\partial x}\mu(x,y)-\frac{\partial M}{\partial y}\mu(x,y)&\mbox{}\\ \implies &\displaystyle M\frac{\partial \mu}{\partial y}-N\frac{\partial \mu}{\partial x}=\left(\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}\right)\mu&\mbox{}\\ \end{array} $$
Integrating Factors
This last equation (a partial differential equation!) $$ M\frac{\partial \mu}{\partial y}-N\frac{\partial \mu}{\partial x}=\left(\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}\right)\mu $$ is not easy to solve in general.
However, as a simplifying assumption, let's suppose $\mu$ is a function of $x$ alone.
Then the above becomes $$ -N\frac{d\mu}{dx}=\left(\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}\right)\mu $$ or $$ \frac{d\mu}{dx}=\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}\mu $$
Integrating Factors
Rewriting $$ \frac{d\mu}{dx}=\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}\mu $$ as $$ \frac{d\mu}{dx}=\frac{M_y-N_x}{N}\mu $$ and assuming that $\displaystyle \frac{M_y-N_x}{N}$ is a function of $x$, we separate variables $$ \frac{d\mu}{\mu}=\frac{M_y-N_x}{N}\, dx $$ and integrate $$ \ln \mu(x)=\int \frac{M_y-N_x}{N}\, dx $$
Integrating Factors
The result is $$ \mu(x)=e^{\int \frac{M_y-N_x}{N}\,dx} $$ By a similar argument, if we assume $\mu$ is a function of only $y,$ we obtain $$ \mu(y)=e^{\int \frac{N_x-M_y}{M}\,dy} $$
Example
Using the Test for Exactness, we saw that the equation $$ (x+3x^3\sin y)\,dx+(x^4\cos y)\,dy=0 $$ is not exact.
Find an integrating factor which transforms the equation into an exact equation and solve.
If
$$
\frac{M_y-N_x}{N}
$$
is a function of $x$ alone, or
$$
\frac{N_x-M_y}{M}
$$
is a function of $y$ alone, then we can find an integrating factor.
We begin with $$ \begin{array}{ll} \displaystyle \frac{M_y-N_x}{N}&=\displaystyle \frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}\\ &=\displaystyle\frac{\frac{\partial }{\partial y}(x+3x^3\sin y)-\frac{\partial }{\partial x}(x^4\cos y)}{x^4\cos y}\\ &=\displaystyle\frac{(3x^3\cos y)-(4x^3\cos y)}{x^4\cos y}\\ &=\displaystyle\frac{-x^3\cos y}{x^4\cos y}\\ &=\displaystyle-\frac{1}{x}\\ \end{array} $$ This is a function of $x$ alone! Yes!
Now we find the integrating factor $$ \begin{array}{lll} \displaystyle \mu(x)&\displaystyle=e^{\int \frac{M_y-N_x}{N}\,dx} &\mbox{}\\ \displaystyle &\displaystyle=e^{\int -\frac{1}{x}\,dx} &\mbox{}\\ \displaystyle &\displaystyle=e^{-\ln x} &\mbox{}\\ \displaystyle &\displaystyle=e^{\ln x^{-1}} &\mbox{}\\ \displaystyle &\displaystyle=x^{-1} &\mbox{}\\ \end{array} $$ We now multiply the original equation through by the integrating factor. $$ \begin{array}{lll} &\displaystyle x^{-1}\left[(x+3x^3\sin y)\,dx+(x^4\cos y)\,dy\right]=x^{-1}\cdot0&\mbox{}\\ \implies &\displaystyle (1+3x^2\sin y)\,dx+(x^3\cos y)\,dy=0 &\mbox{}\\ \end{array} $$ For this new, transformed equation, we let $M=1+3x^2\sin y$ and $N=x^3\cos y.$
Testing for exactness, $$ \frac{\partial M}{\partial y}=\frac{\partial }{\partial y}(1+3x^2\sin y)=3x^2\cos y=\frac{\partial }{\partial x}(x^3\cos y)=\frac{\partial N}{\partial x} $$ we see that we now have an exact equation.
Let's solve it!
Integrating $1+3x^2\sin y$ with respect to $x,$ $$ F(x,y)=\int 1+3x^2\sin y \,dx=x+x^3\sin y+h(y) $$ Then $$ \frac{\partial F}{\partial y}=\frac{\partial }{\partial y}(x+x^3\sin y+h(y))=N=x^3\cos y $$ so that $$ \begin{array}{lll} &\displaystyle x^3\cos y+h'(y)=x^3\cos y&\mbox{}\\ \implies &\displaystyle h'(y)=0&\mbox{}\\ \end{array} $$ Since potential functions $F$ are unique up to a constant, we'll just say that $h(y)=0.$
Then $$ F(x,y)=x+x^3\sin y+h(y)=x+x^3\sin y. $$ Thus, our general solution is given by $$ x+x^3\sin y=c $$
Important Note: When we multiplied the original equation by $x^{-1},$ we eliminated the solution $x \equiv 0$ from consideration.
We should always go back and check for solutions we might have left behind. In this case, $x \equiv 0$ is also a solution.
We begin with $$ \begin{array}{ll} \displaystyle \frac{M_y-N_x}{N}&=\displaystyle \frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}\\ &=\displaystyle\frac{\frac{\partial }{\partial y}(x+3x^3\sin y)-\frac{\partial }{\partial x}(x^4\cos y)}{x^4\cos y}\\ &=\displaystyle\frac{(3x^3\cos y)-(4x^3\cos y)}{x^4\cos y}\\ &=\displaystyle\frac{-x^3\cos y}{x^4\cos y}\\ &=\displaystyle-\frac{1}{x}\\ \end{array} $$ This is a function of $x$ alone! Yes!
Now we find the integrating factor $$ \begin{array}{lll} \displaystyle \mu(x)&\displaystyle=e^{\int \frac{M_y-N_x}{N}\,dx} &\mbox{}\\ \displaystyle &\displaystyle=e^{\int -\frac{1}{x}\,dx} &\mbox{}\\ \displaystyle &\displaystyle=e^{-\ln x} &\mbox{}\\ \displaystyle &\displaystyle=e^{\ln x^{-1}} &\mbox{}\\ \displaystyle &\displaystyle=x^{-1} &\mbox{}\\ \end{array} $$ We now multiply the original equation through by the integrating factor. $$ \begin{array}{lll} &\displaystyle x^{-1}\left[(x+3x^3\sin y)\,dx+(x^4\cos y)\,dy\right]=x^{-1}\cdot0&\mbox{}\\ \implies &\displaystyle (1+3x^2\sin y)\,dx+(x^3\cos y)\,dy=0 &\mbox{}\\ \end{array} $$ For this new, transformed equation, we let $M=1+3x^2\sin y$ and $N=x^3\cos y.$
Testing for exactness, $$ \frac{\partial M}{\partial y}=\frac{\partial }{\partial y}(1+3x^2\sin y)=3x^2\cos y=\frac{\partial }{\partial x}(x^3\cos y)=\frac{\partial N}{\partial x} $$ we see that we now have an exact equation.
Let's solve it!
Integrating $1+3x^2\sin y$ with respect to $x,$ $$ F(x,y)=\int 1+3x^2\sin y \,dx=x+x^3\sin y+h(y) $$ Then $$ \frac{\partial F}{\partial y}=\frac{\partial }{\partial y}(x+x^3\sin y+h(y))=N=x^3\cos y $$ so that $$ \begin{array}{lll} &\displaystyle x^3\cos y+h'(y)=x^3\cos y&\mbox{}\\ \implies &\displaystyle h'(y)=0&\mbox{}\\ \end{array} $$ Since potential functions $F$ are unique up to a constant, we'll just say that $h(y)=0.$
Then $$ F(x,y)=x+x^3\sin y+h(y)=x+x^3\sin y. $$ Thus, our general solution is given by $$ x+x^3\sin y=c $$
Important Note: When we multiplied the original equation by $x^{-1},$ we eliminated the solution $x \equiv 0$ from consideration.
We should always go back and check for solutions we might have left behind. In this case, $x \equiv 0$ is also a solution.