<s>[INST] Difference between anti-derivative and indefinite integral My teacher gave me the following integral to evaluate:
$$\int \frac{x^2}{(x\sin(x)+\cos(x))^2}dx$$
After half an hour of uselessly fumbling around with trig identities I gave up and plugged it into an integral calculator: https://www.integral-calculator.com/. However I am confused: it displayed ANTIDERIVATIVE COMPUTED BY MAXIMA as $$-\dfrac{\left(2x^2-2\right)\sin\left(2x\right)+4x\cos\left(2x\right)}{\left(x^2+1\right)\sin^2\left(2x\right)+4x\sin\left(2x\right)+\left(x^2+1\right)\cos^2\left(2x\right)+\left(2-2x^2\right)\cos\left(2x\right)+x^2+1}+C$$ and I pressed the simplify button to obtain $$-\dfrac{\left(x^2-1\right)\cos\left(x\right)\sin\left(x\right)+2x\cos^2\left(x\right)-x}{\left(x^2-1\right)\sin^2\left(x\right)+2x\cos\left(x\right)\sin\left(x\right)+1}+C$$ However the "MANUALLY" COMPUTED ANTIDERIVATIVE displayed the following $$\dfrac{\sin\left(x\right)-x\cos\left(x\right)}{x\sin\left(x\right)+\cos\left(x\right)}+C$$ Which was computed by the following method:
$$\int \frac{x^2}{(x\sin(x)+\cos(x))^2}dx= \int \Bigg(\frac{x\sin(x)}{x\sin(x)+cos(x)}-\frac{x\cos(x)(\sin(x)-x\cos(x))}{(x\sin(x)+\cos(x))^2}\Bigg) dx$$
Using integration by parts
$$ \int \frac{x\cos(x)(\sin(x)-x\cos(x))}{(x\sin(x)+\cos(x))^2} dx= \dfrac{\sin\left(x\right)-x\cos\left(x\right)}{x\sin\left(x\right)+\cos\left(x\right)}+ \int\frac{x\sin(x)}{x\sin(x)+cos(x)}dx$$
$$\Rightarrow \int \frac{x^2}{(x\sin(x)+\cos(x))^2}dx=\dfrac{\sin\left(x\right)-x\cos\left(x\right)}{x\sin\left(x\right)+\cos\left(x\right)}+ \int\frac{x\sin(x)}{x\sin(x)+cos(x)}dx-\int\frac{x\sin(x)}{x\sin(x)+cos(x)}dx=\dfrac{\sin\left(x\right)-x\cos\left(x\right)}{x\sin\left(x\right)+\cos\left(x\right)}+C $$
My question is: why do I get different results from computing the anti-derivative and the indefinite integral? I simplified the anti-derivative so shouldn't it be simplified to the indefinite integral above? Are these two equations equal? Are functions for anti-derivatives and indefinite integrals vastly different? Any help will be appreciated
 [/INST] For example, because $$\begin{align*}&(x^2-1)\sin^2x+2x\sin{x}\cos{x}+1\\&=(x^2-1)\sin^2x+2x\sin{x}\cos{x}+\sin^2x+\cos^2x\\&=x^2\sin^2x+2x\sin{x}\cos{x}+\cos^2x\\&=(x\sin{x}+\cos{x})^2.\end{align*}$$
Now, what does happen in the numerator?
We have the following:
$$\begin{align*}&(x^2-1)\cos{x}\sin{x}+2x\cos^2x-x\\&=(x^2-1)\cos{x}\sin{x}+2x\cos^2x-x\sin^2x-x\cos^2x\\&=x\cos^2x+(x^2-1)\cos{x}\sin{x}-x\sin^2x\\&=(x\sin{x}+\cos{x})(x\cos{x}-\sin{x}).\end{align*}$$
I hope now it's clear.
</s>