This is an example question in my book:
To solve for $x$: $$\tan^{-1}\frac{x-1}{x+2}+\tan^{-1}\frac{x+1}{x+2}=\frac{\pi}{4}$$
and it is solved by a direct formula given by $$\tan^{-1}x+\tan^{-1}y=\tan^{-1} \left(\frac{x+y}{1-xy}\right) $$ when $xy<1$. The book uses this formula without checking conditions many many times and it is mildly infuriating. It is alright when checking the condition is simple but in this case finding the range of $\dfrac{x^2-1}{(x+2)^2}$ is a little time consuming and has the square root of 21 in it.
Well my question is:
Why and when can I just peacefully substitute the formula without worrying about the condition as the book leisurely does so?