Photonic Logo
Projects Blog About

Embedding Regular Polygons in a 2D Integer Lattice

19 July 2025

Contents
  • The Problem
  • A Transformation
  • Rational Values of Sine and Cosine
  • Consequences
  • Image Credits
  • Footnotes

This question popped up in my mind one fine day, and I couldn’t stop thinking about it. So here’s a blog post about it.

The Problem

Find all n≥3n \geq 3n≥3 such that nnn points can be chosen in a 2D integer lattice to form a regular nnn-gon.

Okay, let us unpack what this is asking.

  • A lattice refers to the subset of points in Rd\mathbb{R}^dRd where the coordinates are integer values1. In particular, a 2D integer lattice is the subset of points (x,y)(x,y)(x,y) in R2\mathbb{R}^2R2 such that xxx and yyy are both integers.
  • A regular nnn-gon refers to a polygon of nnn sides (e.g., triangle, rectangle, pentagon) whose sides are of equal length and all internal angles are of equal measure. Common examples of regular nnn-gons are equilateral triangles and squares.

So we are asking for all values of n≥3n \geq 3n≥3 such that the points (x1,y1)(x_1,y_1)(x1​,y1​), (x2,y2)(x_2,y_2)(x2​,y2​), …, (xn,yn)(x_n, y_n)(xn​,yn​) form a regular nnn-gon, where each of the coordinates are integers.

There is an obvious value of nnn for which this applies: n=4n = 4n=4, the case for which our polygon is a square. There are in fact an infinite number of squares that meet our requirement above. But the challenge is to find other values of nnn that work (if they exist).

Another subtle challenge is that there are multiple orientations to consider when drawing the polygons. Just because a polygon doesn’t work for one orientation doesn’t mean that we can’t find any if the shape is rotated.

A Transformation

To deal with these challenges at the same time, let us consider how the points are located for a regular nnn-gon.

As discussed above, an nnn-gon consists of nnn sides of equal length and nnn internal angles which are of equal measure. But consider what this means for the vertices of the nnn-gon — because the nnn internal angles are of equal measure, that means that the angle between each of the nnn points must be the same. Since there are 2π2\pi2π radians (360∘360^\circ360∘ degrees) in a full revolution, thus each angle between the points must be 2πn\frac{2\pi}{n}n2π​ radians.

Angles Between Points on a Regular Polygon
Angles Between Points on a Regular Polygon

Now let us think about how we can ‘move’ from one point to another on an nnn-gon. More generally, how do we rotate a point in the 2D plane by α\alphaα radians about the centre (i.e., origin)? We will use the idea of polar coordinates to help us with this. Instead of writing the coordinates of a point using xxx and yyy, we will specify the distance from the origin, typically denoted rrr (for the radius of the circle that the point lies on) and the angle between the positive xxx-axis and the point, typically denoted θ\thetaθ.

Suppose a point has the coordinates (x,y)(x,y)(x,y). By the Pythagorean theorem, the distance from the origin is r=x2+y2r=\sqrt{x^2+y^2}r=x2+y2​. Using trigonometry, one also sees that the angle made between the positive xxx-axis and the point is θ=tan⁡−1(yx)\theta=\tan^{-1}\left(\frac yx\right)θ=tan−1(xy​)2. To convert polar coordinates back to Cartesian coordinates, one can simply use the formulae x=rcos⁡θx = r\cos\thetax=rcosθ and y=rsin⁡θy=r\sin\thetay=rsinθ.

Converting From Cartesian to Polar Coordinates
Converting From Cartesian to Polar Coordinates

So what happens when we rotate a point by an angle α\alphaα about the origin? The point is still a distance rrr from the origin, but the angle between the positive xxx-axis and the point is now θ+α\theta+\alphaθ+α. In Cartesian coordinates, the point will have the new coordinates x′=rcos⁡(θ+α)x' = r\cos(\theta+\alpha)x′=rcos(θ+α) and y′=rsin⁡(θ+α)y' = r\sin(\theta+\alpha)y′=rsin(θ+α). Using the angle addition formulae for sine and cosine, we see that

x′=rcos⁡(θ+α)=r(cos⁡θcos⁡α−sin⁡θsin⁡α)=xcos⁡α−ysin⁡αy′=rsin⁡(θ+α)=r(sin⁡θcos⁡α+cos⁡θsin⁡α)=xsin⁡α+ycos⁡α\begin{align*} x' &= r\cos(\theta+\alpha) = r\left(\cos\theta\cos\alpha - \sin\theta\sin\alpha\right) = x\cos\alpha - y\sin\alpha\\ y' &= r\sin(\theta+\alpha) = r\left(\sin\theta\cos\alpha + \cos\theta\sin\alpha\right) = x\sin\alpha + y\cos\alpha \end{align*} x′y′​=rcos(θ+α)=r(cosθcosα−sinθsinα)=xcosα−ysinα=rsin(θ+α)=r(sinθcosα+cosθsinα)=xsinα+ycosα​

So, rotating a point P(x,y)P(x,y)P(x,y) about the origin by α\alphaα will result in the point P′P'P′ with coordinates (xcos⁡α−ysin⁡α,xsin⁡α+ycos⁡α)(x\cos\alpha - y\sin\alpha, x\sin\alpha + y\cos\alpha)(xcosα−ysinα,xsinα+ycosα)3.

Back in our original problem, to ‘move’ from one point to another means to rotate that point by a multiple of 2πn\frac{2\pi}nn2π​. So, starting from a point (x,y)(x,y)(x,y) on the regular nnn-gon, another point on that nnn-gon must be

(xcos⁡(2kπn)−ysin⁡(2kπn),xsin⁡(2kπn)+ycos⁡(2kπn))\left(x\cos\left(\frac{2k\pi}n\right) - y\sin\left(\frac{2k\pi}n\right), x\sin\left(\frac{2k\pi}n\right) + y\cos\left(\frac{2k\pi}n\right)\right) (xcos(n2kπ​)−ysin(n2kπ​),xsin(n2kπ​)+ycos(n2kπ​))

where k∈{1,2,…,n−1}k \in \{1,2,\dots,n-1\}k∈{1,2,…,n−1}.

As we will soon see, this will lead to a problem if we want all points to have integer coordinates.

Rational Values of Sine and Cosine

The challenge lies in making sine and cosine rational. Before we reveal what the core result is, let us examine a lemma.

Lemma. There exists a polynomial Fn(x)F_n(x)Fn​(x) such that

Fn(2cos⁡t)=2cos⁡ntF_n(2\cos t) = 2\cos nt Fn​(2cost)=2cosnt

for all n≥1n \geq 1n≥1, where the degree of Fn(x)F_n(x)Fn​(x) is nnn and Fn(x)F_n(x)Fn​(x) is a monic polynomial (i.e., the leading coefficient is 1) with integer coefficients.

This claim is readily proven using mathematical induction on nnn. Let us first cover two base cases. For n=1n=1n=1, note that the polynomial F1(x)=xF_1(x) = xF1​(x)=x clearly works. For n=2n = 2n=2, we note that the polynomial F2(x)=x2−2F_2(x) = x^2 - 2F2​(x)=x2−2 works because

(2cos⁡t)2−2=4cos⁡2t−2=4(12(cos⁡2t+1))−2=(2cos⁡2t+2)−2=2cos⁡2t\begin{align*} (2\cos t)^2 - 2 &= 4\cos^2 t - 2\\ &= 4\left(\frac12 (\cos2t + 1)\right) - 2\\ &= (2\cos2t + 2) - 2\\ &= 2\cos2t \end{align*} (2cost)2−2​=4cos2t−2=4(21​(cos2t+1))−2=(2cos2t+2)−2=2cos2t​

Now let’s assume that the lemma holds for kkk and k+1k + 1k+1 for some k≥1k \geq 1k≥1. We will show that the lemma holds for the k+2k+2k+2 case. Observe that, by the sum of cosines formula, we get

2(cos⁡((k+1)t))(cos⁡t)=cos⁡((k+2)t)+cos⁡kt2(\cos((k+1)t))(\cos t) = \cos((k+2)t)+\cos kt 2(cos((k+1)t))(cost)=cos((k+2)t)+coskt

which means

cos⁡((k+2)t)=2(cos⁡((k+1)t))(cos⁡t)−cos⁡kt\cos((k+2)t) = 2(\cos((k+1)t))(\cos t) - \cos kt cos((k+2)t)=2(cos((k+1)t))(cost)−coskt

and therefore

2cos⁡((k+2)t)=(2cos⁡((k+1)t))(2cos⁡t)−2cos⁡kt.2\cos((k+2)t) = (2\cos((k+1)t))(2\cos t) - 2\cos kt. 2cos((k+2)t)=(2cos((k+1)t))(2cost)−2coskt.

Hence,

Fk+2(x)=xFk+1(x)−Fk(x)F_{k+2}(x) = xF_{k+1}(x) - F_k(x) Fk+2​(x)=xFk+1​(x)−Fk​(x)

works, with Fk+2(x)F_{k+2}(x)Fk+2​(x) having degree k+2k+2k+2. Also, the leading coefficient of Fk+2(x)F_{k+2}(x)Fk+2​(x) is the same as the leading coefficient of Fk+1(x)F_{k+1}(x)Fk+1​(x), which is, by assumption, 1. Therefore, by induction, the lemma is proven. ∎

With this lemma we can prove the main result.

Theorem. The only values of θ\thetaθ, where 0≤θ≤π20 \leq \theta \leq \frac\pi20≤θ≤2π​, such that both θπ\frac\theta\piπθ​ and cos⁡θ\cos\thetacosθ are rational are θ=0\theta = 0θ=0 (and cos⁡θ=1\cos\theta = 1cosθ=1), θ=π3\theta = \frac\pi3θ=3π​ (and cos⁡θ=12\cos\theta = \frac12cosθ=21​), and θ=π2\theta = \frac\pi2θ=2π​ (and cos⁡θ=0\cos\theta = 0cosθ=0).

This result is quite surprising, but the proof is not too complicated. Suppose θπ\frac\theta\piπθ​ is rational, so we can write θ=2πkn\theta = \frac{2\pi k}{n}θ=n2πk​ where kkk and nnn are both integers4 with n≥1n \geq 1n≥1. Suppose c=2cos⁡θc = 2\cos\thetac=2cosθ is rational. By the lemma, we observe that

Fn(c)=Fn(2cos⁡2πkn)=2cos⁡2πk=2F_n(c) = F_n\left(2\cos\frac{2\pi k}{n}\right) = 2\cos2\pi k = 2 Fn​(c)=Fn​(2cosn2πk​)=2cos2πk=2

which means that ccc is a root of Fn(x)−2F_n(x) - 2Fn​(x)−2. Since ccc is rational, and Fn(x)−2F_n(x) - 2Fn​(x)−2 is a monic polynomial with integer coefficients, thus the Rational Root Theorem tells us that ccc must be an integer.

However, note that ∣c∣=∣2cos⁡θ∣≤2|c| = |2\cos\theta| \leq 2∣c∣=∣2cosθ∣≤2 since −1≤cos⁡θ≤1-1 \leq \cos \theta \leq 1−1≤cosθ≤1. Therefore, the only possible values that ccc can take are -2, -1, 0, 1, and 2. Thus one must conclude that cos⁡θ∈{−1,−12,0,12,1}\cos \theta \in \{-1,-\frac12,0,\frac12,1\}cosθ∈{−1,−21​,0,21​,1}. Given that θ\thetaθ is between 000 and π2\frac\pi22π​ inclusive, this means that cos⁡θ∈{0,12,1}\cos\theta \in \{0, \frac12, 1\}cosθ∈{0,21​,1} with θ∈{0,π3,π2}\theta \in \{0, \frac\pi3, \frac\pi2\}θ∈{0,3π​,2π​}. ∎

One might deduce the following corollary from the above theorem, often called Niven’s Theorem5.

Corollary. The only values of θ\thetaθ, where 0≤θ≤π20 \leq \theta \leq \frac\pi20≤θ≤2π​, such that both θπ\frac\theta\piπθ​ and sin⁡θ\sin\thetasinθ are rational are θ=0\theta = 0θ=0 (and sin⁡θ=0\sin\theta = 0sinθ=0), θ=π6\theta = \frac\pi6θ=6π​ (and sin⁡θ=12\sin\theta = \frac12sinθ=21​), and θ=π2\theta = \frac\pi2θ=2π​ (and sin⁡θ=1\sin\theta = 1sinθ=1).

The proof is quite simple. Let α=π2−θ\alpha = \frac\pi2 - \thetaα=2π​−θ, so 0≤α≤π20 \leq \alpha \leq \frac\pi20≤α≤2π​. By the theorem above we know that cos⁡(α)=cos⁡(π2−θ)=sin⁡θ\cos(\alpha) = \cos\left(\frac\pi2 - \theta\right) = \sin\thetacos(α)=cos(2π​−θ)=sinθ is rational only when α=0\alpha = 0α=0 (which means θ=π2\theta = \frac\pi2θ=2π​), α=π3\alpha = \frac\pi3α=3π​ (which means θ=π6\theta=\frac\pi6θ=6π​), or α=π2\alpha=\frac\pi2α=2π​ (which means θ=0\theta=0θ=0). Consequently the values of sin⁡θ\sin\thetasinθ that are rational are 000, 12\frac1221​, and 111. ∎

Consequences

Returning to our problem, what does this theorem tell us? Recall that if a point (x,y)(x,y)(x,y) lies on the nnn-gon, then

(xcos⁡(2kπn)−ysin⁡(2kπn),xsin⁡(2kπn)+ycos⁡(2kπn))\left(x\cos\left(\frac{2k\pi}n\right) - y\sin\left(\frac{2k\pi}n\right), x\sin\left(\frac{2k\pi}n\right) + y\cos\left(\frac{2k\pi}n\right)\right) (xcos(n2kπ​)−ysin(n2kπ​),xsin(n2kπ​)+ycos(n2kπ​))

is another point on the nnn-gon. We also want all the points on the nnn-gon to be integers, which means that both xcos⁡(2kπn)−ysin⁡(2kπn)x\cos\left(\frac{2k\pi}n\right) - y\sin\left(\frac{2k\pi}n\right)xcos(n2kπ​)−ysin(n2kπ​) and xsin⁡(2kπn)+ycos⁡(2kπn)x\sin\left(\frac{2k\pi}n\right) + y\cos\left(\frac{2k\pi}n\right)xsin(n2kπ​)+ycos(n2kπ​) need to be integers. Let us just focus on xsin⁡(2kπn)+ycos⁡(2kπn)x\sin\left(\frac{2k\pi}n\right) + y\cos\left(\frac{2k\pi}n\right)xsin(n2kπ​)+ycos(n2kπ​). We know two things.

  • By the above theorem, cos⁡(2kπn)\cos\left(\frac{2k\pi}n\right)cos(n2kπ​) can only be rational when 2kπn=0\frac{2k\pi}n = 0n2kπ​=0 (which is impossible since k≥1k \geq 1k≥1), 2kπn=π3\frac{2k\pi}n = \frac\pi3n2kπ​=3π​, or 2kπn=π2\frac{2k\pi}n = \frac\pi2n2kπ​=2π​.
  • By the above corollary (Niven’s Theorem), sin⁡(2kπn)\sin\left(\frac{2k\pi}n\right)sin(n2kπ​) can only be rational when 2kπn=0\frac{2k\pi}n = 0n2kπ​=0 (again, impossible since k≥1k \geq 1k≥1), 2kπn=π6\frac{2k\pi}n = \frac\pi6n2kπ​=6π​, or 2kπn=π2\frac{2k\pi}n = \frac\pi2n2kπ​=2π​.

Thus, for xsin⁡(2kπn)+ycos⁡(2kπn)x\sin\left(\frac{2k\pi}n\right) + y\cos\left(\frac{2k\pi}n\right)xsin(n2kπ​)+ycos(n2kπ​) to be rational, we must have 2kπn=π2\frac{2k\pi}n = \frac\pi2n2kπ​=2π​. Regardless of the value of nnn, we need consecutive points on the nnn-gon to work, i.e. the case of k=1k = 1k=1 needs to work. For that case we have 2πn=π2\frac{2\pi}n = \frac\pi2n2π​=2π​ which means that n=4n = 4n=4, i.e. a square.

In conclusion: the only nnn (where n≥3n \geq 3n≥3) such that nnn points can be chosen in a 2D integer lattice to form a regular nnn-gon is n=4n = 4n=4, which is the (boring) case of the square.

Image Credits

Cover image by D koi on Unsplash. Cropped from the original.

Footnotes

  1. A lattice in general refers to a subset of Rd\mathbb{R}^dRd with the following properties: (a) component-wise addition/subtraction of two lattice points still results in a lattice point; (b) there is a minimum distance between any two lattice points; and (c) there is a maximum distance for which any point in Rd\mathbb{R}^dRd is within that maximum distance from a lattice point. Read more in this Wikipedia article. ↩

  2. This is not actually true in general; it depends on which quadrant the point lies. In particular, if we let φ=tan⁡−1(yx)\varphi = \tan^{-1}\left(\frac yx\right)φ=tan−1(xy​), then the angle is φ\varphiφ for the first quadrant, φ+π\varphi + \piφ+π for the second quadrant, φ−π\varphi - \piφ−π for the third quadrant, and φ+2π\varphi + 2\piφ+2π for the fourth quadrant. But this also ignores the cases where x=0x = 0x=0. In general the angle θ\thetaθ is best described using the atan2\mathrm{atan2}atan2 function which encompasses the messiness of this computation. ↩

  3. Those familiar with linear algebra would recognise this transformation as the transformation by a rotation matrix R=(cos⁡α−sin⁡αsin⁡αcos⁡α)\mathbf{R} = \begin{pmatrix}\cos\alpha&-\sin\alpha\\\sin\alpha&\cos\alpha\end{pmatrix}R=(cosαsinα​−sinαcosα​) on the vector v=(xy)\mathbf{v} = \begin{pmatrix}x\\y\end{pmatrix}v=(xy​). That is, the resulting point is given by the vector Rv\mathbf{Rv}Rv. ↩

  4. In fact, in this representation, nnn is an even number. ↩

  5. Although we presented it as a corollary, this is the actual statement of Niven’s theorem. ↩

Suggest an editLicensingCite this post
PreviousSecurity over Insecurity: The Foundations of Authenticated Key Exchange
NextDesigning a Zero-Trust, Secure File Manager

Citing This Post

APA7

Kan, O. K. (2025, July 19). Embedding Regular Polygons in a 2D Integer Lattice. Photonic. Retrieved October 4, 2025, from https://photonic.dev/blog/2025-07-19/embedding-regular-polygons-in-a-2d-integer-lattice/

BibTeX

@misc{Photonic_2025,  title={Embedding Regular Polygons in a 2D Integer Lattice},  url={https://photonic.dev/blog/2025-07-19/embedding-regular-polygons-in-a-2d-integer-lattice/},  journal={Photonic},  author={Kan, Onn Kit},  year={2025},  month={Jul},  day={19}}
  • GitHub Logo
  • Bandcamp Logo
  • LinkedIn Logo
Copyright © 2025 PhotonicGluon Version 1.2.11
Source Code Credits Licensing
Printed on TIMESTAMP