Inverse Trig Identity Proof under different conditions I am trying to understand how the inverse trigonometric identities below work/are derived:
$$\tan^{-1}(x)+\tan^{-1}(y)=\tan^{-1}\left(\frac{x+y}{1-xy}\right)\\ xy<1$$
The above identity has a proof that depends on the identity for $\tan(x)+\tan(y)$, which I have seen in my textbook, and I understand.
$$\tan^{-1}(x)+\tan^{-1}(y)=\pi + \tan^{-1}\left(\frac{x+y}{1-xy}\right)\\xy>1$$
This one is mentioned in the book, but not proved.
I can understand the logic behind it, since

*

*if the angles related to $x$ and $y$ are such that the angle related to $x+y$ will be in the second quadrant, then it is not possible for the $\tan^{-1}$ to ever give a correct output

*For $x>0,y>0$ if $xy>1$, then $1-xy<0\Rightarrow\frac{x+y}{1-xy}<0$, and that will give an answer in the fourth quadrant, whereas we likely want one in the second quadrant.

However, this is just intuition. Some questions I have:

*

*where does the $xy>1$ come in? How is it established/proved?

*where does the $\pi$ factor come in?

*is it possible to see a complete proof for both cases of the property.

 A: The identity in your book only holds for when $x > 0, y > 0$: else $\arctan x + \arctan y =$ $\arctan \left(\frac{x+y}{1-xy} \right) - \pi$ instead where $x < 0$ and $y < 0$ (the two cases where $xy > 1$).
The reason is in the sign of $\frac{x+y}{1-xy}$. If $\frac{x+y}{1-xy} > 0$, we either have $x + y > 0$ and $1 - xy > 0$, which implies $y > -x$ and $1 > xy$. In other words, this is the region in between the two branches of $xy = 1$ above the line $y = -x$:

and the region where $\frac{x + y}{1 - xy} < 0$ is the complementary region, not including the line $y = -x$ as that is where $x + y = 0 \implies \frac{x + y}{1 - xy} = 0$.
So when $xy > 1$, $\frac{x+y}{1-xy}$ is negative, and so $\arctan \frac{x+y}{1-xy}$ is also negative, where the domain of $\arctan x$ is the real numbers. But when $x > 0$ and $y > 0$, $\arctan x + \arctan y$ is positive while $\arctan \frac{x+y}{1-xy}$ is negative!
$\arctan x + \arctan y$ will also be greater than $\arctan x + \arctan(1/x) = \pi/2$, and this value is attained (as the infinium) considering that $\arctan 1 + \arctan 1 = \pi/2$. This is because we can think of the choice of $x, y$ as a set of level curves $xy = k$ where $k$ is real: $xy = 1.1, xy = 1.2$ etc. It remains to show that $\arctan x$ is monotonically increasing, so $\arctan(1.1/x) > \arctan(1/x)$ etc. To show this, consider $\tan x$ where $-\frac{\pi}{2} < x < \frac{\pi}{2}$ and reflect it over the line $y = x$.
Hence the right branch of $\arctan x$ to use is the one with range $f(x) \in (\pi/2, 3 \pi/2)$, which is the inverse function of $\tan x$ when $\frac{\pi}{2} < x < \frac{3 \pi}{2}$:

Compared to the branch of $\tan x$ where $\arctan x$ is usually defined: $f(x) \in (-\pi/2, \pi/2)$, this is a shift of $+\pi$. Hence the formula for $x > 0$ and $y > 0$ has a $+ \pi$ added to it.
A: Here is a proof for $xy>1 $:
Note that the identity $\tan(\tan^{-1} x+\tan^{-1} y)=\frac{x+y}{1-xy}$
leads to
$$\tan^{-1} x+\tan^{-1} y= k\pi + \tan^{-1}\frac{x+y}{1-xy} $$
In the case of $x,y>0$, $xy>1\implies y>\frac1{x}$
$$\pi > \tan^{-1} x+\tan^{-1} y > \tan^{-1} x+\tan^{-1} \frac1{x}
= \frac\pi2$$
Thus
$$\tan^{-1} x+\tan^{-1} y=\pi+\tan^{-1}\frac{x+y}{1-xy}$$
