Entry 109 in Gauss's diary (and the related material in Gauss's Nachlass) is the main subject of David Cox's famous article "The Arithmetic-Geometric mean of Gauss". This entry deals with the agm of two complex numbers $a,b$, taken as a multi-valued function. It reads as follows:

Between two given numbers there are always infinitely many means both arithmetic-geometric and harmonic-geometric, the observation of whose mutual connection has been a source of happiness for us.

The harmonic-geometric mean of two numbers $a,b$ (which we denote as $H(a,b)$) is $M(a^{-1},b^{-1})^{-1}$. According to Cox, this entry is a continuation of a previous study of the agm, which resulted in the following relation between the infinitely many values of the agm: $$ (1)\qquad \frac{1}{(\mu)} = \frac{1}{M(a,b)}+\frac{4ik}{M(a,\sqrt{a^2-b^2})}. $$ Relation (1) is not the most general formula for the different values of the agm - this is written as: $$ (2) \qquad\frac{1}{(\mu)} = \frac{d}{M(a,b)}+\frac{ic}{M(a,\sqrt{a^2-b^2})}, $$ where d and c are relatively prime numbers and $d \equiv 1\pmod{{4}}, c\equiv 0\pmod{{4}}$. The main purpose of part 3 of Cox's article is to check if Gauss only knew (1) or that he even knew (2) (Gauss never stated (2)). Looking into diary entry 109 in volume 10-1, I saw an additional piece of evidence that is not considered at Cox's article; this is a footnote that Gauss writes next to this entry, and reads in Latin as:

Terminus constans expressionis $$\frac{Ad\phi}{\sqrt{f+2g\cos\phi + h\cos^2\phi}}$$ est Medium Geometrico harmonicum inter $$\frac{A}{\sqrt{\frac{\sqrt{(f+h)^2-4g^2} + f-h}{2}}}$$ et $$\frac{A}{((f+h)^2-4g^2)^{\frac{1}{4}}}$$.

Now, after a lot of effort, I deciphered what was Gauss's intention in his cryptic Latin expression "Terminus constans expressionis" - the Latin phrase "Terminus constans expressionis" seems to mean the "constant term" $A$ in the Fourier expansion of the expression $\frac{1}{\sqrt{f+2g\cos\phi+h\cos^2\phi}}$, (the trigonometric series $A+A'\cos\phi+A''\cos2\phi+...$) which is actually equal to $\frac{1}{\pi}\int_0^{\pi}\frac{d\phi}{\sqrt{f+2g\cos\phi+h\cos^2\phi}}$. This interpretation of Gauss's Latin is consistent with Gauss's notation in other places in his writings - for example, in p.52 of Cox's article, Cox mentions Gauss's result that $\frac{2}{\pi}\int_0^{\pi/2}\frac{d\phi}{\sqrt{1+\mu \cos^2\phi}} = M(\sqrt{1+\mu},1)^{-1}$ - a result that Gauss describes by using the same Latin expression (the meaning of this result is that the constant term in the Fourier expansion of $\frac{1}{\sqrt{1+\mu \cos^2\phi}}$ is $M(\sqrt{1+\mu},1)^{-1}$).

Note that the Gaussian result that is mentioned in Cox's article is a very special case of Gauss's much more general result stated in his Latin footnote; put $f = 1, g =0 , h = \mu$, and you will get this special case.

**Classification of the integral in Gauss's footnote**

By employing the substitution $t = \tan(\frac{\phi}{2})$ (the "universal trigonometric substitution") Gauss's integral can be brought into the form: $$ \int_0^{\pi}\frac{d\phi}{\sqrt{f+2g\cos\phi + h\cos^2\phi}}= \int_0^{\infty}\frac{2dt}{(1+t^2)\sqrt{f+2g\frac{1-t^2}{1+t^2} + h(\frac{1-t^2}{1+t^2})^2}} = \int_0^{\infty}\frac{2dt}{\sqrt{(f+2g+h)+(2f-2h)t^2+(f-2g+h)t^4}}. $$ The denominator of the integrand is therefore a square root of a fourth degree polynomial - and this is the definition of a specific case of elliptic integral. In addition, substitution $x = t^2, 2dt = \frac{dx}{\sqrt{x}}$, brings the denominator into the form of a square root of a cubic:

$$\int_0^{\infty}\frac{dx}{\sqrt{(f+2g+h)x+(2f-2h)x^2+(f-2g+h)x^3}}$$

and every cubic of the form $a_0x^3+a_1x^2+a_2x$ can be transformed into Weierstrass normal form $4s^3-g_2s-g_3$ under the following suitable change of variables:

$$s = (\frac{a_0}{4})^{\frac{1}{3}}x+\frac{a_1}{3(\frac{a_0}{4})^{\frac{2}{3}}}$$

$$g_2 = \frac{\frac{4a_1^2}{3a_0}-a_2}{(\frac{a_0}{4})^{\frac{1}{3}}}$$

$$g_3 = \frac{36a_0a_1a_2-32a_1^3}{27a_0^2}$$

Therefore, Gauss's result is possibly about broadening the concept of the AGM algorithm to a wider class of integrals.

**Special cases of Gauss's hgm formula, numerical verification**

Note also that in the special cases where $h=1, f = g^2$, than we have to calculate the harmonic-geometric mean of two equal numbers equal to $\frac{1}{\sqrt{g^2-1}}$, a prediction that was verified by me by calculating specific integrals on Wolfram Alpha; for example, if $h=1, g=2, f = 4$, than the result of the integral is $\frac{1}{\sqrt{3}}$. This shouldn't come as a surprise, because in this case the indefinite integral is elementary (one can see it directly via the "universal trigonometric substitution"), and it's also evident from the fact that the hgm algorithm was not really needed here.

The significance of Gauss's formula appears clearly in cases when there is a need to run the hgm algorithm. For example, if we take $h = 1, g =5, f = 24$, than: $$ M(\sqrt{\frac{\sqrt{(f+h)^2-4g^2}+f-h}{2}},((f+h)^2-4g^2)^{1/4})^{-1} = M(\sqrt{\frac{\sqrt{525}+23}{2}},(525)^{1/4})^{-1} = 0.208811, $$ and this numerical result is in exact accordance with a calculation of the integral $\frac{1}{\pi}\int_0^{\pi}\frac{d\phi}{\sqrt{24+10cos\phi+cos^2\phi}}$ on Wolfram Alpha.

**Questions regarding Gauss's hgm formula**

Therefore my questions are:

- I'm trying to put Gauss's result in context, but I didn't find articles connecting this specific elliptic integral to the AGM algorithm. Therefore, I'd like to know if this result is known to the mathematical community. Maybe some of the mathematicians here who are familiar with the theory of elliptic integrals can see the connection.
- Schlesinger remarks that the expression "has been a source of happiness for us" was a kind of code-expression that Gauss used to refer to new results in number theory, and speculates that the appearence of this expression in diary entry 109 means that Gauss understood the connection between this note and the theory of binary quadratic forms. Also, the notation of Gauss in his footnote (he uses $f,g,h$) reminds one of his notation for quadratic forms. So, is there any relation of this footnote to binary quadratic forms?

1more comment