There exists a well-known formula by John Machin: $$\frac{\pi}{4} = 4 \arctan \left(\frac{1}{5}\right) - \arctan \left(\frac{1}{239}\right).$$ Actually, it belongs to the family of Machin-like formulas of the form $$\frac{\pi}4 = \sum_k a_k \arctan {b_k}^{-1}\quad\text{for some integers}\quad(a_k,b_k)$$

For example: $$\frac{\pi}{4} = \arctan \left(\frac{1}{2}\right) + \arctan \left(\frac{1}{3}\right) = 2 \arctan \left(\frac{1}{2}\right) - \arctan \left(\frac{1}{7}\right)$$ and so forth.

These formulas are quite easy to prove, but is there any easy way to generate such $(a_n, b_n)$?

  • $\begingroup$ I don't think diophantine equations would be a correct tag. $\endgroup$ – Aryabhata Jun 10 '11 at 17:20
  • $\begingroup$ @Aryabhatta, I disagree. $\endgroup$ – Gerry Myerson Jun 10 '11 at 23:44
  • $\begingroup$ @Gerry: Typically Diphonatine means polynomial, doesn't it? I may be mistaken, though. And of course, I suppose one could convert it by taking a tan on both sides. Please feel free to add it back. $\endgroup$ – Aryabhata Jun 10 '11 at 23:45
  • 2
    $\begingroup$ @Aryabhatta, there are some very famous Diophantine equations that are not polynomial, e.g., the Ramanujan-Nagell equation ($2^n-7=x^2$) and Catalan's equation ($x^m-y^n=1$). I'm inclined to call something diophantine if one insists on integer solutions, regardless of the form of the expressions involved. Sometimes it's called Diophantine even if rational solutions are allowed. $\endgroup$ – Gerry Myerson Jun 11 '11 at 0:03
  • $\begingroup$ @Gerry: Agreed and thanks for adding it back :-) $\endgroup$ – Aryabhata Jun 11 '11 at 0:07

The identity $\cot^{-1} x = 2 \cot^{-1} 2x - \cot^{-1} (4x^3 + 3x)$ can be used to generate an infinite number of these identities. (Got from the mathworld page: http://mathworld.wolfram.com/Machin-LikeFormulas.html, see equation 29)

  • $\begingroup$ Well, at least there is infinite number of such equations. $\endgroup$ – grep Jun 10 '11 at 20:34
  • 2
    $\begingroup$ I was most pleased when I discovered this formula for myself. I subsequently used $\pi = 32\cot ^{-1}10-4\cot ^{-1}239-16\cot ^{-1}515$ to calculate $\pi$ to about 10 places by hand. :) $\endgroup$ – PM 2Ring Feb 17 '16 at 6:15

The best way to understand identities like this is in terms of Gaussian integers -- complex numbers whose real and imaginary parts are integers.. I'll do some examples, and then explain the general setup.

For example, notice that we have the identity: $$(5+i)^4 = 476+480 i = 2 (1+i) (239+i). \quad (*)$$ (Just multiply it out and see.)

Multiplying complex numbers adds their arguments1. So $$4 \arg(5+i) = \arg(1+i) + \arg(239+i)$$ or $$4 \tan^{-1} \frac15 = \frac{\pi}{4} + \tan^{-1} \frac1{239}$$ as desired. Similarly, $(2+i)(3+i) = 5(1+i)$ explains another one of your identities.

In general, whenever we have $\prod (a_k+i)^{b_k} = r (1+i)$ for $r$ a positive real, we get $\sum b_k \tan^{-1} a_k^{-1} = \pi/4$.

So, how do we find formulas like $(*)$? The key point is that Gaussian integers, like ordinary integers, have unique factorization into primes. The primes in the Gaussian integers come in three flavors: (a) The prime $1+i$ (b) If $p$ is an integer prime which is $3 \mod 4$, then $p$ is also a prime in the Gaussian integers. (c) If $p$ is an integer prime which is $1 \mod 4$, then we can write $p$ as $(q+ri)(q-ri)$, and $q+ri$ and $q-r_i$ will be both prime in the Gaussian integers. Also, the powers of $i$ are units which should be ignored in prime factorizations, just like $-1$ in the ordinary integers.

Whenever we have an identity like $(*)$, we must have the same prime factors on both sides. For example, $(239+i) = (3-2i)^4 (1+i) \cdot i$, $5+i = (3-2i)(1+i)$ and $2 = (1+i)^2 (-i)$, so both sides of $(*)$ are $(3-2i)^4 (1+i)^4$.

The way that I would find more identities like this would be to take a whole bunch of numbers of the form $a_k+i$ and factor them in the Gaussian integers. Then I'd look for some way to multiply them together so that the resulting power of $1+i$ is odd, and such that the exponent of $q+ri$ is equal to the exponent of $q-ri$ for all primes $q \pm ri$ of type (c). This will make $\prod (a_k+i)^{b_k}$ into something of the form $(1+i)^{\mathrm{odd}} (\mbox{something real})$. Using $(1+i)^2 = 2i$, we can turn this into $\prod (a_k+i)^{b_k} = (1+i) (\mbox{something either purely real or purely imaginary})$, and thus find a new formula for $\pi/4$.

Note that finding $b$'s with the specified properties is a matter of linear algebra, as I will show in the example below.

Example: Suppose I wanted a formula involving $\tan^{-1} (1/2)$, $\tan^{-1} (1/5)$ and $\tan^{-1}(1/8)$. (I'm cheating: I happen to know such a thing exists. A more realistic example would be to start out with $\tan^{-1}(1/b)$, for $b$ ranging from $2$ to $10$, and then see which subset works. But that would be too time consuming to write up here.)

Here are the factorizations in the Gaussian integers: $$2+i \ \mbox{is prime}$$ $$5+i = (1+i)(3-2i)$$ $$8+i = (3+2i)(2-i)$$

So $$(2+i)^{b_1} (5+i)^{b_2} (8+i)^{b_3} = (1+i)^{b_2} (2+i)^{b_1} (2-i)^{b_3} (3-2i)^{b_2} (3+2i)^{b_3}.$$

I want $b_2$ to be odd, $b_1=b_3$ and $b_2=b_3$. A little bit of linear algebra finds the solution $b_1=b_2=b_3 =1$. So I discover the identity $$(2+i)(5+i)(8+i) = 65 (1+i)$$ and $$\tan^{-1} \frac12 + \tan^{-1} \frac15 + \tan^{-1} \frac18 = \frac{\pi}{4}.$$

1 This formula might be off by an integer multiple of $2\pi$. See Joel Cohen's comment below. But I assume you are just as happy with a formula for $\pi/4+2 k \pi$.

  • 3
    $\begingroup$ I'm nitpicking a bit, but in principle, shouldn't Gaussian integers give you a formula modulo $2 \pi$ (after which you'd easily adjust the multiple of $2\pi$ using a very rough estimate) ? $\endgroup$ – Joel Cohen Jun 10 '11 at 20:05
  • $\begingroup$ Yup, thanks for noting that. $\endgroup$ – David E Speyer Jun 10 '11 at 20:18
  • $\begingroup$ Thank you for the comment. Yes, I understand that checking Machin-like formulas is very simple. The question is how to find them. Just direct bruteforcing of a's with some clever search of degrees is a bit too slow $\endgroup$ – grep Jun 10 '11 at 20:32
  • $\begingroup$ @grep Does my explanation of how to use Gaussian factorizaton to find such identities not respond to that? $\endgroup$ – David E Speyer Jun 11 '11 at 12:29
  • $\begingroup$ This paper has a discussion of the relationship between Machin identities and Gaussian integers. $\endgroup$ – J. M. is a poor mathematician Dec 16 '11 at 8:43

For 2-terms formulas, I've computed a generalized formula which is, I think, more efficient than any other existing Machin's formula. see my post: generalized 2-terms Machin's formula (an efficient way to compute $\pi$)


Your Answer

