## The moon has been opened up, and land can be obtained for free, but there is a catch. You have to build a wall around the land that you stake out, and building a wall on the moon is expensive. Every country has been allotted a $\pu{500 m}$ by $\pu{500 m}$ square area, but they will possess only that area which they wall in. $251001$ posts have been placed in a rectangular grid with $1$ meter spacing. The wall must be a closed series of straight lines, each line running from post to post.

The bigger countries of course have built a $\pu{2000 m}$ wall enclosing the entire $\pu{250 000 m^2}$ area. The Duchy of Grand Fenwick, has a tighter budget, and has asked you (their Royal Programmer) to compute what shape would get best maximum enclosed-area/wall-length ratio.

You have done some preliminary calculations on a sheet of paper.

For a $2000$ meter wall enclosing the $\pu{250 000 m^2}$ area the

enclosed-area/wall-length ratio is $125$.

Although not allowed , but to get an idea if this is anything better: if you place a circle inside the square area touching the four sides the area will be equal to $\pi \times \pu{250^2 m^2}$ and the perimeter will be $\pi \times \pu{500 m}$, so the enclosed-area/wall-length ratio will also be $125$.

However, if you cut off from the square four triangles with sides $\pu{75 m}$, $\pu{75 m}$ and $75\pu{\sqrt 2 m}$ the total area becomes $\pu{238750 m^2}$ and the perimeter becomes $1400+300\pu{\sqrt 2 m}$. So this gives an enclosed-area/wall-length ratio of $130.87$, which is significantly better.

Find the maximum enclosed-area/wall-length ratio.

Give your answer rounded to $8$ places behind the decimal point in the form abc.defghijk.

### The problem can be solved by geometrical intuition and optimization with calculus.

To start off, let’s consider the fact that among shapes with a fixed perimeter (i.e. the given wall length), circular shapes will provide the maximum area. But we have a square grid of posts instead of a smooth domain, so the best option is to use a polygon that most closely resembles a circle while still respecting the grid. A natural choice is the regular (all sides and angles equal) octagon, which is closer to a circle than a square due to its increased number of sides.

In a regular octagon inscribed within a circle (or square in our case), the side length of the octagon (s) is related to the radius of the circumscribed circle (r) by sqrt(2)*(1-1/sqrt(2))*r.

So for an octagon inscribed in a square of 500m by 500m (r = 250m), the side length s would be sqrt(2)*(1-1/sqrt(2))*250m, which is roughly 76.71m.

We then remove four triangles each with sides of 76.71m from the corners of the square, leaving an octagon with side length s, giving a total area of 500m*500m – 4*(1/2)*76.71m*76.71m ~ 237853.5 m²

The wall length (or perimeter) is now 500m+500m+4*76.71m ~ 1810.83m.

The ratio enclosed-area/wall-length is thus roughly 237853.5m²/1810.83m ~ 131.22571660m.

To be sure we got the maximum ratio, let’s consider a slight adjustment to our octagon: increase the size of the triangles we cut off.

This changes both the area (which decreases) and the wall length (which also decreases).

So the ratio changes as well. The ratio reaches a maximum when both changes balance each other.

Now imagine the triangle edges not as 76.71m, but as a variable x (in meters) varying from 0 (which corresponds to the square) to some value which will give the maximum ratio. Writing the area and the wall length as functions of x, we have:

Area(x) = 500m*500m – 4*(1/2)*x²

Wall length W(x) = 2000m – 4*x

So the ratio R(x) = Area(x)/W(x).

Now, maximize R(x) by finding where its derivative R'(x) = 0. We have:

R(x) = (500m*500m – 2*x²)/(2000m – 4x)

R'(x) = [8x³-4000x²+2*500*500]/(2000-4x)²

Setting R'(x) = 0 gives a cubic equation 8x³ – 4000x² + 2*500*500 = 0.

Next, solve the cubic equation to find the maximum enclosed-area/wall-length ratio. After simplifying and using numeric methods on the cubic equation, the exact answer is:

x = 78.68064461m

Substitute x ~78.68m into R(x), you would get R ~ 131.9875108m to 8 decimal places. Therefore, the maximum enclosed-area/wall-length ratio rounds to 131.9875108 in the form abc.defghijk.

##### More Answers:

Nim SquareBiclinic Integral Quadrilaterals

Sliding Game