<s>[INST] 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?
 [/INST] Noticing that
$$
\tan \left[\tan ^{-1}\left(\frac{x-1}{x}\right)+\frac{\pi}{4}\right]=\frac{\frac{x-1}{x}+1}{1-\frac{x-1}{x}}=2 x-1
$$
For $x\in (0,1)$, $$
\tan ^{-1}\left(\frac{x-1}{x}\right)+\frac{\pi}{4}=\tan ^{-1}(2 x-1)
$$
Integrating both sides from $0$ to $1$ yields
$$
\begin{aligned}
\int_{0}^{1} \tan ^{-1}\left(1-\frac{1}{x}\right) d x+\frac{\pi}{4} &=\int_{0}^{1} \tan ^{-1}(2 x-1) d x \stackrel{2x-1\mapsto x}{=} \frac{1}{2} \int_{-1}^{1} \tan ^{-1} x d x=0
\end{aligned}
$$
Hence
$$\boxed{\int_{0}^{1} \tan ^{-1}\left(1-\frac{1}{x}\right) dx =-\frac{\pi}{4} }$$
</s>