--- title: "Generating Polynomials, Part 1: Regular Constructibility" description: | What kinds of regular polygons are constructible with compass and straightedge? format: html: html-math-method: katex date: "2021-08-18" date-modified: "2025-06-17" categories: - geometry - generating functions - algebra - python --- ```{python} #| echo: false from math import comb from IPython.display import Markdown from tabulate import tabulate import sympy from sympy.abc import z ``` [Recently](/posts/misc/platonic-volume), I used coordinate-free geometry to derive the volumes of the Platonic solids, a problem which was very accessible to the ancient Greeks. On the other hand, they found certain problems regarding which figures can be constructed via compass and straightedge to be very difficult. For example, they struggled with problems like [doubling the cube](https://en.wikipedia.org/wiki/Doubling_the_cube) or [squaring the circle](https://en.wikipedia.org/wiki/Squaring_the_circle), which are known (through circa 19th century mathematics) to be impossible. However, before even extending planar geometry by a third dimension or calculating the areas of circles, a simpler problem becomes apparent. Namely, what kinds of regular polygons are constructible? Regular Geometry and a Complex Series ------------------------------------- When constructing a regular polygon, one wants a ratio between the length of a edge and the distance from a vertex to the center of the figure. ![ Regular triangle, square, and pentagons inscribed in a unit circle. Note the right triangle formed by the apothem, half of an edge, and circumradius. ](./central_angle_figures.png){.wide} In a convex polygon, the total central angle is always one full turn, or 2π radians. The central angle of a regular *n*-gon is ${2\pi \over n}$ radians, and the green angle above (which we'll call *θ*) is half of that. This means that the ratio we're looking for is $\sin(\theta) = \sin(\pi / n)$. We can multiply by *n* inside the function on both sides to give $\sin(n\theta) = \sin(\pi) = 0$. Therefore, constructing a polygon is actually equivalent to solving this equation, and we can rephrase the question as how to express $\sin(n\theta)$ (and $\cos(n\theta)$). ### Complex Recursion Thanks to [Euler's formula](https://en.wikipedia.org/wiki/Euler%27s_formula) and [de Moivre's formula](https://en.wikipedia.org/wiki/De_Moivre%27s_formula), the expressions we're looking for can be phrased in terms of the complex exponential. $$ \begin{align*} e^{i\theta} &= \text{cis}(\theta) = \cos(\theta) + i\sin(\theta) & \text{ Euler's formula} \\ \text{cis}(n \theta) = e^{i(n\theta)} &= e^{(i\theta)n} = {(e^{i\theta})}^n = \text{cis}(\theta)^n \\ \cos(n \theta) + i\sin(n \theta) &= (\cos(\theta) + i\sin(\theta))^n & \text{ de Moivre's formula} \end{align*} $$ De Moivre's formula for $n = 2$ gives $$ \begin{align*} \text{cis}(\theta)^2 &= (\text{c} + i\text{s})^2 \\ &= \text{c}^2 + 2i\text{cs} - \text{s}^2 + (0 = \text{c}^2 + \text{s}^2 - 1) \\ &= 2\text{c}^2 + 2i\text{cs} - 1 \\ &= 2\text{c}(\text{c} + i\text{s}) - 1 \\ &= 2\cos(\theta)\text{cis}(\theta) - 1 \end{align*} $$ This can easily be massaged into a recurrence relation. $$ \begin{align*} \text{cis}(\theta)^2 &= 2\cos(\theta)\text{cis}(\theta) - 1 \\ \text{cis}(\theta)^{n+2} &= 2\cos(\theta)\text{cis}(\theta)^{n+1} - \text{cis}(\theta)^n \\ \text{cis}((n+2)\theta) &= 2\cos(\theta)\text{cis}((n+1)\theta) - \text{cis}(n\theta) \end{align*} $$ Recurrence relations like this one are powerful. Through some fairly straightforward summatory manipulations, the sequence can be interpreted as the coefficients in a Taylor series, giving a [generating function](https://en.wikipedia.org/wiki/Generating_function). Call this function *F*. Then, $$ \begin{align*} \sum_{n=0}^\infty \text{cis}((n+2)\theta)x^n &= 2\cos(\theta) \sum_{n=0}^\infty \text{cis}((n+1)\theta) x^n - \sum_{n=0}^\infty \text{cis}(n\theta) x^n \\ {F(x; \text{cis}(\theta)) - 1 - x\text{cis}(\theta) \over x^2} &= 2\cos(\theta) {F(x; \text{cis}(\theta)) - 1 \over x} - F(x; \text{cis}(\theta)) \\[10pt] F - 1 - x\text{cis}(\theta) &= 2\cos(\theta) x (F - 1) - x^2 F \\ F - 2\cos(\theta) x F + x^2 F &= 1 + x(\text{cis}(\theta) - 2\cos(\theta)) \\[10pt] F(x; \text{cis}(\theta)) &= {1 + x(\text{cis}(\theta) - 2\cos(\theta)) \over 1 - 2\cos(\theta)x + x^2} \end{align*} $$ Since $\text{cis}$ is a complex function, we can separate *F* into real and imaginary parts. Conveniently, these correspond to $\cos(n\theta)$ and $\sin(n\theta)$, respectively. $$ \begin{align*} \Re[ F(x; \text{cis}(\theta)) ] &= {1 + x(\cos(\theta) - 2\cos(\theta)) \over 1 - 2\cos(\theta)x + x^2} \\ &= {1 - x\cos(\theta) \over 1 - 2\cos(\theta)x + x^2} = A(x; \cos(\theta)) \\ \Im[ F(x; \text{cis}(\theta)) ] &= {x \sin(\theta) \over 1 - 2\cos(\theta)x + x^2} = B(x; \cos(\theta))\sin(\theta) \end{align*} $$ In this form, it becomes obvious that the even though the generating function *F* was originally parametrized by $\text{cis}(\theta)$, *A* and *B* are parametrized only by $\cos(\theta)$. Extracting the coefficients of *x* yields an expression for $\cos(n\theta)$ and $\sin(n\theta)$ in terms of $\cos(\theta)$ (and in the latter case, a common factor of $\sin(\theta)$). If $\cos(\theta)$ in *A* and *B* is replaced with the parameter *z*, then all trigonometric functions are removed from the equation, and we are left with only polynomials[^1]. These polynomials are [*Chebyshev polynomials*](https://en.wikipedia.org/wiki/Chebyshev_polynomial) *of the first (A) and second (B) kind*. In actuality, the polynomials of the second kind are typically offset by 1 (the x in the numerator of *B* is omitted). However, retaining this term makes indexing consistent between *A* and *B* (and will make things clearer later). [^1]: This can actually be observed as early as the recurrence relation. $$ \begin{align*} \text{cis}(\theta)^{n+2} &= 2\cos(\theta)\text{cis}(\theta)^{n+1} - \text{cis}(\theta)^n \\ a_{n+2} &= 2 z a_{n+1} - a_n \\ \Re[ a_0 ] &= 1,~~ \Im[ a_0 ] = 0 \\ \Re[ a_1 ] &= z,~~ \Im[ a_1 ] = 1 \cdot \sin(\theta) \end{align*} $$ We were primarily interested in $\sin(n\theta)$, so let's tabulate the first few polynomials of the second kind (at $z / 2$). ```{python} #| echo: false #| label: tbl-chebyshevu #| tbl-cap: "[OEIS A049310](http://oeis.org/A049310)" #| classes: plain Markdown(tabulate( [ [ n, "$" + sympy.latex(poly) + "$", "$" + sympy.latex(sympy.factor(poly)) + "$", ] for n in range(0, 11) for poly in [sympy.chebyshevu_poly(n - 1, z / 2) if n > 0 else sympy.sympify(0)] ], headers=[ "*n*", "$[x^n]B(x; z / 2) = U_{n - 1}(z / 2)$", "Factored", ], numalign="left", stralign="left", )) ``` Evaluating the polynomials at $z / 2$ cancels the 2 in the denominator (and recurrence), making these expressions much simpler. This evaluation has an interpretation in terms of the previous diagram -- recall we used *half* the length of a side as a leg of the right triangle. For a unit circumradius, the side length itself is then $2\sin( {\pi / n} )$. To compensate for this doubling, the Chebyshev polynomial must be evaluated at half its normal argument. ### Back on the Plane The constructibility criterion is deeply connected to the Chebyshev polynomials. In compass and straightedge constructions, one only has access to linear forms (lines) and quadratic forms (circles). This means that a figure is constructible if and only if the root can be expressed using normal arithmetic (which is linear) and square roots (which are quadratic). #### Pentagons Let's look at a regular pentagon. The relevant polynomial is $$ [x^5]B ( x; z / 2 ) = z^4 - 3z^2 + 1 = (z^2 - z - 1) (z^2 + z - 1) $$ According to how we derived this series, when $z = 2\cos(\theta)$, the roots of this polynomial correspond to when $\sin(5\theta) / \sin(\theta) = 0$. This relation itself is true when $\theta = \pi / 5$, since $\sin(5 \pi / 5) = 0$. One of the factors must therefore be the minimal polynomial of $2\cos(\pi / 5 )$. The former happens to be correct correct, since $2\cos( \pi / 5 ) = \varphi$, the golden ratio. Note that the second factor is the first evaluated at -*z*. #### Heptagons An example of where constructability fails is for $2\cos( \pi / 7 )$. $$ \begin{align*} [x^7]B ( x; z / 2 ) &= z^6 - 5 z^4 + 6 z^2 - 1 \\ &= ( z^3 - z^2 - 2 z + 1 ) ( z^3 + z^2 - 2 z - 1 ) \end{align*} $$ Whichever is the minimal polynomial (the former), it is a cubic, and constructing a regular heptagon is equivalent to solving it for *z*. But there are no (nondegenerate) cubics that one can produce via compass and straightedge, and all constructions necessarily fail. #### Decagons One might think the same of $2\cos(\pi /10 )$ $$ \begin{align*} [x^{10}]B ( x; z / 2 ) &= z^9 - 8 z^7 + 21 z^5 - 20 z^3 + 5 z \\ &= z ( z^2 - z - 1 )( z^2 + z - 1 )( z^4 - 5 z^2 + 5 ) \end{align*} $$ This expression also contains the polynomials for $2\cos( \pi / 5 )$. This is because a regular decagon would contain two disjoint regular pentagons, produced by connecting every other vertex. ![   ](./decagon_divisible.png) The polynomial which actually corresponds to $2\cos( \pi / 10 )$ is the quartic, which seems to suggest that it will require a fourth root and somehow decagons are not constructible. However, it can be solved by completing the square... $$ \begin{align*} z^4 - 5z^2 &= -5 \\ z^4 - 5z^2 + (5/2)^2 &= -5 + (5/2)^2 \\ ( z^2 - 5/2)^2 &= {25 - 20 \over 4} \\ ( z^2 - 5/2) &= {\sqrt 5 \over 2} \\ z^2 &= {5 \over 2} + {\sqrt 5 \over 2} \\ z &= \sqrt{ {5 + \sqrt 5 \over 2} } \end{align*} $$ ...and we can breathe a sigh of relief. The Triangle behind Regular Polygons ------------------------------------ Preferring *z* to be halved in $B(x; z/2)$ makes something else more evident. Observe these four rows of the Chebyshev polynomials ```{python} #| echo: false #| classes: plain Markdown(tabulate( [ [ n, "$" + sympy.latex(poly) + "$", k, int(poly.coeff(z, k)), # type: ignore ] for n, k in zip(range(4, 8), range(3, -1, -1)) for poly in [sympy.chebyshevu_poly(n - 1, z / 2) if n > 0 else sympy.sympify(0)] ], headers=[ "*n*", "$[x^n]B(x; z / 2)$", "*k*", "$[z^{k}][x^n]B(x; z / 2)$", ], numalign="left", stralign="left", )) ``` The last column looks like an alternating row of Pascal's triangle (namely, ${n - \lfloor {k / 2} \rfloor - 1 \choose k}(-1)^k$). This resemblance can be made more apparent by listing the coefficients of the polynomials in a table. ```{python} #| echo: false #| classes: plain rainbow_classes = [ "", "red", "orange", "yellow", "green", "cyan", "aqua", "blue", "purple" "", "", ] rainbow_class = lambda x, color: f"{x}" Markdown(tabulate( [ [ n, *[" " for _ in range(1, 11 - n)], # offset for terms of the polynomial *[ 0 if k % 2 == 1 else rainbow_class( comb(n - (k // 2) - 1, k // 2) * (-1)**(k // 2), n - (k // 2) - 1, ) for k in range(n) ] ] for n in range(1, 11) ], headers=[ "n", *[f"$z^{nm}$" for nm in reversed(range(2, 10))], "$z$", "$1$", ], numalign="right", stralign="right", )) ``` Though they alternate in sign, the rows of Pascal's triangle appear along diagonals, which I have marked in rainbow. Meanwhile, alternating versions of the naturals (1, 2, 3, 4...), the triangular numbers (1, 3, 6, 10...), the tetrahedral numbers (1, 4, 10, 20...), etc. are present along the columns, albeit spaced out by 0's. The relationship of the Chebyshev polynomials to the triangle is easier to see if the coefficient extraction of $B(x; z / 2)$ is reversed. In other words, we extract *z* before extracting *x*. $$ \begin{align*} B(x; z / 2) &= {x \over 1 - zx + x^2} = {x \over 1 + x^2 - zx} = {x \over 1 + x^2} \cdot {1 \over {1 + x^2 \over 1 + x^2} - z{x \over 1 + x^2}} \\[10pt] [z^n]B(x; z / 2) &= {x \over 1 + x^2} [z^n] {1 \over 1 - z{x \over 1 + x^2}} = {x \over 1 + x^2} \left( {x \over 1 + x^2} \right)^n \\ &= \left( {x \over 1 + x^2} \right)^{n+1} = x^{n+1} (1 + x^2)^{-n - 1} \\ &= x^{n+1} \sum_{k=0}^\infty {-n - 1 \choose k}(x^2)^k \quad \text{Binomial theorem} \end{align*} $$ While the use of the binomial theorem is more than enough to justify the appearance of Pascal's triangle (along with explaining the 0's), I'll simplify further to explicitly show the alternating signs. $$ \begin{align*} {(-n - 1)_k} &= (-n - 1)(-n - 2) \cdots (-n - k) \\ &= (-1)^k (n + k)(n + k - 1) \cdots (n + 1) \\ &= (-1)^k (n + k)_k \\ \implies {-n - 1 \choose k} &= {n + k \choose k}(-1)^k \\[10pt] [z^n]B(x; z / 2) &= x^{n+1} \sum_{k=0}^\infty {n + k \choose k} (-1)^k x^{2k} \end{align*} $$ Squinting hard enough, the binomial coefficient is similar to the earlier which gave the third row of Pascal's triangle. If k is fixed, then this expression actually generates the antidiagonal entries of the coefficient table, which are the columns with uniform sign. The alternation instead occurs between antidiagonals (one is all positive, the next is 0's, the next is all negative, etc.). The initial $x^{n+1}$ lags these sequences so that they reproduce the triangle. ### Imagined Transmutation The generating function of the Chebyshev polynomials resembles other two term recurrences. For example, the Fibonacci numbers have generating function $$ \sum_{n = 0}^\infty \text{Fib}_n x^n = {1 \over 1 - x - x^2} $$ This resemblance can be made explicit with a simple algebraic manipulation. $$ \begin{align*} B(ix; -iz / 2) &= {1 \over 1 -\ (-i z)(ix) + (ix)^2} = {1 \over 1 -\ (-i^2) z x + (i^2)(x^2)} \\ &= {1 \over 1 -\ z x -\ x^2} \end{align*} $$ If $z = 1$, these two generating functions are equal. The same can be said for $z = 2$ with the generating function of the Pell numbers, and so on for higher recurrences (corresponding to metallic means) for higher integral *z*. In terms of the Chebyshev polynomials, this series manipulation removes the alternation in the coefficients of $U_n$, restoring Pascal's triangle to its nonalternating form. Related to the previous point, it is possible to find the Fibonacci numbers (Pell numbers, etc.) in Pascal's triangle, which you can read more about [here](http://users.dimi.uniud.it/~giacomo.dellariccia/Glossary/Pascal/Koshy2011.pdf). Manipulating the Series ----------------------- Look back to the table of $U_{n - 1}(z / 2)$ (@tbl-chebyshevu). When I brought up $U_{10 - 1}(z / 2)$ and decagons, I pointed out their relationship to pentagons as an explanation for why $U_{5 -\ 1}(z / 2)$ appears as a factor. Conveniently, $U_{2 -\ 1}(z / 2) = z$ is also a factor, and 2 is likewise a factor of 10. This pattern is present throughout the table; $n = 6$ contains factors for $n = 2 \text{ and } 3$ and the prime numbers have no smaller factors. If this observation is legitimate, call the newest term $f_n(z)$ and denote $p_n(z) = U_{n -\ 1}( z / 2 )$. ### Factorization Attempts The relationship between $p_n$ and the intermediate $f_d$, where *d* is a divisor of *n*, can be made explicit by a [Möbius inversion](https://en.wikipedia.org/wiki/M%C3%B6bius_inversion_formula). $$ \begin{align*} p_n(z) &= \prod_{d|n} f_n(z) \\ \log( p_n(z) ) &= \log \left( \prod_{d|n} f_d(z) \right) = \sum_{d|n} \log( f_d(z) ) \\ \log( f_n(z) ) &= \sum_{d|n} { \mu \left({n \over d} \right)} \log( p_d(z) ) \\ f_n(z) &= \prod_{d|n} p_d(z)^{ \mu (n / d) } \\[10pt] f_6(z) = g_6(z) &= p_6(z)^{\mu(1)} p_3(z)^{\mu(2)} p_2(z)^{\mu(3)} \\ &= {p_6(z) \over p_3(z) p_2(z)} \end{align*} $$ Unfortunately, it's difficult to apply this technique across our whole series. Möbius inversion over series typically uses more advanced generating functions such as [Dirichlet series](https://en.wikipedia.org/wiki/Dirichlet_series#Formal_Dirichlet_series) or [Lambert series](https://en.wikipedia.org/wiki/Lambert_series). However, naively reaching for these fails for two reasons: - We built our series of polynomials on a recurrence relation, and these series are opaque to such manipulations. - To do a proper Möbius inversion, we need these kinds of series over the *logarithm* of each polynomial (*B* is a series over the polynomials themselves). Ignoring these (and if you're in the mood for awful-looking math) you may note the Lambert equivalence[^2]: [^2]: This equivalence applies to other polynomial series obeying the same factorization rule such as the [cyclotomic polynomials](https://en.wikipedia.org/wiki/Cyclotomic_polynomial). $$ \begin{align*} \log( p_n(z) ) &= \sum_{d|n} \log( f_d(z) ) \\ \sum_{n = 1}^\infty \log( p_n ) x^n &= \sum_{n = 1}^\infty \sum_{d|n} \log( f_d ) x^n \\ &= \sum_{k = 1}^\infty \sum_{m = 1}^\infty \log( f_m ) x^{m k} \\ &= \sum_{m = 1}^\infty \log( f_m ) \sum_{k = 1}^\infty (x^m)^k \\ &= \sum_{m = 1}^\infty \log( f_m ) {x^m \over 1 - x^m} \end{align*} $$ Either way, the number-theoretic properties of this sequence are difficult to ascertain without advanced techniques. If research has been done, it is not easily available in the OEIS. ### Total Degrees It can be also be observed that the new term is symmetric ($f(z) = f(-z)$), and is therefore either irreducible or the product of polynomial and its reflection (potentially negated). For example, $$ p_9(z) = \left\{ \begin{matrix} (z - 1)(z + 1) & \cdot & (z^3 - 3z - 1)(z^3 - 3z + 1) \\ \shortparallel && \shortparallel \\ f_3(z) & \cdot & f_9(z) \\ \shortparallel && \shortparallel \\ g_3(z) \cdot g_3(-z) & \cdot & g_9(z) \cdot -g_9(-z) \end{matrix} \right. $$ These factor polynomials $g_n$ are the minimal polynomials of $2\cos( \pi / n )$. Multiplying these minimal polynomials by their reflection can be observed in the Chebyshev polynomials for $n = 3, 5, 7, 9$, strongly implying that it occurs on the odd terms. Assuming this is true, we have $$ f_n(z) = \begin{cases} g_n(z) & \text{$n$ is even} \\ g_n(z)g_n(-z) & \text{$n$ is odd and ${\deg(f_n) \over 2}$ is even} \\ -g_n(z)g_n(-z) & \text{$n$ is odd and ${\deg(f_n) \over 2}$ is odd} \end{cases} $$ Without resorting to any advanced techniques, the degrees of $f_n$ are not too difficult to work out. The degree of $p_n(z)$ is $n -\ 1$, which is also the degree of $f_n(z)$ if *n* is prime. If *n* is composite, then the degree of $f_n(z)$ is $n -\ 1$ minus the degrees of the divisors of $n -\ 1$. This leaves behind how many numbers less than *n* are coprime to *n*. Therefore $\deg(f_n) = \phi(n)$, the [Euler totient function](https://en.wikipedia.org/wiki/Euler_totient_function) of the index. The totient function can be used to examine the parity of *n*. If *n* is odd, it is coprime to 2 and all even numbers. The introduced factor of 2 to 2*n* removes the evens from the totient, but this is compensated by the addition of the odd multiples of old numbers coprime to *n* and new primes. This means that $\phi(2n) = \phi(n)$ for odd *n* (other than 1). The same argument can be used for even *n*: there are as many odd numbers from 0 to *n* as there are from *n* to 2*n*, and there are an equal number of numbers coprime to 2*n* in either interval. Therefore, $\phi(2n) = 2\phi(n)$ for even *n*. This collapses all cases of the conditional factorization of $f_n$ into one, and the degrees of $g_n$ are $$ \begin{align*} \deg( g_n(z) ) &= \begin{cases} \deg( f_n(z) ) = \phi(n) & n \text{ is even} & \implies \phi(n) = \phi(2n) / 2 \\ \deg( f_n(z) ) / 2 = \phi(n) / 2 & n \text{ is odd} & \implies \phi(n) / 2 = \phi(2n) / 2 \end{cases} \\ &= \varphi(2n) / 2 \end{align*} $$ Though they were present in the earlier Chebyshev table, the $g_n$ themselves are presented again, along with the expression for their degree ```{python} #| echo: false #| classes: plain def poly_to_rising_power_list(poly, var): """ Convert a polynomial to a list in rising powers. E.g., x^2 + x - 1 will be converted to [-1, 1, 1]. """ ret = [] for term in reversed(poly.as_ordered_terms()): deg = sympy.degree(term, var) if deg > len(ret): ret.extend(0 for _ in range(int(deg) - len(ret))) if deg == 0: ret.append(term) else: ret.append(term.coeff(z**deg)) return ret Markdown(tabulate( [ [ n, sympy.totient(2*n) / 2, "$" + sympy.latex(g) + "$", str(poly_to_rising_power_list(g, z)), ] for n in range(2, 11) for g in [ factor # the first factor polynomial with matching degree and negative second term for factor in sympy.chebyshevu_poly(n - 1, z / 2).factor(z).as_ordered_factors() # type: ignore for second_term in [ 0 if len(factor.as_ordered_terms()) == 1 # if there's only one term, pass it through else factor.as_ordered_terms()[1].as_ordered_factors()[0] # type: ignore ] if n == 2 or ( sympy.degree(factor) == sympy.totient(2*n) / 2 and isinstance(second_term, sympy.Integer) and second_term < 0 ) ] ] + [[ "-", "[OEIS A055034](http://oeis.org/A055034)", "-", "[OEIS A187360](http://oeis.org/A187360)", ]], headers=[ "n", "$\\varphi(2n)/2$", "$g_n(z)$", "Coefficient list, rising powers", ], numalign="right", stralign="left", )) ``` Closing ------- My initial jumping off point for writing this article was completely different. However, in the process of writing, its share of the article shrank and shrank until its introduction was only vaguely related to what preceded it. But alas, the introduction via geometric constructions flows better coming off my [post about the Platonic solids](/posts/misc/platonic-volume). Also, it reads better if I rely less on "if you search for this sequence of numbers" and more on how to interpret the definition. Consider reading [the follow-up](../2) to this post if you're interested in another way one can obtain the Chebyshev polynomials. Diagrams created with GeoGebra.