Trigonometric integrals How do I evaluate this indefinite integral ?  Integral $$\int\frac{x^2+n(n-1)}{(x\sin(x)+n\cos(x))^2}dx$$ What type of integral is it ? Is there any intuition involved in the approach to solve it?
Edit: The complete term in denominator has 2 as exponent. There was a typo previously.
 A: $\bf{My\; Solution:}$ Using $$\displaystyle (x\cdot \sin x+n\cdot \cos x) = \sqrt{x^2+n^2}\left\{\frac{x}{\sqrt{x^2+n^2}}\cdot \sin x+\frac{n}{\sqrt{x^2+n^2}}\cdot \cos x\right\}$$
$$\displaystyle = \sqrt{x^2+n^2}\cdot \cos\left(x-\phi\right)\;,$$ where $$\displaystyle \sin \phi = \frac{x}{\sqrt{x^2+n^2}}$$ and $$\displaystyle \cos \phi = \frac{n}{\sqrt{x^2+n^2}}$$ and $$\displaystyle \tan \phi = \frac{x}{n}\Rightarrow \phi = \tan^{-1}\left(\frac{x}{n}\right)$$
So Integral is $$\displaystyle = \int \sec^2(x-\phi)\cdot \left(\frac{x^2+n(n-1)}{x^2+n^2}\right)dx$$
Now Let $$\displaystyle (x-\phi) = y\Rightarrow \left(x-\tan^{-1}\left(\frac{x}{n}\right)\right)=y.$$ Then $$\displaystyle \left(\frac{x^2+n(n-1)}{x^2+n^2}\right)dx = dy$$
So Integral is $$\displaystyle \int \sec^2(y)dy = \tan y +\mathbb{C} = \tan\left(x-\tan^{-1}\left(\frac{x}{n}\right)\right)+\mathcal{C}$$
So $$\displaystyle \int \frac{x^2+n(n-1)}{(x\cdot \sin x+n\cdot \cos x)^2}dx = \left(\frac{n\cdot \tan x-x}{n+x\cdot \tan x}\right)+\mathcal{C}.$$
A: $\bf{Another\;  Solution::}$ Given $$\displaystyle \int\frac{x^2+n(n-1)}{\left(x\sin x+n\cos x\right)^2}dx\;,$$ Now Multiply both $\bf{N_{r}}$ and $\bf{D_{r}}$
by $x^{2n-2};,$ We Get $$\displaystyle \int\frac{\left[x^{2}+n(n-1)\right]\cdot x^{2n-2}}{\left(x^{n}\sin x+nx^{n-1}\cos x\right)^2}dx$$
Now Let $$x^n\sin x+nx^{n-1}\cos x = t\;,$$ Then
$$\left[nx^{n-1}\sin x+\cos x\cdot x^{n}-nx^{n-1}\sin x+\cos x\cdot n(n-1)x^{n-2}\right]dx = dt$$
So We get $$\displaystyle x^{n-2}\cdot \cos x \cdot \left[x^2+n(n-1)\right]dx = dt.$$
So Our Integral Convert into $$\displaystyle \int \underbrace{x^{n}\sec x }_{\bf{1^{st}\; fun.}}\cdot \underbrace{\frac{x^{n-2}\cdot\cos x\cdot [x^2+n(n-1)] }{\left(x^2\sin x+nx^{n-1}\cos x\right)^2}}_{\bf{II^{nd}\; fun.}}dx$$
Now Using Integration by Parts, We Get
$$\displaystyle = -x^2\sec x\cdot \frac{1}{\left(x^n\sin x+nx^{n-1}\cos x\right)}+\int \frac{x^n\sec x\cdot \tan x+\sec x\cdot nx^{n-1}}{\left(x^n\sin x+nx^{n-1}\cos x \right)}dx$$
After Simplifying The second Integral, We Get
$$\displaystyle = -\frac{x^2\sec x}{\left(x^n\sin x+nx^{n-1}\cos x \right)}+\int \sec^2 xdx$$
So We Get $$\displaystyle \int\frac{x^2+n(n-1)}{(x\sin x+n\cos x)^2}dx = -\frac{x^n\sec x}{\left(x^n\sin x+nx^{n-1}\cos x \right)}+\tan x+\mathcal{C}$$
