How can one prove $-\arctan\left(\frac{x}{y}\right)+\pi H(y)=2\arctan\left(\frac{y}{\sqrt{x^2+y^2}+x}\right)+\frac{\pi}{2}$? How can one prove the following?
$$
-\arctan\left(\frac{x}{y}\right)+\pi H(y)=2\arctan\left(\frac{y}{\sqrt{x^2+y^2}+x}\right)+\frac{\pi}{2}$$
with $H(x)$ the Heaviside function.
I have the impression that this might follow from the following
$$H(y)=H(-x)+2H(x)H(y)-H(xy)$$
and
$$\arctan\left(\frac{x}{y}\right)+\arctan\left(\frac{y}{x}\right)=\pi H(xy)-\frac{\pi}{2}$$
but I can't quite get it right...
 A: Using calculus  and derivatives is fast but doesn't show the simplicity of this kind of angle relationships.
Start with the case $x>0$. Then consider the following figure

If $y>0$, let the right-angled triangle $\triangle ABC$ have sides $\overline{AB} = y$ and $\overline{BC} = x$, so that
$$\alpha = \arctan \left(\frac{x}{y}\right).$$
Extend $BC$ to a segment $\overline{CD} = \overline{AC} = \sqrt{x^2+y^2}$. Thus 
$$\beta = \arctan\left(\frac{y}{\sqrt{x^2+y^2}+x}\right).$$ 
Using now the fact that $\triangle ACD$ is isosceles you easily get
$$(\alpha + \beta) + \beta = \frac{\pi}{2}$$
which gives
$$2 \arctan\left(\frac{y}{\sqrt{x^2+y^2}+x}\right) + \arctan \left(\frac{x}{y}\right) = \frac{\pi}{2},$$
that is exactly your relationship.
If $y<0$, than just use the same triangle but define $\overline{AB} = -y$ and use the symmetries
$$\alpha = \arctan \left(-\frac{x}{y}\right) = -\arctan \left(\frac{x}{y}\right),$$
and
$$\beta = \arctan\left(-\frac{y}{\sqrt{x^2+y^2}+x}\right)= -\arctan\left(\frac{y}{\sqrt{x^2+y^2}+x}\right).$$
If $x<0$ you can work with the Figure below.

Here $\overline{BC} = -x$, $\overline{AB} = |y|$, and $BC$ is extended to a segment $\overline{BD} = \sqrt{x^2+y^2} + x$. $\triangle ACD$ is isosceles and the relationship between $\alpha$ and $\beta$ is therefore
$$\beta + (\beta - \alpha) = \frac{\pi}{2}.$$
Define $\alpha$ and $\beta$ correctly, depending on the sign of $y$, and you'll get again your relationship.
$\blacksquare$
A: For $y>0$ you'd like to prove that
$$
\frac{\pi}{2}-\arctan\frac{x}{y}=2\arctan\frac{y}{\sqrt{x^2+y^2}+x}
$$
Note that the left-hand side is a number in the interval $[0,\pi]$ and the same for the right-hand side. The identity is true for $x=0$.
Suppose $x>0$, so both sides are in $(0,\pi/2)$. Then take the tangent of both sides; if $z=y/(\sqrt{x^2+y^2}+x)$, the identity to prove is
$$
\frac{y}{x}=\frac{2z}{1-z^2}
$$
For simplicity, set $D=\sqrt{x^2+y^2}$; then
$$
1-z^2=1-\frac{y^2}{2x^2+y^2+2xD}=\frac{2x^2+2xD}{2x^2+y^2+2xD}=\frac{2x(x+D)}{(D+x)^2}=
\frac{2x}{D+x}
$$
Hence
$$
\frac{2z}{1-z^2}=\frac{2y}{D+x}\frac{D+x}{2x}=\frac{y}{x}
$$
Suppose now $x<0$ and set $x=-t$; then the identity to prove is
$$
\frac{\pi}{2}+\arctan\frac{t}{y}=2\arctan\frac{y}{\sqrt{t^2+y^2}-t}=
2\arctan\frac{\sqrt{t^2+y^2}+t}{y}
$$
Recall that $\arctan\frac{1}{u}=\pi/2-\arctan u$ (for $u>0$), so the identity to prove is
$$
\frac{\pi}{2}+\arctan\frac{t}{y}=\pi-\arctan\frac{y}{\sqrt{t^2+y^2}+t}
$$
that's already been proved.
For $y<0$ you want to prove that
$$
-\frac{\pi}{2}-\arctan\frac{x}{y}=2\arctan\frac{y}{\sqrt{x^2+y^2}+x}
$$
Changing $y=-z$, the identity becomes
$$
-\frac{\pi}{2}+\arctan\frac{x}{z}=-2\arctan\frac{z}{\sqrt{x^2+z^2}+x}
$$
that has already been proved.
A: Differentiate both sides of your identity with respect to $x$ while keeping $y$ constant. Then the Heaviside, not depending on $x$, will disappear. After some algebra you should see that the derivatives of the left and right hand sides coincide. Then all you need is to check that the identity is true for one particular value of $x$ and you can choose $x=0$ for that.
