Assume the heptagon below is regular.enter image description here

Each of the angles marked with red below is $\frac{\pi}{7}$. Troughout this question I will use $\gamma$ to mark $\cos\frac{\pi}{7}$. By the cosine law we have $b = 2 a \gamma$, $c = \frac{a}{\sqrt{2(1-\gamma)}}$ and $a^2 = b^2+c^2-2bc\gamma$. If we replace $b$ and $c$ with the expressions in terms of $a$ and $\gamma$ in the third equation we derive an equation in terms of $a$ and $\gamma$ only. So to compute $\gamma$ all we have to do is solve that equation correct? But observe the results given by Mathematica:

enter image description here

None of the real solutions to the equation gives the correct value of $\cos\frac{\pi}{7}$ so my question is why doesn't this method produce the value of $\cos\frac{\pi}{7}$ ?

  • $\begingroup$ Some of those solutions could appear imaginary but in reality the imaginary part could cancel out. Try evaluating all of them. $\endgroup$ – Matt Samuel Mar 18 '16 at 22:37
  • $\begingroup$ I don't understand where formula $c=a/\sqrt{2(1-\gamma)}$ comes from. $\endgroup$ – Jean Marie Mar 18 '16 at 22:38
  • $\begingroup$ @JeanMarie We have $a^2 = c^2+c^2-2c\times c\times \gamma$ $\endgroup$ – alexgiorev Mar 18 '16 at 22:39
  • $\begingroup$ @MattSamuel I tried evaluating them but they come out imaginary, not real. $\endgroup$ – alexgiorev Mar 18 '16 at 22:40
  • 1
    $\begingroup$ see mathworld.wolfram.com/TrigonometryAnglesPi7.html $\endgroup$ – Jean Marie Mar 18 '16 at 22:43

I'm unsure as to why Solve[] is failing here, but using NSolve[] appeared to work:

c = a/Sqrt[2 (1 - g)];
b = 2 a g;
NSolve[a^2 == b^2 + c^2 - 2 b c g, g]

This returned

{{g -> -0.62349}, {g -> 0.5}, {g -> 0.809017}, {g -> 0.900969}

where $\cos \frac\pi7\approx 0.900969$

The two complex answers that Solve[] returned for you have a rather small imaginary part... on the order of $10^{-17}$. Perhaps this is floating point error? I'm unsure how Mathematica does this computation, but you might be best off asking on their Exchange. The first of the complex answers appears to be the one you're seeking:

N[1/6 (1 + 7^(2/3)/(1/2 (-1 + 3 I Sqrt[3]))^(
1/3) + (7/2 (-1 + 3 I Sqrt[3]))^(1/3))]

0.900969 + 3.70074*10^-17 I
  • 1
    $\begingroup$ Solve[] isn't "failing" at all. What fails is the assumption that you will get nice real radicals for $cos(\pi/7)$. You don't, and anyone familiar with the casus irreducibilis will not be surprised. $\endgroup$ – Oscar Lanzi Mar 20 '16 at 1:35
  • $\begingroup$ @OscarLanzi Fail was a really poor choice of word, wasn't it? Thanks for pointing out the misconception... In context, the given results shouldn't be so surprising. $\endgroup$ – zahbaz Mar 20 '16 at 5:50

I entered the system of equations in Mathematica, with the assumption $a=1$ (without loss of generality) using NSolve instead of Solve:

a = 1; NSolve[{2(1 - g)c^2 == a^2, b == 2 a g, a^2 == b^2 + c^2 - 2b 
c g}, {b, c, g}]


{{b -> -1.246979603717468, c -> 0.5549581320873703, g -> -0.623489801858734},

{b -> \0.4450418679126293, c -> -0.801937735804839, g -> 0.22252093395631464},

{b -> \1.80193773580484, c -> 2.24697960371747, g -> 0.90096886790242}, 

{b -> \1.6180339887498938, c -> 1.6180339887498942, g -> 0.8090169943749469},

{b -> 1.0000000000000002, c -> 1., g -> 0.5000000000000001}, 

{b -> -0.6180339887498955, c -> -0.6180339887498949, g ->-0.30901699437494773}}

Among the valuable solutions (we don't consider those having negative values), it is the third triple that corresponds to $g=\cos\pi/7$.

Remarks: The fourth one corresponds to $g=\cos\pi/5$ (case 1). The fifth line corresponds to $g=\cos\pi/3$ (case 2). Why are these spurious cases present?

Let us detail Case 1): If you draw the figure of a pentagon you will see that you can write down for the induced triangulation with 3 triangles exactly the same equations, with $b=c=$ golden ratio.


The values given by Mathematica are correct, as some comments point out. The third one in the list is a radical form for $cos(\pi/7)$. Such trigonometric radicals involve complex arguments unless the denominator in the argument corresponds to a power of 2 times zero or more distinct Fermat primes.

The equation itself has an interesting property. If we eliminate $a, b, c$ and clear radicals and fractions we get a sixth degree polynomial equation, yet numerical methods find only four roots. The two missing roots are those for which the $2bc\gamma$ term has the reversed sign. When $a, b, c$ are eliminated, that last term still contains a square root, which is responsible for the sign reversal.

A list of all six roots, each with the sign appearing before the last term:

$cos(\pi/3)=1/2, -$ (the given sign)

$cos(\pi/5)=(\sqrt{5}+1)/4, -$

$cos(3\pi/5)=(-\sqrt{5}+1)/4, +$ (the reversed sign)

$cos(\pi/7), -$

$cos(3\pi/7), +$

$cos(5\pi/7), -$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.