Solving a first order differential equation by finding an integrating factor : Edit Problem:
Solve the following differential equations by first finding an integrating factor.
$$ (y^2(x+1) + y ) \, dx + ( 2xy + 1 ) \, dy = 0 $$
Answer:
\begin{align*}
M_y &= 2(x+1)y + 1 = 2xy + 2y + 1 \\
N_x &= 2y \\
\frac{1}{N(x,y)} \left[ \frac{\partial M(x,y)}{\partial y} - \frac{\partial N(x,y)}{\partial x} \right] &= 
 \frac{ 2xy + 2y + 1 - 2y } { 2xy + 1 } \\
\frac{1}{N(x,y)} \left[ \frac{\partial M(x,y)}{\partial y} - \frac{\partial N(x,y)}{\partial x} \right] &= 
 \frac{ 2xy  + 1  } { 2xy + 1 } = 1 \\
\end{align*}
This means that:
$$ e ^ { \int \frac{1}{N(x,y)} \left[ \frac{\partial M(x,y)}{\partial y} - \frac{\partial N(x,y)}{\partial x} \right] \, dx } $$
is the integrating factor we seek. Call this integrating factor $I$.
\begin{align*}
I &= e ^ { \int 1 \, dx }  = e^x \\
(y^2(x+1) + y ) e^x \, dx + ( 2xy + 1 ) e^x \, dy &= 0
\end{align*}
Now we have:
\begin{align*}
M &= (y^2(x+1) + y ) e^x  \\
M_y &= ( 2(x+1)y + 1 )e^x = ( 2xy + 2y + 1)e^x \\
N &= ( 2xy + 1 ) e^x \\
N_x &= ( 2xy + 1 ) e^x
\end{align*}
As I understand it, I was suppose to get $M_y = N_x$. That is, the de should have been exact. What did I do wrong?
Now, I have an updated answer. However, It is still wrong. I feel I am much closer to the right answer. Here is my updated answer:
\begin{align*}
M_y &= 2(x+1)y + 1 = 2xy + 2y + 1 \\
N_x &= 2y \\
\frac{1}{N(x,y)} \left[ \frac{\partial M(x,y)}{\partial y} - \frac{\partial N(x,y)}{\partial x} \right] &= 
 \frac{ 2xy + 2y + 1 - 2y } { 2xy + 1 } \\
\frac{1}{N(x,y)} \left[ \frac{\partial M(x,y)}{\partial y} - \frac{\partial N(x,y)}{\partial x} \right] &= 
 \frac{ 2xy  + 1  } { 2xy + 1 } = 1 \\
\end{align*}
This means that:
$$ e ^ { \int \frac{1}{N(x,y)} \left[ \frac{\partial M(x,y)}{\partial y} - \frac{\partial N(x,y)}{\partial x} \right] \, dx } $$
is the integrating factor we seek. Call this integrating factor $I$.
\begin{align*}
I &= e ^ { \int 1 \, dx }  = e^x \\
(y^2(x+1) + y ) e^x \, dx + ( 2xy + 1 ) e^x \, dy &= 0
\end{align*}
Now we have:
\begin{align*}
M &= (y^2(x+1) + y ) e^x  \\
M_y &= ( 2(x+1)y + 1 )e^x = ( 2xy + 2y + 1)e^x \\
N &= ( 2xy + 1 ) e^x \\
N_x &= ( 2xy + 1 ) e^x + (2y)e^x = (2xy + 2y + 2)e^x1
\end{align*}
Hence the differential equation is exact. We have:
\begin{align*}
F_x &= (y^2(x+1) + y ) e^x \\
F &= \int (y^2(x+1) + y ) e^x \, dx = \int (x y^2 + y^2 + 1 ) e^x \, dx
\end{align*}
Recall that:
$$ \int x e^x \, dx = x e^x - e^x + C $$
\begin{align*}
F &= y^2 \int xe^x \, dx + (y^2+1) \int e^x \, dx \\
F &= y^2 ( xe^x - e^x) + (y^2 + 1)e^x + \phi(y) \\
F &= y^2 xe^x - y^2 e^x + y^2 e^x + e^x + \phi(y) \\
F &= y^2 xe^x + e^x + \phi(y) \\
F_y &= 2xy e^x + \phi'(y)  \\
2xy e^x + \phi'(y) &= ( 2xy + 1 ) e^x \\
\phi'(y) &= e^x \\
\phi(y) &= ye^x + c \\
F &=  y^2 xe^x + e^x +  ye^x + c 
\end{align*}
However, the book gets:
$$ x y^2 e^x + y e^x = c $$
Where did I go wrong?
Problem:
Solve the following differential equations first finding an integrating factor.
$$ ( 5xy + 4y^2 + 1 ) \, dx + ( x^2 + 2xy  ) \, dy = 0 $$
Answer:
Now, I try $x^3$ as an integrating factor. This gives me:
$$ ( 5x^4 y + 4 x^3 y^2 + x^3 ) \, dx + ( x^5 + 2x^4 y  ) \, dy = 0 $$
Now, we see if it is exact.
\begin{align*}
M_y &= 5x^4 + 8 x^3 y \\
N_x &= 5x^4 + 8 x^3 y
\end{align*}
The equation is exact. Let $F$ be the solution we seek:
\begin{align*}
F_x &= 5x^4 y + 4 x^3 y^2 + x^3 \\
F &= x^5 y + x^4 y^2 + \frac{x^4}{4} + \phi(y) \\
F_y &= 5x^4 + 2x^4 y + \phi'(y) =  x^5 + 2x^4 y \\
\phi'(y) &= 0 \\
\phi(y &= C
\end{align*}
Hence the solution we seek is:
$$  4x^5 y + 4x^4 y^2 + x^4 + C = 0 $$
Where did I go wrong?

Everything looks good up to the last formula, you missed there one factor in the product rule for $N_x$:
$$
N_x=(2xy+1)_xe^x+(2xy+1)(e^x)_x=(2y)e^x+(2xy+1)e^x,
$$
restoring the needed equality $M_y=N_x$.
