If $\tan ^{-1} \frac{x-1}{x-2}+\tan ^{-1} \frac{x+1 \pi}{x+2}=\frac{\pi}{4}$, then find the value of $x$.
$\tan ^{-1} \frac{x-1}{x-2}+\tan ^{-1} \frac{x+1}{x+2}=\frac{\pi}{4}$
$\Rightarrow \tan ^{-1}\left[\frac{\frac{x-1}{x-2}+\frac{x+1}{x+2}}{1-\left(\frac{x-1}{x-2}\right)\left(\frac{x+1}{x+2}\right)}\right]=\frac{\pi}{4}$ $\left[\tan ^{-1} x+\tan ^{-1} y=\tan ^{-1} \frac{x+y}{1-x y}\right]$
$\Rightarrow \tan ^{-1}\left[\frac{(x-1)(x+2)+(x+1)(x-2)}{(x+2)(x-2)-(x-1)(x+1)}\right]=\frac{\pi}{4}$
$\Rightarrow \tan ^{-1}\left[\frac{x^{2}+x-2+x^{2}-x-2}{x^{2}-4-x^{2}+1}\right]=\frac{\pi}{4}$
$\Rightarrow \tan ^{-1}\left[\frac{2 x^{2}-4}{-3}\right]=\frac{\pi}{4}$
$\Rightarrow \tan \left[\tan ^{-1} \frac{4-2 x^{2}}{3}\right]=\tan \frac{\pi}{4}$
$\Rightarrow \frac{4-2 x^{2}}{3}=1$
$\Rightarrow 4-2 x^{2}=3$
$\Rightarrow 2 x^{2}=4-3=1$
$\Rightarrow x=\pm \frac{1}{\sqrt{2}}$
Hence, the value of $x$ is $\pm \frac{1}{\sqrt{2}}$.