Proof for sum and difference of angles in terms of tan inverse We have the following formulas for sum of angles when angles are in terms of tan inverse:
$\tan^{-1}(x)+\tan^{-1}(y)$ =

*

*$\tan^{-1}((x+y)/(1-xy))$,  if $xy<1$


*$\pi+\tan^{-1}((x+y)/(1-xy))$,  if $x>0,y>0$and $xy>1$


*$-\pi +\tan^{-1}((x+y)/(1-xy))$,  if $x<0,y<0$ and $xy>1$
I tried it like this :
Let $\tan^{-1} (x)=A$ and $\tan^{-1}(y)=B$ where $A,B \in(-(\pi/2),(\pi/2))$
So , $\tan(A+B)=(\tan A+\tan B)/1-\tan A \tan B=(x+y)/1-xy$
$\tan^{-1}((x+y)/(1-xy))=\tan^{-1}(\tan(A+B))$
let $A+B=\alpha$
=$\alpha+\pi$,  $-\pi<\alpha<-\pi/2$
$\alpha,  -\pi<\alpha <\pi/2$
$\alpha-\pi,  \pi/2<\alpha <\pi$
Further how to proceed to get the condition xy><1...?
 A: Well what's happening is, we are doing this step below:
$$\tan^{-1} A + \tan^{-1} B = \tan^{-1} (\tan (\tan^{-1} A + \tan^{-1} B))$$
$\tan^{-1} \tan x$ will shift your input by $n \pi \ ; \ n \ \epsilon \ Z$ to bring it into principal range of tan inverse.
So that step we did above is only valid when you know that $\tan^{-1} A + \tan^{-1} B$ lies within the principal range. To account for other ways are the cases you've listed.
I'm not aware of a purely algebraic approach because I dont get how one would proceed by taking expressions like $\tan^{-1} A + \tan^{-1} B > \frac \pi 2$. Ill present a graphical approach:

That's $y = \tan x$ in $(-\pi, \pi)$
Five cases arise corresponding x,y of opposite signs + to the 4 intervals in x axis, made equally in the above graph when they are of same sign:
0. With $A$ and $B$ of opposite signs, we have $\tan^{-1} A + \tan^{-1}B \ \epsilon \ (-\frac \pi 2, \frac \pi 2)$, which corresponds to the principal range.
1. $\tan^{-1} A + \tan^{-1}B < 0$ and $\tan (\tan^{-1} A + \tan^{-1}B) < 0$:
Here since of same sign, both are negative but then since tan is positive you have $1 - AB < 0$
Now $\tan ^{-1} \tan (\tan^{-1} A + \tan^{-1}B)$ gives a value $\pi$ more than what it shoudlve been.
$$\tan^{-1} A + \tan^{-1} B = \tan ^{-1} \left( \frac {A+B}{1-AB} \right) - \pi \ ; \ A,B <0, AB>1$$
Similarly you can do this for the other 3 regions too.
You'll see that regions 0. ($AB<0$), 2.($AB<1; A,B<0$) and 3.($AB<1; A,B>0$) correspond to the same condition of $AB < 1$ and to same result from the expression.
A: We know tan has a period of π. So we can write,
$$\tan(\arctan x + \arctan y) = \tan(\arctan x + \arctan y - nπ)\\
\frac{x + y}{1 - xy} = \tan(\arctan x + \arctan y - nπ)\\
\arctan(\frac{x + y}{1 - xy}) + nπ = \arctan x + \arctan y
$$
Depending on the RHS, we need to take appropriate value of n.
