$$\int {\dfrac{x^2+\left(n-1\right)n}{\left(x\sin\left(x\right)+n\cos\left(x\right)\right)^2}}dx $$
My Try:
I multiple $x^{2n-2}$ to both N and D, then took D as $u$ and then solved to get $\dfrac{n\sin\left(x\right)-x\cos\left(x\right)}{x\sin\left(x\right)+n\cos\left(x\right)} + C$ as answer.
My teacher told that this would have been much easier if we had applied linearity and written question as
$={\displaystyle\int}\dfrac{x\sin\left(x\right)+\left(n-1\right)\cos\left(x\right)}{x\sin\left(x\right)+n\cos\left(x\right)}\,\mathrm{d}x-{\displaystyle\int}\dfrac{\left(\left(1-n\right)\sin\left(x\right)+x\cos\left(x\right)\right)\left(n\sin\left(x\right)-x\cos\left(x\right)\right)}{\left(x\sin\left(x\right)+n\cos\left(x\right)\right)^2}\,\mathrm{d}x$
I didn't get it, how did we write the above statement? I mean, please explain the method or steps for reaching to this part.