first order exact ODE's. How does one determine correct arrangement of the form $M dx+N dy=0$ How does one know which form to use to obtain an exact ODE?
It turned out that how the ODE is written makes a difference for checking if
it is exact or not. For example, given the ODE
\begin{equation}
\frac{dy}{dx}=-\frac{y}{x}\tag{1}
\end{equation}
Now the ODE is put  in standard form $Mdx+Ndy=0$, to check if it exact, by
checking if $\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$.
(the above is of course separable ODE also, but I am now just looking at the
test for exact).
If (1) is written as
$$
ydx+xdy=0
$$
Where now $M=y$ and $N=x$ and $\frac{\partial M}{\partial y}=\frac{\partial
N}{\partial x}=1$, so it is exact. But (1) can also just as well be written
as 
$$
\frac{y}{x}dx+dy=0
$$
Where now $M=\frac{y}{x}$ and $N=1.$ Therefore $\frac{\partial M}{\partial
y}=\frac{1}{x}$ and $\frac{\partial N}{\partial x}=0$. so one will conclude
that the ODE is not exact. But this is because different way to
write it was used.
Most books that asks to show if the ODE is exact, give the problem
already written in the standard form 
$$
Mdx+Ndy=0
$$
So one does not have to decide what is $M$ and $N$. But if the ODE is given
in the general form $y^{\prime}=f\left(  x,y\right)  $ then it is not as
clear. The wrong choice of writing the ODE can lead one to conclude it is not
exact, when it is. It can get complicated quickly to know how to pick for $M$
and $N$. For example, given this ODE
\begin{equation}
\frac{dy}{dx}=-\frac{y^{2}\arctan\left(  y\right)  +y^{2}x+\arctan\left(
y\right)  +x}{x+y}\tag{2}
\end{equation}
Is this exact or not? Well, one starts by writing it in standard form for
exact check. If it is written as 
$$
(y^{2}\arctan\left(  y\right)  +y^{2}x+\arctan\left(  y\right)  +x)dx+\left(
x+y\right)  dy=0
$$
Where now
\begin{align*}
M  & =(y^{2}\arctan\left(  y\right)  +y^{2}x+\arctan\left(  y\right)  +x)\\
N  & =x+y
\end{align*}
Then the answer is, it is NOT exact because now
\begin{align*}
\frac{\partial M}{\partial y}  & =2y\arctan\left(  y\right)  +2yx+1\\
\frac{\partial N}{\partial x}  & =1
\end{align*}
And since $\frac{\partial M}{\partial y}\neq\frac{\partial N}{\partial x}$,
then one will say it is not exact. However, if one where to write (2) as
\begin{align*}
\frac{dy}{dx}  & =-\frac{\left(  x+\arctan\left(  y\right)  \right)  \left(
1+y^{2}\right)  }{x+y}\\
& =-\left(  x+\arctan\left(  y\right)  \right)  \left(  \frac{1+y^{2}}
{x+y}\right)
\end{align*}
Which is the still the same as (2), and now convert it to $Mdx+Ndy=0$ as
$$
\left(  x+\arctan\left(  y\right)  \right)  dx+\left(  \frac{x+y}{1+y^{2}
}\right)  dy=0
$$
And now
\begin{align*}
M  & =x+\arctan\left(  y\right)  \\
N  & =\frac{x+y}{1+y^{2}}
\end{align*}
The check now shows it is exact
\begin{align*}
\frac{\partial M}{\partial y}  & =\frac{1}{1+y^{2}}\\
\frac{\partial N}{\partial x}  & =\frac{1}{1+y^{2}}
\end{align*}
So you see. The same ODE, using the correct arrangements of terms,
the test can come out to be exact. So the ODE it exact. But it depends on how
it is written.
The question is, how does one know how to obtain the correct form then?
Trial and error is not possible. Is there an algorithm to apply?
Before, I thought it did not make any difference how one chooses how to
rewrite the ODE in $Mdx+Ndy=0$ form. But it seems to make a difference as
shown in the above examples.
A good reference is http://tutorial.math.lamar.edu/Classes/DE/Exact.aspx
 A: $ydx+xdy=0 \tag 1$
$M=y$ and $N=x$ and $\frac{\partial M}{\partial y}=\frac{\partial
N}{\partial x}=1$, so Eq.$(1)$ is exact. 
$\frac{y}{x}dx+dy=0 \tag 2$
$M=\frac{y}{x}$ and $N=1.$ Therefore $\frac{\partial M}{\partial
y}=\frac{1}{x}$ and $\frac{\partial N}{\partial x}=0$, so Eq.$(2)$ is not exact.
To make exact Eq.$(2)$, one have to multiply it by an integrating factor which is $x$ in this case :
$x\left(\frac{y}{x}dx+dy=0\right)=ydx+xdy=0$
Now, the equation is exact.
Of course, $(1)$ and $(2)$ are related to a same equation $(3)$ :
$\frac{dy}{dx}=-\frac{y}{x} \tag 3$
But don't confuse $(1)$ , $(2)$ and $(3)$. They are not identical equations. They are related by multiplying them by factors. It is normal that one of them is an exact differential and the others not exact differential.
The purpose of the game is to find a convenient factor called "integrating factor" such as a given non exact ODE becomes a different ODE which is then an exact ODE.
SECOND EXAMPLE :
$(y^2\arctan(y)+y^2x+\arctan(y)+x)dx+(x+y)dy=0 \tag 4$
The integrating factor is $\frac{1}{1+y^2}$.
If one multiply Eq.$(4)$ by $\frac{1}{1+y^2}$ he obtains after simplification :
$(x+\arctan(y))dx+\frac{x+y}{1+y^2}dy=0 \tag 5$
which is exact.
