# Evaluating this integral $\small\int \frac {x^2 dx} {(x\sin x+\cos x)^2}$

The question:

Compute$$\int \frac {x^2 \, \operatorname{d}\!x} {(x\sin x+\cos x)^2}$$

Tried integration by parts. That didn't work.

How do I proceed?

• What makes you think that it has an anti-derivative? Commented Apr 19, 2013 at 14:47
• Well, it is there in the problem sheet that we are working at. (Btw, what makes you think it DOESN'T have an anti-derivative?) Commented Apr 19, 2013 at 14:48
• @ParthThakkar: Given a random function, it most likely does not have an anti-derivative in terms of elementary functions. of course, if you tell the source, one would not have had to ask you this question. Commented Apr 19, 2013 at 15:01
• Ok, got it! Now onwards, such things will be mentioned if required. Commented Apr 19, 2013 at 15:03
• @Vijay: Now I suspect there is a typo. Are you sure the denominator is not $(x \sin x + \cos x)^2$? (In which case lab's answer would be perfect). Commented Apr 19, 2013 at 15:22

$$\text{Observe that, }\frac{d(x\sin x+\cos x)}{dx}=x\cos x$$

$$\int \frac {x^2 \, \operatorname{d}\!x} {(x\sin x+\cos x)^2} =\int \frac x{\cos x}\cdot \frac{x\cos x}{(x\sin x+\cos x)^2}dx$$

So, if $z=x\sin x+\cos x, dz=x\cos xdx$

So, $\int \frac{x\cos x}{(x\sin x+\sin x)^2}dx=\int \frac{dz}{z^2}=-\frac1z=-\frac1{x\sin x+\cos x}$

So, $$I=\frac x{\cos x}\int \frac{x\cos x}{(x\sin x+\cos x)^2}dx-\int \left(\frac{d(\frac x{\cos x})}{dx}\int \frac{x\cos x}{(x\sin x+\cos x)^2}dx\right)dx$$

$$=-\frac x{\cos x(x\sin x+\cos x)}+\int \left(\frac{x\sin x+\cos x}{\cos^2x}\right)\left(\frac1{x\sin x+\cos x} \right)dx$$

$$=-\frac x{\cos x(x\sin x+\cos x)}+\int\sec^2xdx$$

$$=-\frac x{\cos x(x\sin x+\cos x)}+\tan x+C$$ where $C$ is an arbitrary constant of indefinite integral

$$\text{Another form will be } \frac{\sin x-x\cos x}{x\sin x+\cos x}+C$$

• Damn! We had observed the derivative thingy, but couldn't think of multiplying and diving by $cos x$. Smart! Commented Apr 19, 2013 at 14:58
• Thanks.. Got the solution. Commented Apr 19, 2013 at 14:59
• @VijayRaghavan, my pleasure. Commented Apr 19, 2013 at 15:04
• What?????????? It was a bigggggg mistake. Haha . Even the answer was accepted and 3 up-votes. @VijayRaghavan and others all trolled..... :D
– ABC
Commented Apr 19, 2013 at 15:25
• @martycohen, I have used Integration by Parts(en.wikipedia.org/wiki/Integration_by_parts), $$\int u(x)v'(x) dx=u(x)v(x)-\int[u'(x)v(x)]dx$$ Setting $v'(x)=w(x)\implies v(x)=\int w(x)dx$ to find $$\int u(x)w(x)dx=u(x)\int w(x)dx-\int[u'(x)\cdot\int w(x)dx]dx$$ Commented Oct 1, 2014 at 18:12

Differentiation of $$x\sin x+\cos x \space \text {is}\space x\cos x$$ \begin{align}\int\underbrace {\frac{x \cos x}{(x\sin x+\cos x)^2}}_{\text {II}}\cdot\underbrace {\frac {x}{(\cos x)}}_{\text {I}}{d}x\end{align} Now integrate by parts. $$I=\frac{-1}{(x\sin x+\cos x)}.\frac {x}{(\cos x)} +\int\frac{1}{(x\sin x+\cos x)}.\frac{\cos x.1 -x(-\sin x)}{\cos^2 x}$$ Now, I hope things are clear to you.

• Will it not be too long Commented Aug 21, 2016 at 15:26
• @koolman No.., Give it a try . Commented Aug 21, 2016 at 15:28
• in first step will we take $d(xsin x + cos x)$ Commented Aug 21, 2016 at 15:30
• @koolman Yes..${}{}{}{}$ Commented Aug 21, 2016 at 15:38
• @AméricoTavares Thanks .. Commented Aug 21, 2016 at 17:45

I was inspired by this post to conduct this method.

$$\int\frac{x^2}{(x\sin x+\cos x)^2}\mathrm{d}x$$

The Harmonic Addition Theorem comes in handy, so $x \sin x + \cos x = \sqrt{1+x^2} \cos(x-\alpha)$ where $\alpha = \arctan(x)$.

The origin integration becomes:

$$\int \frac{x^2}{1+x^2} \sec^2(x-\alpha) \mathrm{d}x$$

Notice that $\int \frac{x^2}{1+x^2} dx = x - \arctan x = x-\alpha$.

So let $t = x-\alpha$ then $dt = \frac{x^2}{1+x^2} dx$ and the integration simplifies as:

$$\int \sec^2(t) dt = \tan(t) = \tan(x - \arctan x)$$.

In conclusion, $$\int\frac{x^2}{(x\sin x+\cos x)^2}\mathrm{d}x =\tan(x - \arctan x)+C$$

• Is that $a = \arctan(x)$ meant to be $\alpha = \arctan(x)$? Commented Aug 21, 2016 at 23:33
• @someonewithpc Yes a typo.
– Zau
Commented Aug 21, 2016 at 23:36

$$\int\frac{x^2}{(x\sin x+\cos x)^2}\mathrm{d}x = \int (x\sec x)\frac{x \cos x}{(x\sin x+\cos x)^2}\mathrm{d}x$$ Take $$xsecx$$ as first functions and apply integreation by parts. there you go boom!!