In my previous post, I created sets of regular polygons in GeoGebra by setting a parameter of the polygons equal to a constant. In this post, I will show the mathematics for determining the side length given a particular parameter.

The values I calculated were side length, radius length, apothem length, area, height, and width. Side length is trivial.

For this post, I will be using the following variables:

- n: Number of sides
- s: Length of side
- r: Length of radius (distance from center to a vertex)
- a: Length of apothem (distance from center to a side)
- A: Area
- h: Height (when one side of the polygon has a slope of 0)
- w: Width (when one side of the polygon has a slope of 0)

If you’d like to explore the applet I generated, go here.

### Radius, apothem, and area

Every regular polygon can be subdivided into isosceles triangles with a vertex at the center of the polygon. I’ll demonstrate with a heptagon:

Each of these triangles can be further divided into two right triangles. The hypotenuse of these triangles is the radius of the polygon; the legs are the apothem and half the side:

Hence we can use this triangle to move between A, r (JA), a (JH), and s (AB).

Since the polygon can be divided into 2n polygons, and since there are 2π radians in a circle, \(\alpha = \frac{\pi}{n}\). So:

- \(\sin{\alpha} = \frac{s}{2r} \Rightarrow s = 2r\sin{\frac{\pi}{n}}\)
- \(\tan{\alpha} = \frac{s}{2a} \Rightarrow s = 2a\tan{\frac{\pi}{n}}\)

The area of ∆AHJ is \(\frac{A}{2n}\) and is equal to \(\frac{s\times a}{2\times2}=\frac{sa}{4}\), so \(A = \frac{nsa}{2}\).

\(\tan{\alpha} = \frac{s}{2a} \Rightarrow a = \frac{s}{2\tan{\alpha}} \Rightarrow A = \frac{ns^2}{4\tan{\alpha}}\) and hence \(s^2 = \frac{4A\tan{\alpha}}{n}\). Therefore:

- \(A = \frac{nsa}{2} \Rightarrow s = 2\sqrt{\frac{A}{n}\tan{\frac{\pi}{n}}}\)

### Height

If a polygon has an even number of sides, its height is equal to twice its apothem. Since we already know how to correlate the side length to the apothem, this is a straightforward adjustment:

- \(s = 2a\tan{\frac{\pi}{n}} \Rightarrow s = h\tan{\frac{\pi}{n}} \)

For a polygon with an odd number of sides, we need to consider another triangle:

There are a few ways of calculating \(\gamma\). One is to realize that \(\gamma\) is an inscribed angle on circumcenter of the polygon. As such, \(\gamma = \frac{\alpha}{2} = \frac{\pi}{2n}\).

Another is to consider the triangle shown below:

Recall that we can divide the polygon into n triangles. If n is odd, \(\delta\) will span half of one less than those triangles, that is, \(\frac{n-1}{2}\). Since each triangle has an angle of \(\frac{2\pi}{n}\) at J, \(\delta = \frac{2\pi(n-1)}{2n} = \frac{\pi(n-1)}{n}\).

Because EJA is a triangle, \(\delta + \gamma + \epsilon = \pi\). Furthermore, since EJ = JA, \(\gamma = \epsilon\). From this it follows that \(2\gamma + \delta = \pi\) and so \(\gamma = \frac{\pi – \delta}{2}\).

\(\pi – \delta = \pi – \frac{\pi(n-1)}{n} = \frac{\pi n}{n} – \frac{\pi n – \pi}{n} = \frac{\pi n – \pi n + \pi}{n} = \frac{\pi}{n}\), so \(\gamma = \frac{\pi}{2n}\).

Either way, we get the same value for \(\gamma\). As with ∆AHJ, we can use ∆AHE to relate the side length to the height (and, as explained below, the width).

- \(\tan{\gamma} = \frac{s}{2h} \Rightarrow s = 2h\tan{\frac{\pi}{2n}}\)

Overall, this gives us:

- If n is even: \(s = h\tan{\frac{\pi}{n}} \)
- If n is odd: \(s = 2h\tan{\frac{\pi}{2n}}\)

### Width

If the number of sides of the polygon is a multiple of four (doubly even), then its width is equal to its height (i.e., twice the apothem). If the number of sides of the polygon is even but not a multiple of four (singly even), then its width will be twice its radius. This is another straightforward calculation:

- \(s = 2r\sin{\frac{\pi}{n}} \Rightarrow s = w\sin{\frac{\pi}{n}} \)

If the number of sides of the polygon is odd, the width is the length of the longest diagonal.

In the case of the heptagon in the example, this width is CG. However, CG = EA, which we can readily calculate in the same manner as we’ve already done:

- \(\sin{\gamma} = \frac{s}{2w} \Rightarrow s = 2w\sin{\frac{\pi}{2n}}\)

In summary, this gives us:

- If n is doubly even: \(s = w\tan{\frac{\pi}{n}} \)
- If n is singly even: \(s = w\sin{\frac{\pi}{n}} \)
- If n is odd: \(s = 2w\sin{\frac{\pi}{2n}}\)

### Width and Height

When deciding on parameters for a polygon, I wondered about the size of the bounding box, that is, the smallest square that can contain the polygon. In the case of regular polygons, the relevant question is whether the width can ever be less than the height.

The radius is always greater than the apothem (being the hypotenuse and a leg, respectively, of a right angle such as ∆AHJ). For polygons with an even number of sides, the width is either equal to twice the apothem (so is equal to the height) or twice the radius (so is greater than the height).

The width and height of a polygon with an odd number of sides are the hypotenuse and a leg of a right angle such as ∆AHE (thanks to Versylfa Xlevrata for noticing this). Thus the width is always greater than the height.

So using a bounding box would be redundant on using the width.

### Summary

Here are all of the equations relating s to one other parameter:

- \(s = 2r\sin{\frac{\pi}{n}}\)
- \(s = 2a\tan{\frac{\pi}{n}}\)
- \(s = 2\sqrt{\frac{A}{n}\tan{\frac{\pi}{n}}}\)
- If n is even: \(s = h\tan{\frac{\pi}{n}} \)
- If n is odd: \(s = 2h\tan{\frac{\pi}{2n}}\)
- If n is doubly even: \(s = w\tan{\frac{\pi}{n}} \)
- If n is singly even: \(s = w\sin{\frac{\pi}{n}} \)
- If n is odd: \(s = 2w\sin{\frac{\pi}{2n}}\)

Clifford JemNice formulas to calculate the side of the polygon. Very helpful. Thanks.