Evaluating $\int_{-1/2}^{1} \cos^{-1} \frac{1-x^2}{1+x^2} dx$ Let us do the integration by parts  $$I=\int_{-1/2}^{1} ~\cos^{-1} \frac{1-x^2}{1+x^2}. 1~ dx =\left.x \cos^{-1} \frac{1-x^2}{1+x^2}\right|_{-1/2}^{1}-\int_{-1/2}^{1} \frac{2x}{1+x^2} dx$$ $$=\frac{\pi}{2}+\frac{1}{2}\cos^{-1} \frac{3}{5}-\left .\ln(1+x^2)\right|_{-1/2}^{1}=\frac{\pi}{2}+\frac{1}{2}\cos^{-1} \frac{3}{5}-\ln\frac{8}{5}.$$
The question is whether something is amiss here and whether the answer is right.
EDit
The correct answer is $$I=\frac{\pi}{2}+\frac{1}{2}\cos^{-1} \frac{3}{5}-\ln\frac{5}{2}.$$

The error is in the sign that is different for $x\leq0$ and $x\geq0:$
$$
x \frac{d}{dx}\cos^{-1}\frac{1-x^2}{1+x^2}=
\left\{
\begin{alignedat}{2}
-\dfrac{2x}{1+x^2}\quad & -&&1\leq x\leq 0 \\
+\dfrac{2x}{1+x^2}\quad &  &&0\leq x\leq 1 
\end{alignedat}
\right.
$$
so that
\begin{align}
I
  &=\int_{-1/2}^{1}\cos^{-1}\left(\frac{1-x^2}{1+x^2}\right)dx =\\
  &=\left.x\cos^{-1}\left(\frac{1-x^2}{1+x^2}\right)\right|_{-1/2}^{1}+\int_{-1/2}^{0} \frac{2x}{1+x^2} dx-\int_{0}^{1} \frac{2x}{1+x^2} dx=\\
  &=\frac{\pi}{2}+\frac{1}{2}\cos^{-1}\left(\frac{3}{5}\right)-\ln\frac{5}{4}-\ln 2\\
  &=\frac{\pi}{2}+\frac{1}{2}\cos^{-1}\left(\frac{3}{5}\right)-\ln\frac{5}{2}.
\end{align}
