Integrate $\int\frac{\cos^2(x)-x^2\sin(x)}{(x+\cos(x))^2}dx$ I had to integrate the following integral:
\begin{equation}
\int\frac{\cos^2(x)-x^2\sin(x)}{(x+\cos(x))^2}dx
\end{equation}
but I can't find a suitable substitution to find a solution. Nothing I try works out and only seems to make it more complicated. Does anyone have an idea as to how to solve this?
I also tried to get help from WolframAlpha but it just says that there is no step-by-step solution available. 
The sollution by wolfram alpha is:
\begin{equation}
\int\frac{\cos^2(x)-x^2\sin(x)}{(x+\cos(x))^2}dx = \frac{x\cos(x)}{x+\cos(x)} + c
\end{equation}

\begin{equation}
\int\frac{\cos^2 x-x^2\sin x }{(x+\cos x)^2}dx
\end{equation}
Divide both numerator and denominator by $x^2\cos^2 x$
\begin{equation}
\int\frac{\cos^2 x-x^2\sin x }{(x+\cos x)^2}dx
=\int\frac{\dfrac{1}{x^2}-\dfrac{\sin x}{\cos^2 x}}{(\dfrac{1}{\cos x}+\dfrac{1}{x})^2}dx
=\frac{1}{\dfrac{1}{\cos x}+\dfrac{1}{x}} + C
=\frac{x\cos x}{x + \cos x} + C
\end{equation}
