To be exact, the term in front of dx must be

and the term in front of dy must be , WHERE the bottom line is to find that .

Ignore the silly N and M in must books, it's foolish.

Next from Clarabell's theorem

and in our case that's correct, we get in both cases.

So, it's exact. Hence integrate the wrt x

and wrt y to get this and when you integrate, don't just add +C

in the first case it's and the second it's .