$$\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


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.

  • $\begingroup$ What is exactly tour doubt on that? Maybe how can we guess that manipilation? $\endgroup$
    – user
    Oct 29, 2019 at 14:12
  • $\begingroup$ Yes, how can we guess that manipulation? $\endgroup$
    – Zenix
    Oct 29, 2019 at 14:20
  • $\begingroup$ He basically wrote the numerator in the form of $c_1*$denominator$+c_2$, and obtained $c_1$ and $c_2$ by comparison. $\endgroup$
    – Ishan Deo
    Oct 29, 2019 at 14:42
  • $\begingroup$ I tried it, but there is no trigonometric term in the N. Please write a solution if you were able to solve it. $\endgroup$
    – Zenix
    Oct 29, 2019 at 14:59
  • $\begingroup$ @Zenix The trick is aimed to use integration by parts of course it not seems so obviuos to see but of course in this way the solution is straightforward. $\endgroup$
    – user
    Oct 29, 2019 at 15:08

3 Answers 3


Use the shorthands $s= \sin x$ and $c=\cos x$, along with $$s’= c, \>\>\> c’=-s, \>\>\>s^2+c^2 = 1$$ to reexpress the integrand

\begin{align} & {\dfrac{x^2+(n-1)n}{(x\sin x+n\cos x)^2}} \\ =&\ \frac{x^2+(n-1)n}{(xs+nc)^2} = \frac{x^2(s^2+c^2)+(n-1)n(s^2+c^2)}{(xs+nc)^2} \\ =& \ \frac{[xs+(n-1)c](xs+nc)-[(1-n)xs+xc](ns-xc) }{(xs+nc)^2}\\ = & \ \frac{xs+(n-1)c}{xs+nc}- \dfrac{[(1-n)xs+xc](ns-xc)}{\left(xs+nc\right)^2} \\ = & \ \frac{d}{dx}\left( \dfrac{n s-x c}{x s+n c} \right) = \frac{d}{dx}\left( \dfrac{n\sin x-x\cos x}{x\sin x+n\cos x} \right) \\ \end{align}


$$\int {\dfrac{x^2+(n-1)n}{(x\sin x+n\cos x)^2}} = \dfrac{n\sin x-x\cos x}{x\sin x+n\cos x} +C$$

  • 3
    $\begingroup$ Interestingly, dividing the final fraction's numerator and denominator by $n\cos x$ converts it to $\frac{\tan x-x/n}{1+\frac{x}{n}\tan x}=\tan(x-\arctan\tfrac{x}{n})$. $\endgroup$
    – J.G.
    Oct 10, 2020 at 18:01
  • $\begingroup$ @J.G. See my answer here for the same integral but a different approach I took which shows why your observation is true. $\endgroup$
    – Ty.
    Oct 10, 2020 at 18:02
  • $\begingroup$ How did you figure out the split in the third step? $\endgroup$
    – Babu
    Oct 12, 2020 at 13:12

$$x\sin x+n\cos x=\sqrt{x^2+n^2}\left(\frac{x}{\sqrt{x^2+n^2}}\sin x+\frac{n}{\sqrt{x^2+n^2}}\cos x\right)$$$$=\sqrt{x^2+n^2}\cos \left(x-\arctan(\frac{x}{n})\right)$$

$$\int {\dfrac{x^2+\left(n-1\right)n}{\left(x\sin\left(x\right)+n\cos\left(x\right)\right)^2}}dx=\int\frac{x^2+n(n-1)}{(x^2+n^2)\cos^2\left(x-\arctan(\frac{x}{n})\right)}dx$$

Put $$t=x-\arctan(\frac{x}{n})\Rightarrow\tan t=\frac{\tan x-\frac{x}{n}}{1+(\tan x)(\frac{x}{n})}=\frac{n\sin x-x\cos x}{x\sin x+n\cos x}$$

and$$ \frac{dt}{dx}=\frac{x^2+n(n-1)}{x^2+n^2}$$

$$\int {\dfrac{x^2+\left(n-1\right)n}{\left(x\sin\left(x\right)+n\cos\left(x\right)\right)^2}}dx=\int\frac{x^2+n(n-1)}{(x^2+n^2)\cos^2\left(x-\arctan(\frac{x}{n})\right)}dx=\int\sec^2t \;dt$$$$=\tan t +c=\frac{n\sin x-x\cos x}{x\sin x+n\cos x}+c$$

  • $\begingroup$ (+1) that's very nice $\endgroup$ Aug 9, 2023 at 6:11

It seems that your teacher is taking


$$v'=x\sin\left(x\right)+\left(n-1\right)\cos\left(x\right) \implies v=n\sin x-x\cos x$$

then by parts

$$\int uv' + \int u'v=uv$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .