Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I thought up the problem of finding a regular $n$-sided polygon that has a diagonal with lenght $d_k$ such that the area of the polygon equals ${d_k}^2$. By doing some easy trigonometry within the polygon I got the equation $$8\sin^2\left(\frac{(k+1)\pi}{n}\right)=n\sin\left(\frac{2\pi}{n}\right).$$ Where $d_k$ is the length of the diagonal which skips $k$ vertices. (So $d_0$ is just the length of one side.)

I have checked some values of $n$ and it seems that $(4,0)$ and $(12,3)$ are the only (primitive and non-trivial) possible values for $(n,k)$.

But how can I verify whether this is true?

One approach is rewriting the equation using $\sin(x)=\frac i2(e^{-ix}-e^{ix})$. This gives $$4t^{2k+2}-int^{k+2}-8t^{k+1}+int^k+4=0,$$ where I set $t=e^{\frac{2\pi i}n}$ for clarity.

share|cite|improve this question
maple found for $n \le 100$ only solutions for which $n=4,12$. For $n=4$ we have $k=0,2,4,6,...$ while for $n=12$ we have $k=3,7,15,19,...$ the pattern repeating mod 12. – coffeemath Jan 25 '13 at 13:49
Perhaps squaring both sides and then using an automorphism approach similar to… works. If this method works out I'll post a follow-up answer but unfortunately I don't have time right now to try it. – dinoboy Jan 25 '13 at 17:12
I think the solutions $(12,3)$ and $(12,7)$ are the same, just going opposite ways around. Similarly, $(4,0)$ is one side and $(4,2)$ is the other side. Based on your original problem, you demand $k \le n-2$ and solutions $k$ and $n-2-k$ are equivalent. – Ross Millikan Mar 28 '13 at 16:48
OK now tell me, why the downvote? Let's go through the list of what makes a good question: I included pretty much all my work. I gave a motivation for the equation. I mentioned its source ("I thought up..."). Ok I didn't give my background, but does that really interest you? I guess I shouldn't give the definition of the sine or integers or anything else I used. I used MathJax, wrote a good title and tagged correctly, IMHO; the question is clear without the title. So consider updating that topic if there's something else you want me to do. – barto Sep 6 '15 at 18:51

(4,0) and (12,3) are the only "primitive and non-trivial" solutions $(n,k)$ with $n\leq 10^5$.

Considering the symmetries that are present both in your geometry question and in the resulting equation, let a "primitive and non-trivial" solution be a pair $(n,k)$ with $n,k\in \mathbb{Z}$, $n\geq 3$, and $0\leq k \leq n/2 - 1$, satisfying$$8\sin^2\left(\frac{(k+1)\pi}{n}\right)=n\sin\left(\frac{2\pi}{n}\right).$$ The fact that $k$ can be restricted to a finite interval for each $n$ opens the problem up for a direct numerical search. Here's my implementation in PARI/GP:


\\ We express the problem in terms of m,n, where m=k+1.
\\ We only call the (slow) sin function once for each computation of the LHS.
lhs(m,n)={sqrt_lhs=sin(m*Pi/n); sqrt_lhs*sqrt_lhs;}

\\ Check m,n for |LHS-RHS| < TOLERANCE
for(n=N_MIN,N_MAX,cur_rhs=rhs(n); if(n%N_BLOCKSIZE==0,printf("# Done checking all n<%u\n", n)); for(m=1,n/2,{
    if(abs(cur_lhs-cur_rhs)<TOLERANCE, printf("%u\t%u\t%e\n", n, m-1, cur_lhs-cur_rhs))

Note: If I'm not mistaken, this is guaranteed to find all solutions $(m,n)$ with $n<n_\max = 10^5$, even though floating point math is used (assuming there are no bugs in PARI/GP or my computer). The point is that PARI/GP claims a default precision of 38 decimal digits, while the tolerance for root-finding in the above code is equivalence to 20 decimal digits. If you calculate the error propagation assuming 38-digit precision for the sin functions, the maximum absolute error after the few arithmetic operations per $n,m$ pair is still on the order of $10^{-38}$. The code can in principle give false positives if the RHS and LHS aren't equal but happen to be within the tolerance of one another, but it can't give false negatives. (In fact for these parameters there were no false positives, either.)

Update: Here is an implementation in C using 128-bit floating point arithmetic:

#include <stdio.h>
#include <quadmath.h>

// To compile: gcc -O3 -std=c99 -lquadmath trig.c -o trig

#define M_2PIq 6.2831853071795864769252867665590058q

#define N_MIN 3
#define N_MAX 2000
#define N_BLOCKSIZE 100
#define TOLERANCE 1e-20q
#define DIGITS 35

int main(){

  // We express the problem in terms of m,n, where m=k+1.
  for(unsigned n=N_MIN; n<=N_MAX; n++){

    // Print out a status update each N_BLOCKSIZE iterations.
    if(n%N_BLOCKSIZE==0) printf("# Done checking all n<%u\n", n);

    // Compute the RHS only once per n
    __float128 cur_rhs = sinq(M_2PIq/n)*n/8.0q;
    for(unsigned m=1; 2*m<=n; m++){

      // We only call the (slow) sin function once for each computation of the LHS.
      __float128 cur_lhs=sinq(m*M_PIq/n);

      // Print out (n,k) if a solution is found
      if( fabsq(cur_lhs-cur_rhs) < TOLERANCE ){
        char str_difference[DIGITS];
        quadmath_snprintf(str_difference, DIGITS, "%Qe", fabsq(cur_lhs-cur_rhs));
        printf("%u\t%u\t%s\n", n, m-1, str_difference); 

share|cite|improve this answer
Instead of iterating over possible values of $m$ for every $n$, one can rewrite the equation as $m=\frac{n}{2\pi}\arccos (1-\frac{n}{4}\sin\frac{2\pi}{n})$ and just check if the resulting value is close enough to an integer. This allows one to extend the check all the way to $n_\mathrm{max}=10^7$ in a few minutes. – Peter Košinár Dec 21 '13 at 0:34

Small remark: It is clear that if pair $(n,k)$ with $0\le k<\left\lfloor\frac{n}{2}\right\rfloor$ satisfies the equality then pairs $(n, k+nt)$ and $(n, n-2-k+nt)$ also satisfy it (where $t\in\mathbb{Z^+}$).

As @Peter Košinár noted this equality is equivalent to $$4\cos\left(\frac{2\pi(k+1)}{n}\right)+n\sin\left(\frac{2\pi}{n}\right)=4$$ so for known $n$ the value of $k$ can be found as $$k=\frac{n}{2\pi}\arccos\left(1−\frac{n}{4}\sin \frac{2\pi}{n}\right)-1$$ If $\frac{n}{2\pi}\arccos\left(1−\frac{n}{4}\sin \frac{2\pi}{n}\right)$ is an integer then an appropriate pair is found.

The simple program written in C++ (which uses the type long double for calculations) gives the following pairs $(n,k)$ for $n\le 10^9$:

         n         k
         4         0
        12         3
 104758793  36318061
 211160884  73205826
 211708650  73395727
 317015209 109903690
 423417300 146791455
 423965066 146981356
 634030418 219807381
 742623573 257454750
 846286834 293393010
 846834600 293582911
 847382366 293772812
 847930132 293962713
 848477898 294152614
 952688925 330280775
 953236691 330470676
 953784457 330660577
 954332223 330850478
 954879989 331040379

Is it a result of the errors of numerical calculations or not? I don't know.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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