# The enclosure on a grid

On an infinite 1 by 1 grid, we want to make an enclosure with 20 fences that are each 5 units long. The two ends of each fence has to be on a node of the grid. What is the maximal area of the enclosure? (Fences can cross nodes and the enclosure has to be a polygon.) • Are curved fences allowed in this context? – A.O. Jun 23 at 14:05
• No, they are not. – Display maths Jun 23 at 14:06
• Great puzzle. Thanks for bringing this to my attention. – BmyGuest Jun 24 at 11:06

The largest area is 769.

$$4\times 192+1 = 769$$ I think the mistake that other people are making is that they are making mirror-symmetric solutions. Instead, it is best to make a rotationally symmetric one.

• Congratulations! You found the trick :p – Display maths Jun 23 at 16:03
• That’s actually super interesting how by simply switching a couple of the slanted lines directions you get an extra 1 area. Does anyone know if there is any mathematical reasoning behind that? Well done on finding the answer by the way! :) – Beastly Gerbil Jun 23 at 16:24
• @BeastlyGerbil I've changed the picture to show where the extra 1 comes from. – Jaap Scherphuis Jun 23 at 20:00
• BTW, I did write a computer program to check all possibilities to make sure that this really is the maximal area. – Jaap Scherphuis Jun 23 at 21:06
• Thanks @Chronocidal ! – Jaap Scherphuis Jun 24 at 13:16

Largest area: 768

The largest (I've found) is as follows: I believe this will be the maximum, if not very close to it, as the theoretical maximum area is only $$789.22$$ (see further down for why).

## Here are some other attempts:

Starting simply, the area of a square with side length of $$25$$ is $$625$$: Next is my favourite, a snowman. Sadly he has quite a small area, but I'll add him here anyway. This shows that adding lots of small polygons doesn't work. And a diamond is big , at $$736$$: And I initially overlooked an even larger one at $$741$$: But the largest will be when the shape is as circular as possible (see further down for why), which is this shape at $$768$$: I'm using this website to draw these, which very helpfully tells you the length of the line you are drawing.

Little bit of maths, that got me thinking how to solve this:

From a node, there's only a few other nodes that can be connected such that the length is $$5$$ units. Using Pythagoras's theorem we can see only a couple of these 'possibilities' have a length of $$5$$: So from one node (in the first quadrant), these are the possible lines that can be drawn: Now the maximum area of a n-sided shape will be a regular polygon with n sides (Nice proof here from Math.SE). So for $$n=20$$, the greatest area will be when those 20 sides form an icosagon.

The greatest possible area, therefore, if we didn't have to connect to nodes would be $$789.22$$

The internal angle of an icosagon is $$(180 \times (n-2)) / n = 3240/20 = 162$$ degrees. So the maximum area will be when these fences are set so they have an angle of $$162$$ degrees between each one. However this wont be possible.

Going back to the possibilities, and using some trigonometry, the angles are: As you can see, it won't add up to $$162$$, no matter how you place them. There are also no n-sided shapes with internal angles of $$126.87$$ or $$143.13$$ either.

So to get the biggest area, the largest possible n-sided polygon needs to be formed. This means the largest area will be when the shape is as round as possible.

This is the basis which I am using/used to find large areas.

• Why not use all the angles available and construct a 12-gon? You've only done octagons so far. – Jaap Scherphuis Jun 23 at 14:19
• @JaapScherphuis the bottom polygon of the snowman is a 12-gon. I have one other possible idea for a 12-gon that might work, I'm still somewhat experimenting. This is very difficult to prove :) – Beastly Gerbil Jun 23 at 14:25
• The largest I made is 753, but it’s still not the answer. – Display maths Jun 23 at 14:25
• @Displaymaths how do you know? I'd be surprised if theres anything more – Beastly Gerbil Jun 23 at 14:32
• @DrunkWolf I just found it, sorry :P – Beastly Gerbil Jun 23 at 14:40

Basically, we make a shape as round as possible, with as long pieces as possible. So only pieces with length 5, in a symmetrical arrangement. If we mirror this around the x and y axis, we use 20 pieces, and have surface 768. Best I've done is 757 which looks like this: $$\text{Area}=15*15+4*15*7+4*(4*4+3*4)=757$$

My process was to start with a 5 fence by 5 fence square and then push out the middle bits by using 3x4 diagonals to make the polygon more circle shaped. If you push out the middle bits another time you get 753 which is close, but slightly worse.

• You are pretty close to the answer – Display maths Jun 23 at 14:46