Show that $\arctan x+\arctan y = \pi+\arctan\frac{x+y}{1-xy}$, if $xy\gt 1$ Show that $\arctan x+\arctan y = \pi+\arctan\frac{x+y}{1-xy}$, if $xy\gt 1$

I am stuck at understanding why the constraint $xy\gt 1$. Here is my work so far
let $\arctan x =a\implies x=\tan a$
let $\arctan y =b\implies y=\tan b$
therefore $\frac{x+y}{1-xy}=\frac{\tan a+\tan b}{1-\tan a\tan b}=\tan(a+b)$
$\implies a+b=\arctan \frac{\tan a+\tan b}{1-\tan a\tan b} $
$\implies \arctan x+\arctan y = \arctan\frac{x+y}{1-xy}$
I know $\pi$ is the period of $\tan x$ so $xy\gt 1$ constraint must have something to do with this. But I am not able to figure out how exactly these period and $xy\gt 1$ are related. Any help is appreciated. Thanks!
 A: I think this might be an idea for you.
Let  $$f(x,y)= \arctan(x)+\arctan(y)-\arctan(\frac{x+y}{1-xy})$$ defined for  $xy> 1$, then we have 
$$ \frac{ \partial f}{\partial x }= \frac{1}{1+x^2} -\frac{(1-xy)+y(x+y)}{(1-xy)^2 +(x+y)^2 }= \frac{1}{1+x^2} -\frac{1+y^2}{(1+y^2)(1+x^2) }=0 $$
Similarly you can show that $ \frac{ \partial f}{\partial y}=0$. Hence our function is constant, i.e. $f(x,y)=C$. Now let $x=\tan(\frac{\pi}{3})= \sqrt{3}$ and  $y=\tan(\frac{\pi}{4})=1$  then $xy \approx  1.732050807568877 > 1$. On the other hand  $$f(x,y)=\frac{\pi}{3} +\frac{\pi}{4}- arctan \Big( \frac{ 1+\sqrt{3}}{1-\sqrt{3}} \Big) =\frac{\pi}{3} +\frac{\pi}{4} -(-\frac{5\pi}{12})= \pi  $$ However  $f(x,y)$ is constant, and so  $f(x,y)= \pi$ for all $xy>1$.
A: The reason is that $\frac{\pi}{2} < |a+b| < \pi$. $|a+b| < \pi$ is easy to see.
Notice that when $x>0, y>0$, $a+b$ reaches minimum when $xy=1$. Also, $\tan^{-1} \frac{1}{x} = \cot^{-1} x$, and $\tan^{-1} x + \tan^{-1} \frac{1}{x} = \tan^{-1} x + \cot^{-1} x = \frac{\pi}{2}$.
Similarly, when $x<0, y<0$, we should have $-\pi$ instead of $\pi$.
A: Since $\arctan x >- \frac{\pi}{2}$ and the function is increasing, $xy<1$ would yield $$\arctan x + \arctan y < \arctan x + \arctan \frac{1}{x}=\frac{\pi}{2}< \pi + \arctan \frac{x+y}{1-xy}$$ if none of $x$ and $y$ is negative, or WLOG only $y$. If they are both negative we would have a negative LHS, while the RHS remains larger than $\frac{\pi}{2}$.
A: We know that (1+ix)(1+iy)=
     (1-xy) +(x+y)i ,  for all real x and y. Also we know that Arg (1+ia)=arctana ,where Arg stands for principle argument which lies between negative pie to positive pie, negative pie excluded.
Case 1: xy <1
Consider   (1+ix)(1+iy)=(1-xy) +(x+y)i
    Arg(1+ix)(1+iy)=Arg((1-xy) +(x+y)i)
      arctanx+arctany=arctan( (x+y)/1-xy)
Case2: 1-xy is negative and x>0, y>0  i.e.
       xy>1 , x>0,y>0
     then 
arctanx+arctany=
        pie + arctan( (x+y)/1-xy)
Case3: 1-xy is positive and x <0,y <0  i.e. xy>1,x <0,y <0
           arctanx+arctany =
         - pie + arctan( (x+y)/1-xy)

Case4:  1-xy=0, x>0 i.e. xy=1,x>0
               arctanx+arctany = 1/2 pie
Case5:  1-xy=0, x<0 i.e. xy=1,x<0
               arctanx+arctany =- 1/2 pie
I have considered all cases including the case which was asked. 
A: Here is an insight given by a purely geometrical proof. Consider the Figure below.

Supposing $x>0$, the right-angled triangle $\triangle ABC$ has sides $\overline{AB} = 1$ and $\overline{BC} = x$, so that
$$\alpha = \arctan x.$$
Extend side $AB$ with a segment $\overline{BD}=\frac{x}{y}$, giving
$$\gamma = \arctan y.$$
Now draw from $D$ the line segment $DH$ perpendicular to $AC$ and note that $\triangle ADH \sim \triangle ABC$, with a scaling factor given by 
$$\frac{\overline{AD}}{\overline{AC}} = \frac{x+y}{y\sqrt{1+x^2}}$$
yielding
$$\overline{DH} =\frac{x(x+y)}{y\sqrt{1+x^2}},$$
$$\overline{AH} = \frac{x+y}{y\sqrt{1+x^2}},$$
and
\begin{eqnarray}
\overline{CH} &=&\overline{AC}-\overline{AH}=\\
&=&\sqrt{1+x^2}- \frac{x+y}{y\sqrt{1+x^2}}=\\
&=& \boxed{\frac{x(xy-1)}{y\sqrt{1+x^2}}}.\tag{1}\label{boxed}
\end{eqnarray}
By definition finally we have
\begin{eqnarray}
\beta &=& \arctan\left( \frac{\overline{DH}}{\overline{CH}}\right)=\\
&=& \arctan\left(\frac{x+y}{xy-1}\right).
\end{eqnarray}
Which, once you plug in definitions of $\alpha$, $\beta$, and $\gamma$ in 
\begin{equation}\alpha+\beta+\gamma=\pi,\end{equation}
leads to your identity. 
When $x<0$ it is sufficient to to define $\overline{BC} = -x$ and then use symmetries of the $\arctan(\cdot)$ function.

The constraint, from this perspective, comes from the boxed equation \eqref{boxed}. If $xy<1$, that would lead to a negative number. As a matter of fact, this is because in this case $\beta$ would be obtuse and the altitude $DH$ would be external, yielding a slightly different formula for $\overline{DH}$ and thus $\beta$. You can figure out which one as an excersise.
