# Ramanujan-type trigonometric identities with cube roots, generalizing $\sqrt{\cos(2\pi/7)}+\sqrt{\cos(4\pi/7)}+\sqrt{\cos(8\pi/7)}$

Ramanujan found the following trigonometric identity \begin{equation} \sqrt{\cos\bigl(\tfrac{2\pi}7\bigr)}+ \sqrt{\cos\bigl(\tfrac{4\pi}7\bigr)}+ \sqrt{\cos\bigl(\tfrac{8\pi}7\bigr)}= \sqrt{\tfrac{5-3\sqrt7}2} \end{equation} (see e.g. Ramanujan — For Lowbrows, (3.7) and around, for details and an analogue for 9 instead of 7).

Are there analogous identities for all primes $p$ of the form $3k+1$ instead of 7?

Let me try to explain what I mean. As I've learned from S. Markelov, for $p=13$ \begin{multline} \sqrt{\cos\bigl(\tfrac{2\pi}{13}\bigr)+\cos\bigl(\tfrac{10\pi}{13}\bigr)}+ \sqrt{\cos\bigl(\tfrac{4\pi}{13}\bigr)+\cos\bigl(\tfrac{6\pi}{13}\bigr)}+ \sqrt{\cos\bigl(\tfrac{8\pi}{13}\bigr)+\cos\bigl(\tfrac{12\pi}{13}\bigr)}=\\ \sqrt{\tfrac{3\sqrt{13}-7}2} \end{multline} and there are close analogues for all $p$ of the form $n^2+n+1$. For example, for $p=43=6^2+6+1$ three groups of numerators are {2, 4, 8, 16, 22, 32, 42}, {6, 10, 12, 20, 24, 38, 40}, {14, 18, 26, 28, 30, 34, 36} and the sum is $\sqrt{\frac{3\sqrt{86}-13}2}$.

So it looks like there is some pattern reminding of... quadratic Gauss sums, perhaps.

For any $p=3k+1$ one can partition $\mathbb F_p^\times$ into three groups, corresponding to $\mathbb F_p^\times/\mathbb F_p^{\times3}\cong\mathbb Z/3$ — and this is precisely the partitions from the last paragraph. This explains what LHS should look like. And indeed, at least for $p=19$ there is an identity \begin{multline} \sqrt{\cos\bigl(\tfrac{\pi}{19}\bigr)+\cos\bigl(\tfrac{7\pi}{19}\bigr)+\cos\bigl(\tfrac{11\pi}{19}\bigr)}+ \sqrt{\cos\bigl(\tfrac{3\pi}{19}\bigr)+\cos\bigl(\tfrac{5\pi}{19}\bigr)+\cos\bigl(\tfrac{17\pi}{19}\bigr)}+\\ \sqrt{\cos\bigl(\tfrac{9\pi}{19}\bigr)+\cos\bigl(\tfrac{13\pi}{19}\bigr)+\cos\bigl(\tfrac{15\pi}{19}\bigr)}=\\ \sqrt{\tfrac12-3\sqrt7+\tfrac32\sqrt{3\sqrt{49}+18\sqrt7-25}+\tfrac32\sqrt{3\sqrt{49}+18\sqrt7-44}} \end{multline} which is closely related to the fact that $2 \left( \cos \frac{4\pi}{19} + \cos \frac{6\pi}{19}+\cos \frac{10\pi}{19} \right)$ is a root of the equation $\sqrt{ 4+ \sqrt{ 4 + \sqrt{ 4-x}}}=x$.

So,

more precisely: is it true, that for any $p=3k+1$ the sum of 3 cubic roots of sum of cosines (described above) can be expressed in real radicals?

• (Answers to more informal question just what's going on here? would also be appreciated.) – Grigory M Jan 19 '14 at 18:30
• – lab bhattacharjee Jan 20 '14 at 5:46
• @GrigoryM: The thingie with $\cos(\pi/19)$ can be generalized. Kindly see this post. – Tito Piezas III Dec 13 '14 at 5:16
• A lot of neat stuff here. I upvoted everybody. – marty cohen Jun 27 '16 at 15:20
• @GrigoryM: Noam Elkies has finally found an analogous quintic that uses $\cos \pi/11$. See this MO post. – Tito Piezas III Aug 2 '16 at 19:21

$\color{brown}{Update:}$

The question is: Is it true, that for any $p=3k+1$ the sum of 3 cubic roots of sum of cosines can be expressed in real radicals?

The answer is Yes. In general, given the roots $x_i$ of the general cubic equation,

$$x^3+ax^2+bx+c=0\tag0$$

then sums involving the cube roots of the $x_i$ can be given in the simple form,

$$(u+x_1)^{1/3}+(u+x_2)^{1/3}+(u+x_3)^{1/3} = \big(w+3\,\sqrt{d}\,^{1/3}\big)^{1/3}$$

where $u,w$ are the constants,

$$u = \frac{ab-9c+\sqrt{d}}{2(a^2-3b)}$$

$$w = -\frac{(2a^3-9ab+27c)+9\sqrt{d}}{2(a^2-3b)}$$

and $d$ is the negated discriminant $D$,

$$d = -D = \tfrac{1}{27}\Bigl(4(a^2-3b)^3-(2a^3-9ab+27c)^2\Bigr)$$

1. If $d$ is positive, meaning the discriminant $D$ is negative, so the cubic has all real roots, thus $u,w$ are also real.
2. Furthermore, if the cubic has a cyclic group, which is the case when it involves the $p$th root of unity, then $d$ is a square, so $u,w$ in fact are rational.
3. The case $a^2-3b=0$ implies $d =-(a^3-27c)^2$, so $+D$, hence only one root $x_1$ is real.

Example. If we use the cubic for $\cos(2\pi/7)$, namely $x^3 + x^2 - 2x - 1 = 0$, then we have either $u = 0$ or $1$, since $\pm\sqrt{d} = 7$. So using the negative and positive case respectively, we get,

$$\sqrt{2\cos\bigl(\tfrac{2\pi}{7}\bigr)}+\sqrt{2\cos\bigl(\tfrac{4\pi}{7}\bigr)}+\sqrt{2\cos\bigl(\tfrac{8\pi}{7}\bigr)} = \sqrt{5\color{blue}{-}3\,\sqrt{7}}$$

$$\sqrt{1+2\cos\bigl(\tfrac{2\pi}{7}\bigr)}+\sqrt{1+2\cos\bigl(\tfrac{4\pi}{7}\bigr)}+\sqrt{1+2\cos\bigl(\tfrac{8\pi}{7}\bigr)} = \sqrt{-4\color{blue}{+}3\,\sqrt{7}}$$

and so on for other $p=6m+1$, covering my old addendum for $p=19$.

$\color{brown}{Old\; answer:}$

The general phenomenon can be explained by a beautiful cubic identity found by, of course, Ramanujan. {Grigori M, ironically, you pointed out this identity in an old question of mine. :) }

I. Given the three roots $x_i$ of,

$$x^3-ax^2+bx-1 = 0\tag1$$

then,

$$x_1^{1/3}+x_2^{1/3}+x_3^{1/3} = (a+6+3t)^{1/3}\tag2$$

where $t$ is a root of,

$$t^3-3(a+b+3)t-\big(ab+6(a+b)+9\big) = 0\tag3$$

The form of the $p=19$ suggests it is just a particular case of this identity. Note that,

$$y=2\Bigl(\cos\bigl(\tfrac{\pi}{19}\bigr)+\cos\bigl(\tfrac{7\pi}{19}\bigr)+\cos\bigl(\tfrac{11\pi}{19}\bigr)\Bigr)$$

(and the other two similar expressions) is a root of,

$$y^3+y^2-6y-7=0$$

One can then scale variables and make the constant term $c=-1$. I did so, and got the exact form as the one above.

II. Note that if $a+b+3=0$, then $(3)$ takes a particularly simple form. After some manipulation, I found that given,

$$x^3 + x^2 - (3 n^2 + n)x + n^3=0\tag4$$

then,

$$F_P = x_1^{1/3}+x_2^{1/3}+x_3^{1/3} = \sqrt{-(6n+1)+3\sqrt{nP}}\tag5$$

where $P = 9n^2+3n+1$. For $n = -1, 1, -2, 2$, we get the same cubics satisfied by the sums of cosines for $P=7,13,31,43,\dots$ thus explaining the simple sums,

$$F_7 =-\sqrt{-5+3\sqrt{7}}$$

$$F_{13} = \sqrt{-7+3\sqrt{13}}$$

and so on, though I cannot prove that the roots of $(4)$ are always sums of cosines when $P$ is prime. Maybe I'll ask it as a separate question.

• @GrigoryM: I've now asked the question here. – Tito Piezas III Dec 14 '14 at 19:30
• I actually used the cubic for $p=19$ and got the same result as the guy from artofproblemsolving. Since the cubic is $y^3+y^2-6y-7=0$, you have to scale it by $y = 7^{1/3}x$ which explains the 3rd level of cube roots. I'm 100% sure he used Ramanujan's identity, but didn't tell, tsk, tsk. – Tito Piezas III Dec 14 '14 at 20:59
• Thank you. I need to think about it for some time. – Grigory M Dec 14 '14 at 21:34
• One note, if $a^2 - 3b = 0$, then the cubic $x^3 + ax^2 + bx + c$ can be written as $x^3 + 3\frac{a}{3}x^2 + 3\left(\frac{a}{3}\right)^2 x + \left(\frac{a}{3}\right)^3 + c - \left(\frac{a}{3}\right)^3$, and that means your cubic is just $(x-h)^3 + k$ for appropriate $h,k$. – Gregory Dresden Aug 22 '17 at 3:00
• @TitoPiezasIII, I have some other comments & questions but I'll send them to you in an email. – Gregory Dresden Aug 22 '17 at 3:06

$\color{blue}{\text{Edited 9 Jun 2017:}}$

Let $p$ be a prime number congruent to 1 modulo 6, and $g$ a primitive root modulo $p$, i.e. a generator of the group $\mathbb F_{p} ^ {\times} \cong C_{p-1}$. By definition, put $$S_p(g) = \sum_{k=0}^{\frac{p-4}3}\cos \left(\frac{2\pi}{p}g^{3k}\right) , S'_p(g) =\sum_{k=0}^{\frac{p-4}3}\cos \left(\frac{2\pi}{p}g^{3k+1}\right) \text{, } S''_p(g) = \sum_{k=0}^{\frac{p-4}3}\cos \left(\frac{2\pi}{p}g^{3k+2}\right) .$$

In this PDF we prove the following result.

Theorem 1. Suppose $p$ equals $9m^2+3m+1$ for some $m\in \mathbb Z$. Then for any primitive root $g$ we have $$\sqrt{S_p(g)} + \sqrt{S'_p(g)} + \sqrt{S''_p(g)} =\sqrt{ 3\sqrt{mp}-(6m+1) } .$$

Warning: I am not sure about my English. If you find some mistakes please write me.

I tried to find such rationals $a,b,c,d$ so that, $$(a+b\,x_1)^{1/3} + (a+b\,x_2)^{1/3} + (a+b\,x_3)^{1/3} = (c+\sqrt{dp})^{1‌​/3}$$ So, we have identities for all primes $p=1\ mod\ 3$ such that $p<100$ $$\sqrt{1+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k}) }+\sqrt{1+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k+1}) }+\sqrt{1+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k+2}) }=\sqrt{8-3\sqrt{19}}\qquad\\ \sqrt{-1+\sum_{k=0}^{11}\cos(\frac{2\pi }{37}\cdot2^{3k}) }+\sqrt{-1+\sum_{k=0}^{11}\cos(\frac{2\pi }{37}\cdot2^{3k+1}) }+\sqrt{-1+\sum_{k=0}^{11}\cos(\frac{2\pi }{37}\cdot2^{3k+2}) }=\sqrt{-10+3\sqrt{37}}\qquad\\ \sqrt{-1+\sum_{k=0}^{19}\cos(\frac{2\pi }{61}\cdot2^{3k}) }+\sqrt{-1+\sum_{k=0}^{19}\cos(\frac{2\pi }{61}\cdot2^{3k+1}) }+\sqrt{-1+\sum_{k=0}^{19}\cos(\frac{2\pi }{61}\cdot2^{3k+2}) }=\sqrt{14-3\sqrt{3\cdot 61}}\qquad\\$$

$$\sqrt{1+\sum_{k=0}^{21}\cos(\frac{2\pi }{67}\cdot2^{3k}) }+\sqrt{1+\sum_{k=0}^{21}\cos(\frac{2\pi }{67}\cdot2^{3k+1}) }+\sqrt{1+\sum_{k=0}^{21}\cos(\frac{2\pi }{67}\cdot2^{3k+2})}=\sqrt{-16+3\sqrt{3\cdot 67}}\qquad\\ \sqrt{-2+\sum_{k=0}^{25}\cos(\frac{2\pi }{79}\cdot3^{3k}) }+\sqrt{-2+\sum_{k=0}^{25}\cos(\frac{2\pi }{79}\cdot3^{3k+1})}+\sqrt{-2+\sum_{k=0}^{25}\cos(\frac{2\pi }{79}\cdot3^{3k+2})}=\sqrt{-13+3\sqrt{79}}\qquad\\ \sqrt{3+\sum_{k=0}^{31}\cos(\frac{2\pi }{97}\cdot5^{3k}) }+\sqrt{3+\sum_{k=0}^{31}\cos(\frac{2\pi }{97}\cdot5^{3k+1})}+\sqrt{3+\sum_{k=0}^{31}\cos(\frac{2\pi }{97}\cdot5^{3k+2})}=\sqrt{14-3\sqrt{97}}$$

$\color{blue}{\text{Added June 27:}}$

$$\sqrt{\frac{74}{43}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k}) }+\sqrt{\frac{74}{43}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+1}) }+\sqrt{\frac{74}{43}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+2}) }=\sqrt{\frac{392}{43}}$$ $$\sqrt{\frac{5105}{11349}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k}) }+\sqrt{\frac{5105}{11349}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+1}) }+\sqrt{\frac{5105}{11349}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+2}) }=\sqrt{\frac{21}{1261}}$$ $$\sqrt{-\frac{2306997866696}{1047656140569}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k}) }+\sqrt{-\frac{2306997866696}{1047656140569}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+1}) }+\sqrt{-\frac{2306997866696}{1047656140569}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+2}) }=-\sqrt{\frac{118149192000}{1908298981}}$$ $$\sqrt{\frac{9658771264742899051}{5361029308457632889}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k}) }+\sqrt{\frac{9658771264742899051}{5361029308457632889}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+1}) }+\sqrt{\frac{9658771264742899051}{5361029308457632889}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+2}) }=\sqrt{\frac{60079542508626277}{3881990809889669}}$$ $$\sqrt{\frac{1512950552654226074845360221799154}{22816093930106873589073278570630913}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k}) }+\sqrt{\frac{1512950552654226074845360221799154}{22816093930106873589073278570630913}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+1}) }+\sqrt{\frac{1512950552654226074845360221799154}{22816093930106873589073278570630913}+\sum_{k=0}^{1}\cos(\frac{2\pi }{7}\cdot3^{3k+2}) }=-\sqrt{\frac{9567191523845032860388297048}{16721690052047565734068821733}}$$ and so on.

• I already gave the general formula as $$(u+x_1)^{1/3} + (u+x_2)^{1/3} + (u+x_3)^{1/3} = (w+3\sqrt{d}\,^{1/3})^{1‌​/3}$$ where the $x_i$ are the roots of the cubic and $u,w$ are in terms of the coefficients. See answer above. But these explicit relations are also nice. – Tito Piezas III Jan 5 '16 at 18:16
• I didn't use this formula because it gives only one solution.I think there are two identities for any $p$ but I can't proove it. For example: $$\sqrt{1+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k}) }+\sqrt{1+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k+1}) }+\sqrt{1+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k+2}) }=\sqrt{8-3\sqrt{19}}\qquad \sqrt{2+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k}) }+\sqrt{2+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k+1}) }+\sqrt{2+\sum_{k=0}^{5}\cos(\frac{2\pi }{19}\cdot2^{3k+2}) }=\sqrt{-1+3\sqrt{19}}\qquad$$ – davidoff303 Jan 9 '16 at 16:30
• The formula actually gives two solutions by using $\pm\sqrt{d}$. In fact, I gave two solutions in the example in my answer, one for $+\sqrt{7}$ and the other for $-\sqrt{7}$. – Tito Piezas III Jan 9 '16 at 20:57
• You are right, I was inattentived. I solved some diophantine equation and my solutions are equal yours. – davidoff303 Jan 10 '16 at 8:03
• Do you think you can find anything if there is a $5$th power version, $$(u+x_1)^{1/5}+(u+x_2)^{1/5}+\dots+(u+x_5)^{1/5} = (p+q\sqrt{d})^{1/5}$$ – Tito Piezas III Jan 10 '16 at 12:11

Suppose $p=3k+1$. Then by a theorem of Gauss $4p=A^2+27B^2$ and cubic sums like $\displaystyle\sum_{t\in\mathbb Z/p}\cos\left(\frac{2\pi t^3}p\right)$ are roots of the equation $x^3-3px-Ap=0$. And if we have three roots $x_i$ of a cubic equation, Ramanujan's lemma gives the value of $\sqrt{x_1}+\sqrt{x_2}+\sqrt{x_3}$. That's precisely what's going on, I believe.

• I'll try to expand this answer later – Grigory M Jan 3 '15 at 23:44
• Related: upd. in math.stackexchange.com/q/102736 and math.stackexchange.com/a/31600 – Grigory M Jan 3 '15 at 23:48
• Ramanujan's lemma works for any cubic eqn. However, I'm suspecting that for prime $p=3m+1$ where the roots $x_i$ involve the $p$th root of unity thus are sums of cosines, then I think one can always find rationals $a,b,c,d$ to the identity, $$(a+b\,x_1)^{1/3}+(a+b\,x_2)^{1/3}+(a+b\,x_3)^{1/3}=\big(c+\sqrt{dp}\big)^{1/3}$$ There is a family of $p$ where $a=0$, and Ramanujan's $p=7$ was the simplest. – Tito Piezas III Jan 3 '15 at 23:55

(Addendum to my answer.) I just realized that given the $$p=19$$ identity cited by the OP,

$$\sqrt{\cos\bigl(\tfrac{\pi}{19}\bigr)+\cos\bigl(\tfrac{7\pi}{19}\bigr)+\cos\bigl(\tfrac{11\pi}{19}\bigr)}+\\ \sqrt{\cos\bigl(\tfrac{3\pi}{19}\bigr)+\cos\bigl(\tfrac{5\pi}{19}\bigr)+\cos\bigl(\tfrac{17\pi}{19}\bigr)}+\\ \sqrt{\cos\bigl(\tfrac{9\pi}{19}\bigr)+\cos\bigl(\tfrac{13\pi}{19}\bigr)+\cos\bigl(\tfrac{15\pi}{19}\bigr)}=\\ \sqrt{\tfrac12-3\sqrt7+\tfrac32\sqrt{3\sqrt{49}+18\sqrt7-25}+\tfrac32\sqrt{3\sqrt{49}+18\sqrt7-44}}=0.815731\dots$$

a small tweak can give a simpler, but different one,

$$\sqrt{ -\tfrac{1}{2}+\cos\bigl(\tfrac{\pi}{19}\bigr)+\cos\bigl(\tfrac{7\pi}{19}\bigr)+\cos\bigl(\tfrac{11\pi}{19}\bigr)}+\\ \sqrt{-\tfrac{1}{2}+\cos\bigl(\tfrac{3\pi}{19}\bigr)+\cos\bigl(\tfrac{5\pi}{19}\bigr)+\cos\bigl(\tfrac{17\pi}{19}\bigr)}+\\ \sqrt{-\tfrac{1}{2}+\cos\bigl(\tfrac{9\pi}{19}\bigr)+\cos\bigl(\tfrac{13\pi}{19}\bigr)+\cos\bigl(\tfrac{15\pi}{19}\bigr)}=\\ \sqrt{-4+\tfrac{3}{2}\sqrt{19}}=0.1375504\dots$$

It's because there is only a linear transformation between the cubic involved in,

$$\sqrt{ a+ \sqrt{ a + \sqrt{ a-x}}}=x$$

and the cubic for,

$$y_1^{1/3}+y_2^{1/3}+y_3^{1/3} = \sqrt{-(6n+1)+3\sqrt{nP}}$$

with $$P = 9n^2+3n+1$$, and we use $$n=\frac{1}{2}$$.

• haha $n = 1/2$ ? so that's what breaks the integral normal basis thing and get you those $-1/2$ constant coefficient ? – mercio Dec 31 '14 at 5:23