Random Pentagon Generator

So, I made a Random Pentagon Generator:


Here are some examples of random pentagons:


I guess the first question you might ask is "Why?"

The task this week for the #beingmathematical twitter chat was to explore the pentagons that can be made on a 9-pin geoboard.

I had a play before the chat started. If you haven't seen this task before I recommend you have a play yourself before reading further!

First I doodled a bunch of different pentagons that all used the top corners as vertices:

Some initial explorations

I felt a bit overwhelmed at the number of different pentagons I was finding so I tried to find an upper bound. I numbered the points on the Geoboard 1 to 9 and figured out that there would be 126 ways of selecting 5 of these points. 

I started to try being systematic about finding these pentagons, only keeping the branches that would create a simple connected pentagon. However, I found that some combinations of points could give more than one pentagon depending on how those points were connected.

Systematically finding pentagons

Examples of different pentagons made from the same points
During the chat I had a little more of a play but I found it quite hard to follow the chat as well as do any exploring. I drew these examples on the NRICH interactive dotty grid but I found it hard to organise the shapes, decide whether there were any duplicates or any missing. 

21 examples of simple connected pentagons (bottom green is a repeat)

By the end of the hour there was a general consensus that there were 23 unique simple connected pentagons, not including reflections or rotations. 

This did not satisfy me. I felt like there was more to explore here.

As I decided before I believe there to be 126 ways of choosing 5 points from the board. I had then realised that depending on how you connect those points you may find more than one pentagon. 

If I have 5 points how many unique ways are there of connecting them? 

I believe it to be 12 as there are 5! permutations, divided by 5 to account for rotations and 2 to account for reflections. 

Now this gives 12 * 126 = 1512 possible "pentagons". 

Here we are using a very loose definition of a pentagon, just 5 unique points joined together in an order. 

This is where the Pentagon Generator comes in. The first slider picks 5 points, the second slider picks a way of joining those points in a loop. As you can see this creates a lot of pentagons, many of them would probably be classed as degenerate cases. 



So, how many of the 1512 examples are simple, connected pentagons?

To check I created image files of all the examples I'd generated and sorted them into various categories. It turns out that there are 164 simple connected pentagons. This includes all possible rotations and reflections of the 23 found earlier. 

The degenerate cases can be sorted into several categories. There are 12 triangles, 64 quadrilaterals and 1272 other cases. 

Note that although these 2 rectangles look the same they will count as different cases as the initial 5 dots that were chosen are different. Most of the triangles and quadrilaterals are duplicated in this way.

Two rectangles

Some of my favourite other degenerate cases are the 'stars' and the 'flags'. Here are some examples of each:

Degenerate star pentagons

Degenerate flag pentagons

Also, for those who are interested, here are the 23 unique pentagons discussed above:



Finally, if you would like to play around with all the pentagons and maybe sort them yourself here are the image files of all the 1512 pentagons!



Comments