I have seen one method which correctly evaluates $P=\frac{2x^2-1}{x(1-x^2)}$.
But I have seen a method that says if $\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}$ is a function of just x ,i.e, it is equal to f(x) then its
Integrating Factor (IF)=$e^{\int f(x)dx}$
Here M=$2x^2y-y-ax^3$ and N=$x(1-x^2)$
So, $\frac{\partial M}{\partial y}=2x^2-1$ and $\frac{\partial N}{\partial x}=1-3x^2$
Hence, $$\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}=\;\;\frac{5x^2-2}{x(1-x^2)}$$
Here's the link to the first method: https://haygot.s3.amazonaws.com/questions/1374381_1134731_ans_55dd44fc75824f228cd5c8286c3144f1.jpg
Please tell why the answer is not matching.