If you have ever wondered what the equation for a hexagon might be, you are in luck. Just like a circle has an implicit equation, \(x^2+y^2=1\), a hexagon has an implicit equation as well. Here it is:
\(\sqrt{y^{2}}=\left(-\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}+\left(\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(0.5+x\right)^{2}}}{0.5+x}}{2}+\frac{\sqrt{3}}{2}\frac{1-\frac{\sqrt{\left(-0.5-x\right)^{2}}}{-0.5-x}}{2}\cdot\frac{1+\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}+\sqrt{1-x}-\sqrt{1-x}+\sqrt{x+1}-\sqrt{x+1}\)
This equation yields the following graph (which can be viewed here on Desmos):
This graph deserves an explanation. A while back, I was messing around with the Desmos graphing calculator, seeing what I could make using nothing but exponents, roots, multiplication, division, addition, and subtraction. The first shape that came to mind was a pentagon. I almost succeeded, but I never managed to get the last face to work. After that, I tried a hexagon. I quickly realized that the symmetry of the hexagon allowed me to avoid the problem I had with the pentagon. Using a few tricks I learned while using Desmos, I put together an implicit equation for a hexagon. Here is how it works:
Using the elementary functions I listed, it is possible to create an absolute value function: \(\sqrt{x^{2}}\)
This takes any number \(x\) and makes it positive.
From there, it is possible make a sign function: \(\frac{\sqrt{x^{2}}}{x}\)
This function takes any number x and returns \(1\) if \(x\) is positive and \(-1\) if x is negative.
By adding two modified sign functions, the following equation can be created: \(\frac{1-\frac{\sqrt{\left(a-x\right)^{2}}}{a-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-b\right)^{2}}}{x-b}}{2}\)
This equation is actually quite simple. It is equal to zero everywhere except between \(a\) and \(b\), where it is equal to one.
The graph of this last equation looks like:
Here is the nifty part; multiplying this function with any other function crops the other function, making the section between \(a\) and \(b\) the same, and everything else zero. This makes it possible to create functions like this:
Equation 1:
\(\left(-\sqrt{3}x+\sqrt{3\ }\right)\frac{1-\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-1\right)^{2}}}{x-1}}{2}\)
Equation 2:
\(\left(\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(-1-x\right)^{2}}}{-1-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x+0.5\right)^{2}}}{x+0.5}}{2}\)
Equation 3:
\(\left(\frac{\sqrt{3}}{2}\right)\cdot\frac{1-\frac{\sqrt{\left(-0.5-x\right)^{2}}}{-0.5-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-0.5\right)^{2}}}{x-0.5}}{2}\)
By adding these equations, the following is obtained:
\(\left(-\sqrt{3}x+\sqrt{3\ }\right)\frac{1-\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-1\right)^{2}}}{x-1}}{2}+\left(\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(-1-x\right)^{2}}}{-1-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x+0.5\right)^{2}}}{x+0.5}}{2}+\left(\frac{\sqrt{3}}{2}\right)\cdot\frac{1-\frac{\sqrt{\left(-0.5-x\right)^{2}}}{-0.5-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-0.5\right)^{2}}}{x-0.5}}{2}\)
This equation give a half hexagon with two lines at \(y=0\) that extend to infinity on both sides. It is possible to limit the domain of this function by adding a limiting function using square roots to make it impossible for \(x\) to have certain values. For example, \(\sqrt{1-x}\) implies that \(x-1>0\). Hence, \(x\) can never be more than \(1\).
By adding such an expression and then subtracting it, we limit the values \(x\) can take without changing the equation. In our case, we want \(x\) to be larger than \(-1\), but smaller than \(1\). We can get this desired property with the following equation: \(\sqrt{1-x}-\sqrt{1-x}+\sqrt{x+1}-\sqrt{x+1}\).
There is one step left. Currently, there is only have half a hexagon. Luckily, there is a way to mirror any function across the x-axis. This is done by placing all the “y’s” of the equaiton inside an absolute value. In other words, \(y\) is replaced with \(\sqrt{y^{2}}\). The new equation is:
\(\sqrt{y^{2}}=\left(-\sqrt{3}x+\sqrt{3\ }\right)\frac{1-\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-1\right)^{2}}}{x-1}}{2}+\left(\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(-1-x\right)^{2}}}{-1-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x+0.5\right)^{2}}}{x+0.5}}{2}+\left(\frac{\sqrt{3}}{2}\right)\cdot\frac{1-\frac{\sqrt{\left(-0.5-x\right)^{2}}}{-0.5-x}}{2}\cdot\frac{1-\frac{\sqrt{\left(x-0.5\right)^{2}}}{x-0.5}}{2}+\sqrt{1-x}-\sqrt{1-x}+\sqrt{x+1}-\sqrt{x+1}\)
Although this gives a hexagon, the equation presented at the beginning of this article is shorter. This is because the functions for the slanted sides of the hexagon can be shortened due to addition of the limiting expression \(\sqrt{1-x}-\sqrt{1-x}+\sqrt{x+1}-\sqrt{x+1}\). By taking off the unnecessary parts of the equation, the finished implicit equation for a hexagon is obtained:
\(\sqrt{y^{2}}=\left(-\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}+\left(\sqrt{3}x+\sqrt{3}\right)\frac{1-\frac{\sqrt{\left(0.5+x\right)^{2}}}{0.5+x}}{2}+\frac{\sqrt{3}}{2}\frac{1-\frac{\sqrt{\left(-0.5-x\right)^{2}}}{-0.5-x}}{2}\cdot\frac{1+\frac{\sqrt{\left(0.5-x\right)^{2}}}{0.5-x}}{2}+\sqrt{1-x}-\sqrt{1-x}+\sqrt{x+1}-\sqrt{x+1}\)