Trigonometric Integral - Quotient Rule: $\int \frac{x\cos(x)}{(x+\cos(x))^2} dx$? $$\int \frac{x\cos(x)}{(x+\cos(x))^2} dx$$
I suspect that the integral can be solved by thinking of it as the derivative of a quotient with a denominator of $x + \cos(x)$. How else could this integral be evaluated?
 A: We have $$I=\int\frac{x\cos\left(x\right)}{\left(x+\cos\left(x\right)\right)^{2}}dx=\int\frac{1-\sin\left(x\right)}{\left(x+\cos\left(x\right)\right)^{2}}\frac{x\cos\left(x\right)}{1-\sin\left(x\right)}dx
 $$ $$\stackrel{IBP}{=}-\frac{1}{x+\cos\left(x\right)}\frac{x\cos\left(x\right)}{1-\sin\left(x\right)}+\int\frac{1}{1-\sin\left(x\right)}dx
 $$ and the last integral is easy to evaluate using the tangent half substitution $$\int\frac{1}{1-\sin\left(x\right)}dx\stackrel{u=\tan\left(\frac{x}{2}\right)}{=}2\int\frac{1}{\left(u-1\right)^{2}}=-\frac{2}{\tan\left(\frac{x}{2}\right)-1}
 $$ so $$ \begin{align}I=
  & -\frac{x\cos\left(x\right)}{\left(x+\cos\left(x\right)\right)\left(1-\sin\left(x\right)\right)}-\frac{2}{\tan\left(\frac{x}{2}\right)-1}+C
 \\ =
  & -\frac{x\cos\left(x\right)}{\left(x+\cos\left(x\right)\right)\left(1-\sin\left(x\right)\right)}-\frac{2\left(\cos\left(x\right)+1\right)}{\sin\left(x\right)-\cos\left(x\right)-1}+C
  \\=
 & \color{red}{\frac{1+\sin\left(x\right)}{x+\cos\left(x\right)}+C'}
  \end{align}$$ as wanted.
A: $$\ I=\int \frac{x\cos(x)}{(x+\cos(x))^2} dx=\int \frac{\cos(x)(x+\cos(x))-(1+\sin(x))(1-sin(x))}{(x+\cos(x))^2} dx$$
We recognize there a form $\dfrac{u'v-uv'}{v^2}$ which has a primitive of the form $\dfrac{u}{v}$. Thus:
$$\ I=\int \dfrac{d}{dx}\left(\dfrac{1+\sin(x)}{x+\cos(x)}\right)dx=\dfrac{1+\sin(x)}{x+\cos(x)}+C$$
Honestly, I have used Mathematica to find the result. Then it was easy to find a proof...
A: $$\int \frac{x\cos(x)}{(x+\cos(x))^2} dx$$
Diffrentaition of $(x+\cos(x))$  is $(1-\sin x)$
$$\int \frac{(1-\sin x)}{(x+\cos(x))^2}\frac{x\cos x}{1- \sin x}$$
Diffrentiation of $ \dfrac{x\cos x}{1- \sin x}$ is$\dfrac{\cos\left(x\right)+x}{1-\sin\left(x\right)}$
Now ,Integrate it by parts .
$$\int \underbrace{\frac{(1-\sin x)}{(x+\cos x)^2}}_{\text {II}} \underbrace{\frac{x\cos x}{(1-\sin x)}}_{\text {I}}$$
