# Polygons as Functions

A recent comment from a colleague got me thinking about describing polygons using functions. His intent was that polygons (and all closed shapes) can be described as sets of functions; for instance, a triangle could be described by three linear functions with the domain of the triangle’s vertices. And, of course, any closed shape cannot be described as a function in Cartesian coordinates because there will be two (or more) y-values for most x-values.

However, if we use polar rather than Cartesian coordinates, there are a variety of closed shapes for which we can write a single function. For the sake of discussion, I’m going to limit the domain of $$\theta$$ to a single rotation.

Let’s start with a circle. The standard equation of a circle centered at the origin is $$x^2 + y^2 = r^2$$. Solving for $$y$$ yields: $$y = \pm\sqrt{r^2 – x^2}$$, which can be written as two functions: $f(x) = \sqrt{r^2 – x^2} \\ g(x) = -\sqrt{r^2 – x^2}$

However, using a polar grid rather than a Cartesian grid, a circle is simply: $$f(\theta) = r$$. Much simpler! (Caveat: It’s only this simple when the center of the circle is the origin. If the origin is inside the circle but not its center, the math gets trickier, and if the origin is outside the circle, it can’t be written as a single function.)

Next, how about an equilateral triangle with its incenter at the origin and its base parallel to the x-axis and in QIII/IV? This will require a piecewise function, but it can still be a single function. The left side of the triangle has the domain $$(\pi/2, 7\pi/6]$$ and the base has the domain $$(7\pi/6, 11\pi/6]$$. Because I’m limiting the domain of $$\theta$$, the right side has to be broken up into two domains: $$(0, \pi/2]$$ and $$(11\pi/6, 2\pi]$$.

Writing linear equations in polar form gets tricky. Let’s start with the base. Let $$a$$ be the inradius (apothem) of the triangle. Since the incenter is the origin, that means the equation for the line which contains the base is $$y = -a$$ (that is, a horizontal line), which we rewrite as $$0x + 1y – a = x \cos\phi + y \sin\phi – a = 0$$.

For what angles does $$\cos\phi = 0$$ and $$\sin\phi = 1$$? $$\phi = \pi/2$$. So, using $$p = r \cos{(\theta – \phi)}$$ where $$p = -a$$ yields $$-a = r \cos{(\theta – \pi/2)}$$, that is, $$r = -a\sec{(\theta – \pi/2)}$$.

Now let’s consider the left side. The slope of the left side of an equilateral triangle is $$\sqrt{3}$$, so the linear equation is $$y = \sqrt{3}x + b$$. The radius of an equilateral triangle with an apothem of $$a$$ is $$2a$$, so this line goes through $$(0, 2a)$$. Hence $$y = \sqrt{3}x + 2a$$ and $$\sqrt{3}x – y + 2a = 0$$. Because $$2a$$ is positive, the denominator for the normal form is $$-\sqrt{\sqrt{3}^2 + (-1)^2} = 2$$, so $$-\sqrt{3}x/2 + y/2 – a = 0$$. Hence, $$\phi = \cos^{-1}(-\sqrt{3}/2) = 5\pi/6$$. Using $$p = r\cos(\theta – \phi)$$ where $$p = a$$ yields $$a = r\cos(\theta – 5\pi/6)$$, that is, $$r = a\sec{(\theta – 5\pi/6)}$$.

By similar mathematics, the line containing the right side is $$r = -a\sec{(\theta – \pi/6)}$$. This gives use the piecewise function: $f(\theta) = \left\{ \begin{array}{lcl} -a\sec(\theta-\pi/6) & : & \theta < \pi/2 \\ a\sec(\theta-5\pi/6) & : & \pi/2 \le \theta < 7\pi/6 \\ -a\sec(\theta-\pi/2) & : & 7\pi/6 \le \theta < 11\pi/6 \\ -a\sec(\theta-\pi/6) & : & 11\pi/2 < \theta \\ \end{array} \right.$

This method clearly works for all convex polygons: Any line drawn through any point inside the polygon will intersect the perimeter exactly twice. The mathematics is, naturally, increasingly difficult, but it’s possible. (To see how difficult: Consider as an exercise writing the piecewise function for an equilateral triangle using any point other than the incenter as the origin.)

It also works for some points in some concave polygons. Consider the incenter of a dart, for instance: Any line drawn through certain points will intersect the perimeter of the dart exactly twice. However, there are also points in the dart where this is not true, and types of concave polygons which have no such point.

Clio Corvid

This site uses Akismet to reduce spam. Learn how your comment data is processed.