Sum of arctan identity question

A student asks, can you prove the following identity, and is it well known?


 * arctan((x2-y2)/(2xy))+2arctan(y/x)=pi/2

Graeme's answer:

It turns out this identity comes up quite naturally by expanding 2arctan(y/x) into a single arctan using the "sum of arctan" form of the "tan of sum" identity. I'm not sure if it's well known, though. Here's how I approached it:

General Tan of Sum formula:
 * tan(A+B) = (tan(A)+tan(B)) / (1-tan(A)tan(B))

Now, let x=tan(A) and y=tan(B), so arctan(x)=A and arctan(y)=B, and then take the arctan of both sides, giving you
 * arctan(x)+arctan(y) = arctan((x+y) / (1-xy))

Using this to find 2arctan(x), we get
 * 2arctan(x) = arctan(2x/(1-x2))

Replacing x with y/x to find 2arctan(y/x), we get
 * 2arctan(y/x) = arctan(2y/x/(1-y2/x2)) = arctan(2xy/(x2-y2))

So the left-hand-side of the identity to be proven is:
 * arctan((x2-y2)/(2xy))+arctan(2xy/(x2-y2))

The sum of arctans of reciprocals is pi/2, proving the identity.

An interesting side-effect of this investigation is that
 * arctan((x2-y2)/(2xy))+arctan(y/x)=arctan(x/y),

which you can see in two ways.

First, since we showed arctan((x2-y2)/(2xy))+2arctan(y/x)=pi/2, we can subtract arctan(y/x) from both sides, giving us
 * arctan((x2-y2)/(2xy))+arctan(y/x)=pi/2-arctan(y/x)=arctan(x/y)

by the arctan-of-reciprocals rule

Second, we can start with the arctan identity, replacing x with (x2-y2)/(2xy) and replacing y with y/x, we get
 * arctan((x2-y2)/(2xy))+arctan(y/x) = arctan(((x2-y2)/(2xy)+y/x) / (1-(x2-y2)/(2xy)(y/x))) = arctan(x/y)