I was trying to derive the following formula $$\arctan(x)+\arctan(y) = \begin{cases}\arctan\left(\dfrac{x+y}{1-xy}\right), &xy < 1 \\[1.5ex] \pi + \arctan\left(\dfrac{x+y}{1-xy}\right), &x>0,\; y>0,\; xy>1 \\[1.5ex] -\pi + \arctan\left(\dfrac{x+y}{1-xy}\right), &x<0,\; y<0,\; xy > 1\end{cases}$$
I proceeded this way
$$\tan{(A+B)}= \frac{\tan{A}+\tan{B}}{1-\tan{A}\tan{B}}$$ $$\arctan(\tan{(A+B)})=\arctan\bigg(\frac{\tan{A}+\tan{B}}{1-\tan{A}\tan{B}}\bigg)$$ $$A+B=\arctan\bigg(\frac{\tan{A}+\tan{B}}{1-\tan{A}\tan{B}}\bigg)$$ $$\tag*{$\frac{-\pi}{2}<A+B<\frac{\pi}{2}$}$$ $$A=\arctan(\tan A)$$ $$\tag*{$\frac{-\pi}{2}<A<\frac{\pi}{2}$}$$ $$B=\arctan(\tan B)$$ $$\tag*{$\frac{-\pi}{2}<B<\frac{\pi}{2}$}$$ $$\arctan(\tan A) + \arctan(\tan B)=\arctan\bigg(\frac{\tan{A}+\tan{B}}{1-\tan{A}\tan{B}}\bigg)$$ $$\tan A=x$$ $$\tan B=y$$ $$\arctan(x) + \arctan(y)=\arctan\bigg(\frac{x+y}{1-xy}\bigg)$$
Now from here ownwards I don’t know how It gets converted to 3 different definitions. You’re help will be highly appreciated.