<s>[INST] Integrate: $\int x(\arctan x)^{2}dx$ I'm not sure how to start I think we have to use integration by parts
$$\int x(\arctan x)^{2}dx$$
 [/INST] Using integration by parts, we get
$$\begin{align} \int dx \: x (\arctan{x} )^2 &= \frac{1}{2} x^2 (\arctan{x} )^2 - \int dx \: \frac{x^2}{1+x^2} \arctan{x} \\ &=  \frac{1}{2} x^2 (\arctan{x} )^2 - \int dx \: \arctan{x}  + \int dx \: \frac{\arctan{x}}{1+x^2} \\ &= \frac{1}{2} x^2 (\arctan{x} )^2 - x \arctan{x} + \int dx \: \frac{x}{1+x^2} + \frac{1}{2} (\arctan{x})^2 \\ &= \frac{1}{2} [(1+x^2) (\arctan{x})^2 + \log{(1+x^2)}] - x \arctan{x} + C  \end{align}$$
</s>