Solving definite integral $\int_{0}^{1} \tan^{-1}(1-1/x)dx$ $$\int_{0}^{1} \tan^{-1}\left(1-\frac1x\right)dx$$
Here's what I have done so far. (the answer is given as $-\pi/4$)
Let
$$
I = \int_{0}^{1}\tan^{-1}\left(1-\frac1x\right)dx = \int_{0}^{1}\tan^{-1}\left(\frac{x-1}x\right)dx.
$$
Since, $\int_{0}^{1} f(x)dx = \int_{0}^{1} f(1-x)dx$ one has\begin{align}
I &= \int_{0}^{1}\tan^{-1}\left(1-\frac1{1-x}\right)dx\\
& = \int_{0}^{1}\tan^{-1}\left(\frac x{x-1}\right)dx\\
& = \int_{0}^{1}\frac\pi2-\cot^{-1}\left(\frac x{x-1}\right)dx\\
& = \int_{0}^{1}\frac\pi2-\tan^{-1}\left(\frac{x-1}x\right)dx\\
& = \frac\pi2 - I,
\end{align}
Hence, $I = \dfrac\pi4$. The given answer is $-\dfrac\pi4$. Where have I gone wrong?

By integration by parts, one has
\begin{eqnarray}
\int_0^1 \arctan\left(1 - \frac1x\right) \, dx &=& -\int_0^1 \frac{x}{1+(1-\frac1x)^2}\frac{dx}{x^2}\\
&=& -\int_0^1 \frac{x}{2x^2-2x+1}dx\\
&=& \boxed{-\frac\pi4}
\end{eqnarray}
Update:
\begin{eqnarray}
\int_0^1 \frac{x}{2x^2-2x+1}dx&=&\int_0^1 \frac{2x}{(2x-1)^2+1}dx\\
&=&\int_0^1 \frac{2x-1}{(2x-1)^2+1}dx+\int_0^1 \frac{1}{(2x-1)^2+1}dx\\
&=&\frac{1}{4}\ln[(2x-1)^2+1]+\frac12\arctan(2x-1)\bigg|_0^1 \\
&=&\frac\pi4.
\end{eqnarray}
