$$ \tan^{-1}x+\tan^{-1}y=\tan^{-1}\frac{x+y}{1-xy} \text{, }xy<1\\ \tan^{-1}x-\tan^{-1}y=\tan^{-1}\frac{x-y}{1+xy} \text{, }xy>-1 $$
But, How do I reach the conditions $xy<1$ for the first expression and $xy>-1$ for the second from the domain and range of the functions, provided we are only considering the principal value branch ?
My Attempt $$ \tan^{-1}:\mathbb{R}\to \Big(\frac{-\pi}{2},\frac{\pi}{2}\Big) $$ $$ \text{Taking, }\alpha=\tan^{-1}x, \quad\beta=\tan^{-1}y\implies x=\tan\alpha,\quad y=\tan\beta\\ \tan(\alpha+\beta)=\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}=\frac{x+y}{1-xy}\\ \text{We have, }-\pi<\tan^{-1}x+\tan^{-1}y=\alpha+\beta<\pi $$ If $\tfrac{-\pi}{2}<\alpha+\beta<\tfrac{\pi}{2}$ we have, $$ \alpha+\beta=\tan^{-1}\bigg(\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}\bigg)\implies \tan^{-1}x+\tan^{-1}y=\tan^{-1}\frac{x+y}{1-xy} $$
For the first expression, $xy\neq{1}$ as the denominator can not be equal to zero.
$$ \frac{-\pi}{2}<\tan^{-1}\frac{x+y}{1-xy}<\frac{\pi}{2}\text{ and }-\pi<\tan^{-1}x+\tan^{-1}y<\pi\\\implies\frac{-\pi}{2}<\tan^{-1}x+\tan^{-1}y=\tan^{-1}\frac{x+y}{1-xy}<\frac{\pi}{2} $$ I really dont see any clue which leads to the condition $xy<1$. I checked a similar question asked Inverse trigonometric function identity doubt, but it does not seem to clear how to get to the given conditions from the above proof.
Note: I am not looking for proving the statement is correct. I'd like to see how to reach the given conditions from the domain and range of the functions involved.
Thanks @Rohan for the hint.
$$ \tan^{-1}:\mathbb{R}\to \Big(\frac{-\pi}{2},\frac{\pi}{2}\Big) $$
Taking, $$ \alpha=\tan^{-1}x\implies x=\tan\alpha\text{ , where }\tfrac{-\pi}{2}<\alpha<\tfrac{\pi}{2}\\ \beta=\tan^{-1}y\implies{y}=\tan\beta\text{ , where }\tfrac{-\pi}{2}<\beta<\tfrac{\pi}{2}\\ $$ For,
$\implies-\pi<\alpha+\beta<\pi$. $$ \tan(\alpha+\beta)=\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}=\frac{x+y}{1-xy}\\ $$
If $\tfrac{-\pi}{2}<\alpha+\beta<\tfrac{\pi}{2}$, $$ \alpha+\beta=\tan^{-1}\bigg(\frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}\bigg)\implies \tan^{-1}x+\tan^{-1}y=\tan^{-1}\frac{x+y}{1-xy} $$
In the range $\tfrac{-\pi}{2}<\alpha+\beta<\tfrac{\pi}{2}$, we have $\cos(\alpha+\beta)>0$, $\cos\alpha>0$ and $\cos\beta>0.$ $$ \cos(\alpha+\beta)=\cos\alpha\cos\beta-\sin\alpha\sin\beta=\cos\alpha\cos\beta-\cos\alpha\tan\alpha\cos\beta\tan\beta\\=\cos\alpha\cos\beta\Big(1-\tan\alpha\tan\beta\Big)>0\\\implies 1-\tan\alpha\tan\beta>0 \quad\bigg(\text{ as } \cos\alpha>0 \text{ and } \cos\beta>0\bigg)\\ \implies 1-xy>0\implies \color{red}{xy<1} $$
For,
$$ \tfrac{-\pi}{2}<\alpha<\tfrac{\pi}{2}\\ \tfrac{-\pi}{2}<\beta<\tfrac{\pi}{2}\implies\tfrac{\pi}{2}>-\beta>\tfrac{-\pi}{2}\implies\tfrac{-\pi}{2}<-\beta<\tfrac{\pi}{2} $$ $\implies -\pi<\alpha-\beta<\pi$ $$ \tan(\alpha-\beta)=\frac{\tan\alpha-\tan\beta}{1+\tan\alpha\tan\beta}=\frac{x-y}{1+xy} $$ If $\frac{-\pi}{2}<\alpha-\beta<\frac{\pi}{2}$, $$ \alpha-\beta=\tan^{-1}\frac{\tan\alpha-\tan\beta}{1+\tan\alpha\tan\beta}\implies\tan^{-1}x-\tan^{-1}y=\tan^{-1}\frac{x-y}{1+xy} $$ In the range $\tfrac{-\pi}{2}<\alpha-\beta<\tfrac{\pi}{2}$, we have $\cos(\alpha-\beta)>0$, $\cos\alpha>0$ and $\cos\beta>0.$ $$ \cos(\alpha-\beta)=\cos\alpha\cos\beta+\sin\alpha\sin\beta=\cos\alpha\cos\beta+\cos\alpha\tan\alpha\cos\beta\tan\beta\\ =\cos\alpha\cos\beta\Big(1+\tan\alpha\tan\beta\Big)>0\\ \implies 1+\tan\alpha\tan\beta>0\quad\Big(\text{ as }\cos\alpha>0\quad\&\quad\cos\beta>0\Big)\\ \implies1+xy>0\implies1>-xy\implies \color{red}{xy>-1} $$