<s>[INST] Integral $\int\frac{(1 - x)^2 e^x}{(1 + x^2)^2}dx$ need help integrating this have tried to do this but keep getting stuck due to the whole square in the fraction. Do keep in mind that I have recently started integration and only know the basic methods.

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

 [/INST] $$\int\frac{(1 - x)^2 \ e^x}{(1 + x^2)^2} \; d x\\
\int\frac{(1 + x^2 - 2x) \ e^x}{(1 + x^2)^2} \; d x\\
\int\frac{e^x}{(1 + x^2)} \; d x +\int\frac{- 2x \ e^x}{(1 + x^2)^2} \; d x
$$
Tackling the integral on the left first.  
$$\int\frac{e^x}{(1 + x^2)} \; d x$$
Integration by parts
$u = (1+x^2)^{-1} ;du = -2x (1+x^2)^{-2} dx\\
dv = e^x dx ; v = e^x$
$$\frac {e^x}{(1+x^2)} + \int \frac {2x e^x}{(1+x^2)^2} dx$$
And this remaining integral cancels.

$$\frac {e^x}{(1+x^2)} + C$$

</s>