Q:

Derive $\log(a+b)=\log(a)-2\log\left(\cos\left(\arctan\left(\sqrt{\frac{b}{a}}\right)\right)\right)$

In the comments section of another post, MATHEMATIKER stated that
$$\log(a+b)=\log(a)-2\log\left(\cos\left(\arctan\left(\sqrt{\frac{b}{a}}\right)\right)\right)$$
if $b>a>0$.
I wish to know how this was derived, and if it can be extended to $b,a\in\mathbb{C}$.

A:

Nothing too magical is happening - it's just a few more mundane substitutions used in a surprising way. The first one is that we have $$\cos(\arctan(x))=\frac{1}{\sqrt{1+x^2}}$$
which can be seen easily from trigonometry - a right triangle with adjacent of length $1$ and opposite of length $x$ has that the tangent associated with the angle is $x$ and the cosine is $\frac{1}{\sqrt{1+x^2}}$. One can also retrieve this (up to sign) from the identities that $\sin(x)^2+\cos(x)^2=1$ and $\frac{\sin(x)}{\cos(x)}=\tan(x)$.
Then, the expression simplifies to 
$$\log(a+b)=\log(a)-2\log\left(\frac{1}{\sqrt{1+b/a}}\right)$$
Noting that $2\log(x)=\log(x^2)$ we get:
$$\log(a+b)=\log(a)-\log\left(\frac{1}{1+b/a}\right)$$
and since $-\log\left(\frac{1}x\right)=\log(x)$ we have
$$\log(a+b)=\log(a)+\log(1+b/a)$$
and using $\log(x)+\log(y)=\log(xy)$ gives
$$\log(a+b)=\log(a)+\log(b).$$
So, the derivation of the expression is just all the steps I listed, run in reverse.
Nothing goes terribly wrong when we try to extend to the complex plane. The principal issue is that $\arctan$ and $\log$ both have multiple branches. If we choose the wrong branch of $\arctan$, we can change the sign of the composition $\cos(\arctan(x))$, but the magnitude will be right. The fact that $\log$ has multiple branches just means that we have to be careful of multiples of $2\pi i$ coming out.

