Evaluate $\int \arctan({\frac{x-2}{x+2}})\,\text dx$

calculusindefinite-integralsintegration

$$
\int \arctan\left({\frac{x-2}{x+2}}\right)\,\text dx
$$

It seems to be solved in just one line:
$$
x \arctan\left({\frac{x-2}{x+2}}\right)-\log|x^2+4|+c
$$

but how?
I have tried with integration by parts (by picturing out $1$ multiplying arctan), but I don't think is the right way.

Best Answer

We have using first integration by parts: $$ \begin{aligned} \int \arctan\frac{x-2}{x+2}\; dx &= \int x'\cdot\arctan\frac{x-2}{x+2}\; dx \\ &= x\arctan\frac{x-2}{x+2} - \int x\cdot\underbrace{\left(\arctan\frac{x-2}{x+2}\right)'}_{2/(x^2+4)}\; dx \\ &= x\arctan\frac{x-2}{x+2} - \int \frac{d(x^2+4)}{x^2+4}\\ &= x\arctan\frac{x-2}{x+2} - \log(x^2+4)+ c\ . \end{aligned} $$

Related Question