# Proof of Bellard's formula

I'm reading Bellard's proof for his eponymous formula computing pi digits, and I can't get past the first line.

Given that:

• $$\displaystyle-\ln(1-x) = \sum_{n=1}^\infty \frac{x^n}{n}$$ for $$|x| < 1$$,
• $$\arctan(y) = \Im[-\ln(1-iy)]$$ for any real $$y$$

(I didn't know the last one but Wolfram Alpha agrees, so okay), the author gets

$$\arctan\left(\frac{1}{a-1}\right) = \Im\left[-\ln\left(1- \frac{1+i}{a}\right) \right] = \sum_{n=0}^\infty \frac{(-1)^n2^{2n}}{a^{4n+3}}\left( \frac{a^2}{4n+1} + \frac{2a}{4n+2} + \frac{2}{4n+3}\right)$$

In this equation, I don't even get the first equality, and assuming it to be correct, I don't see how to derive the second equality... I've tried expanding using Newton's theorem and expanding the binomial coefficients, but it did not work.

Any ideas?

EDIT

A friend nearly found the solution for the second equality (up to some mysterious sign error), and the first equality is actually invalid when $$a \in (0, 1)$$, according to Wolfram Alpha: on this interval, we rather have $$\arctan\left(\frac{1}{a-1}\right) = \Im\left[-\ln\left(1- \frac{1+i}{a}\right) \right] \color{red}{+ \pi}$$ .

So I still don't know why $$\arctan\left(\frac{1}{a-1}\right) = \Im\left[-\ln\left(1- \frac{1+i}{a}\right) \right]$$ for $$a \notin (0,1)$$, but given that Bellard uses $$a = 2$$, let's assume it's fine. However I'm interested if someone could find the solution to this problem.

Now, from $$\Im\left[-\ln\left(1- \frac{1+i}{a}\right) \right]$$ to $$\displaystyle\sum_{n=0}^\infty \frac{(-1)^n2^{2n}}{a^{4n+3}}\left( \frac{a^2}{4n+1} + \frac{2a}{4n+2} + \frac{2}{4n+3}\right)$$:

\begin{align*} -\ln\left(1 - \frac{1+i}{a}\right) &= \sum_{k=1}^\infty \frac{1}{k}\left(\frac{1+i}{a}\right)^k \\ &= \sum_{n=0}^\infty \left[ \frac{1}{4n+1} \left( \frac{1+i}{a}\right)^{4n+1} + \dotso + \frac{1}{4n+4} \left( \frac{1+i}{a}\right)^{4n+4}\right]\\ &= \sum_{n=0}^\infty\left( \frac{1+i}{a}\right)^{4n+1}\left[ \frac{1}{4n+1}+ \dotso + \frac{1}{4n+4}\left(\frac{1+i}{a}\right)^3 \right] \end{align*}

We remark that $$1 + i = \sqrt{2} e^{i\pi / 4}$$ so :

\begin{align*} -\ln\left(1 - \frac{1+i}{a}\right) &= \sum_{n=0}^\infty \frac{\left( \sqrt{2} e^{i \pi/4}\right)^{4n+1}}{a^{4n+1}}\left[ \frac{1}{4n+1}+ \dotso + \frac{1}{4n+4}\frac{\left( \sqrt{2} e^{i \pi/4}\right)^3}{a^3} \right]\\ &=\sum_{n=0}^\infty \frac{2^{2n}(-1)^n}{a^{4n+1}}\left[ \frac{\left( \sqrt{2} e^{i \pi/4}\right)}{4n+1}+ \dotso + \frac{1}{4n+4}\frac{\left( \sqrt{2} e^{i \pi/4}\right)^4}{a^3} \right]\\ \end{align*}

Taking the imaginary part, knowing $$\sqrt{2} e^{i \pi/4} = 1+i$$ and $$(1+i)^2 = 2i$$, $$(1+i)^3 = 2 - 2i$$ and $$(1+i)^4 = -2$$:

\begin{align*} \Im \left[-\ln\left(1 - \frac{1+i}{a}\right)\right] &= \sum_{n=0}^\infty \frac{2^{2n}(-1)^n}{a^{4n+1}}\left[ \frac{1}{4n+1}+ \frac{2}{4n+2}\frac{1}{a} - \frac{2}{4n+3} \frac{1}{a^2}\right]\\ &= \sum_{n=0}^\infty \frac{2^{2n}(-1)^n}{a^{4n+3}}\left[ \frac{a^2}{4n+1}+ \frac{2a}{4n+2} \color{red}- \frac{2}{4n+3}\right]\\ \end{align*}

So everything is good, except for the last minus sign...

1. The $$\operatorname{arctan}$$ formulas.

Consider what it means for a complex number $$u$$ to be a logarithm of $$z$$: essentially, that $$e^u = z$$.

Since $$e^u = e^{\Re u + i \Im u} = e^{\Re u} e^{i\Im u} = r e^{i \theta}$$ you see that pretty much by definition, $$\Im \ln(z) = \Im u = \theta$$ is the angular component of $$z$$ in the complex plane.

Now, take the point $$z = 1-iy$$, is it an elementary trigonometric exercise to check that the angle forme between the real axis and $$z$$ is $$\theta$$ such that $$\tan\theta = -y$$. By the above remark this means exactly that $$\Im \ln(1-iy) = \arctan(-y)$$.

Since $$\arctan$$ is an odd function, this means that $$-\Im \ln(1-iy) = \arctan(y)$$.

The very same argument works for $$z = 1 - (1+i)/a$$. Indeed, this time we have

\begin{align*} \tan \theta & = \frac{\Im z}{\Re z} \\ & = \frac{-1/a}{1 - 1/a} \\ & = \frac{-1}{a - 1} \end{align*} And therefore, $$-\Im\ln(1 - (1+i)/a) = \arctan(1/(a-1))$$.

2. The summation formula

You have it right, except that $$(1+i)^3 = 2i(1+i) = -2 + 2i$$. And not $$2 - 2i$$ as you wrote, which was the source of this erroneous sign.

Well done! For additional fun formulas and the rationale behind them (in French), you can have a look at this pdf from the olden days.