# An indefinite Integral Problem with algebric numerator and trigonometric denominator

$$\int \frac{x^2+(n(n-1))}{(x\sin x +n\cos x)^2 } dx$$ I know this is an homework problem, but I really couldn't think of any way to solve it. Like DI Method (No go) , What kind of substitution as denominator is trigonometric whereas Numerator is algebric. Thought of n(n-1) can come by double differentiating but.. like how would we have it here ... etc confusing and weird thoughts. Please help me out

• It is $$\frac{n \sin (x)-x \cos (x)}{n \cos (x)+x \sin (x)}+C$$ – Dr. Sonnhard Graubner May 19 at 6:10
• @Dr.SonnhardGraubner How ?? Please show /tell the working and thought process – user232243 May 19 at 6:16
• Integration by parts might help, after some manipulation. – arya_stark Jun 19 at 8:28

$$I=\int\frac{x^2+n(n-1)}{(x\sin x+n\cos x)^2}dx$$

Put $$x=n\tan \theta\;\;dx=n\sec^2\theta d\theta$$

$$I=\int\frac{n^2\tan^2\theta+n^2-n}{(n\tan\theta\sin(n\tan \theta)+n\cos(n\tan \theta))^2}\cdot n\sec^2\theta d\theta$$

$$I=\int\frac{n\sec^2(\theta)-1}{\cos^2(n\tan\theta-\theta)}d\theta.$$

Put $$n\tan \theta-\theta=u$$ and $$(n\sec^2\theta-1)d\theta=du$$

$$I=\int\frac{1}{\cos^2u}du=\int\sec^2(u)du=\tan u+C$$

$$I=\tan(n\tan\theta-\theta)+C=\tan\bigg(x-\tan^{-1}\frac{x}{n}\bigg)+C$$

$$I=\frac{n\sin x-x\cos x}{x\sin x+n\cos x}+C$$

• Thank You so much. If you don't mind me asking , what was your thought process , behind it that you could think of substitution of $x=n*tan(\theta)$ – user232243 May 20 at 3:44
• From Dr. Answer...... – jacky May 20 at 8:29

$$I = \int\frac{x^2 + n(n-1)}{(x\sin x + n\cos x )^2}dx$$

Now we'll try to convert it into the form of $$\frac{a}{y} + \frac{b}{y^2}$$, where $$a,b$$ are functions of $$x$$ and $$y$$ is the denominator.

$$x^2+n(n-1) =(x\sin x + (n-1)\cos x)(x\sin x+n\cos x)-((1-n)\sin x + x\cos x)(n\sin x - x\cos x)$$



$$I = \int \big[\frac{(x\sin x + (n-1)\cos x)(x\sin x+n\cos x)}{(x\sin x + n\cos x )^2} - \frac{((1-n)\sin x + x\cos x)(n\sin x - x\cos x)}{(x\sin x + n\cos x )^2}\big]dx$$

Now, $$I = \int\big[\frac{(x\sin x + (n-1)\cos x)}{(x\sin x + n\cos x )} - \frac{((1-n)\sin x + x\cos x)(n\sin x - x\cos x)}{(x\sin x + n\cos x )^2}\big]dx$$

Let $$I_1 = \int\frac{(x\sin x + (n-1)\cos x)}{(x\sin x + n\cos x )}dx$$ , $$I_2 = \frac{((1-n)\sin x + x\cos x)(n\sin x - x\cos x)}{(x\sin x + n\cos x )^2}dx$$

In $$I_2$$,

let $$u = n\sin x - x\cos x$$, $$dv = \frac{(1-n)\sin x + x\cos x}{(x\sin x + n\cos x )^2}dx$$

$$du = (n\cos x - \cos x + x\sin x)dx$$ ,

[In $$v$$ , $$t = x\sin x + n\cos x$$, $$dt = (x\cos x + \sin x - n\sin x )dx = (x\cos x + (1-n)\sin x)dx$$]

$$v = \int\frac{(1-n)\sin x + x\cos x}{(x\sin x + n\cos x )^2}dx = \int\frac{dt}{t^2} = -\frac{1}{t} = - \frac{1}{x\sin x + n\cos x}$$

So,

$$I_2 = uv - \int vdu = -(n\sin x - x\cos x)\frac{1}{x\sin x + n\cos x} + \int (n\cos x - \cos x + x\sin x).\frac{1}{x\sin x + n\cos x}dx + c$$

$$I_2 = - \frac{n\sin x - x\cos x}{x\sin x + n\cos x} + \int \frac{x\sin x + (n-1)\cos x}{x\sin x + n\cos x}dx +c$$

$$I_2 = - \frac{n\sin x - x\cos x}{x\sin x + n\cos x} + I_1 +c$$

$$I = I_1 - I_2 = \frac{n\sin x - x\cos x}{x\sin x + n\cos x} + k$$

($$k = -c$$)