# General formula for $\arctan$

The question is to express $$\arctan a_1+ \arctan a_2 + \dots + \arctan a_n$$ as $\arctan(\cdot)$ I tried using the formula for the corresponding $\tan$ series but couldn't generalise to all cases.The principal branch is taken as $(-\pi/2,\pi/2)$.

Any ideas?

Hint: Let $z_n=1+ia_n$ then $\arctan a_n=\arg z_n$ and $$\arctan a_1+ \arctan a_2 + \dots + \arctan a_n=\arg(\prod_{k=1}^n z_k)=\arctan \dfrac{{\bf Im}\ {w}}{{\bf Re}\ {w}}$$ where $\displaystyle w=\prod_{k=1}^n z_k$.

• The final result should be $\arctan\dfrac{\Im a}{\Re a}$. – Yves Daoust Aug 14 '18 at 7:37
• Yes, a good point! thanks. – Nosrati Aug 14 '18 at 7:39

Use the addition formula $$\arctan a_1 + \arctan a_2=\arctan\left(\frac{a_1+a_2}{1-a_1a_2}\right)\quad (\text{mod}\,\pi)$$ In general, working in modulo $\pi$:

If $n=2k, k\in\mathbb{N}$: $$\sum_{n=1}^{2k}\arctan a_n=\arctan\left({\sum_{j=1}^k\left[(-1)^{j-1}\left(\sum_{\text{cyc}}\prod_{i=1}^{2j-1}a_i\right)\right]}\over{1-\sum_{j=1}^k\left[(-1)^{j-1}\left(\sum_{\text{cyc}}\prod_{i=1}^{2j}a_i\right)\right]}\right)$$

If $n=2k+1, k\in\mathbb{N}$: $$\sum_{n=1}^{2k+1}\arctan a_n=\arctan\left(\frac{\sum_{j=0}^k\left[(-1)^j\left(\sum_{\text{cyc}}\prod_{i=1}^{2j+1}a_i\right)\right]}{1-\sum_{j=1}^k\left[(-1)^j\left(\sum_{\text{cyc}}\prod_{i=1}^{2j}a_i\right)\right]}\right)$$

• $\arctan\sqrt{3}+\arctan\sqrt{3}=2\pi/3$; on the other hand $\arctan\bigl((\sqrt{3}+\sqrt{3})/(1-\sqrt{3}\sqrt{3})\bigr)=-\arctan\sqrt{3}=-\pi/3$. – egreg Dec 23 '17 at 16:39

Hint:

$$\tan(\arctan a+\arctan b+\arctan c)=\frac{\dfrac{a+b}{1-ab}+c}{1-\dfrac{a+b}{1-ab}c} =\dfrac{a+b+c-abc}{1-ab-bc-ca}$$

and

$$\tan(\arctan a+\arctan b+\arctan c+\arctan d) \\=\frac{{\dfrac{a+b+c-abc}{1-ab-bc-ca}}+d}{1-\dfrac{a+b+c-abc}{1-ab-bc-ca}d} \\=\dfrac{a+b+c+d-abc-bcd-cda-dab}{1-ab-bc-cd-da-ac-bd-ca+abcd}.$$

A regular pattern seems to emerge. We can write a recurrent form

$$\tan\left(\arctan\frac{p_{n-1}}{q_{n-1}}+\arctan a_n\right)=\frac{\dfrac{p_{n-1}}{q_{n-1}}+a_n}{1-\dfrac{p_{n-1}}{q_{n-1}}a_n}=\frac{p_{n-1}+q_{n-1}a_n}{q_{n-1}-p_{n-1}a_n}$$

and

$$\begin{cases}p_n=p_{n-1}+q_{n-1}a_n,\\q_n=q_{n-1}-p_{n-1}a_n.\end{cases}$$

From an operational point of view, this is equivalent to Nosrati's formula, where the product will be computed incrementally. The fully expanded formulas are complicated and computationally inefficient.