A farmer out standing in their field, their field was not mathematics.

Back in 2014 I was helping my girlfriend’s sister with her maths homework and a particular question sparked my imagination.

The original question, as posed by her teacher, has a trivial solution (If you’ve already done A level maths). The question is about a farmer trying to find the optimal way to arrange their fence. Their fence is to be placed against the wall and they want to be able to enclose the largest area for their sheep to graze. However, they only have a fixed length of fence.

Representing this fixed length of fence as s we can find the optimal x and y lengths the farmer should use as follows:

This is the solution the teacher was looking for but that got me thinking what if, rather than straight lines, you had circles. This led me to the problem I have spent a long time since trying to grapple with. 

The problem can be described as the same farmer who is now trying to use a fence which can be arced into a segment of a circle. Instead of a wall the farmer is now using a circular lake. This problem, I hope, can be seen in the following diagram.

This problem, as opposed to the original question set, is far harder to solve. The answer seems to not be solvable algebraically. That would result in the optimal solution being transcendental. 

In trying to write this blog post about the problem I thought I would explore a problem which is naturally in the middle of these two. The problem replaces the lake and returns to the straight wall.


The best solution to the original problem, given the fence can arc is, at least by my intuition,  a semi circle around the wall. My intuition based on if there was internal pressure and the fence could flow freely. I guess I’m imagining something like a balloon.

This leads to a slightly different question, more complicated than the original but simpler than the lake. I’ve represented this in the diagram below.

Here we need to deal with an arc of a circle, which my prediction was that it would be semi-circular but I wanted to show that that was true.

The length of the fence is now the length of the arc of the circle. Assuming angles in radians because it makes life simpler, the arc length of a segment of a circle is given by the following.


The area enclosed by the fence is the area of the segment (Yellow and blue together) minus the area of the triangle (blue).

The area of a segment is:


To aid confusion I have used x to denote our angle. This helps because we can use x on its own when using trigonometry inside the smaller triangles, and 2x where we would have been talking about theta.

The area of the larger blue triangle can be calculated by breaking it into two right-angled triangles.

The area of the pasture enclosed by the arc of a fence can then be calculated:

We are almost ready to differentiate to find the max of A. Notice here that r changes with x. What is fixed is the length of fence S. Substituting this in we can get r in terms of the unchanging S and the variable we will be differentiating with respect to x.

We can then substitute that in giving us a formula for the area which changes only in x.

Now that we have the area of the pasture we can differentiate with respect to the angle x. This will tell us how the area changes as our segment is part of larger or smaller circles.

Using the product rule on the second half.

We can simplify that now.



We can now set this to zero and find the stationary points, some of which will be maxima. 

I’m doing some things here which make some assumptions and so are only allowed within particular ranges. You can’t divide both sides of an equation by 0 so when I divide both sides by the square of the cosine in the last step, the assumption must be made that the cosine of x is not zero.

The result is a transcendental equation. That means there is no algebraic solution. We do, however, have a solution from before our assumption that the cosine of x is not zero.

Notice that if it is zero the equation holds.

There isn’t one value of x for which the cosine of x is zero. There are actually a family of solutions. The way to think of this is using a circle. The cosine of an angle represents the x value of a point the unit circle. Which I hope the following diagram from khan academy helps to show.

As the angle theta increases clearly the values for the cosine and sine will repeat. A least every whole turn, as it turns out twice every whole turn. Therefore our solutions are the following:

In our example only solutions where the angle is larger than 0 and smaller than a whole circle. That gives us: and.

Back in the example, we were dealing with, my intuition, that the optimal solution should be a semi-circle, would require our optimal value for x to be half pi. So, given that is one of our possible solutions. It is looking promising.

What about the other solutions, involving the tangents?

One of the solutions can be found by trying 0. This happens to be a solution. The question is, given that there might be another solution, how do we know if that is the case?

When doing this problem I just asked for the solutions from wolfram alpha but I think it is more interesting to try and solve this question without using a computer.

To do that we can plot our solutions also working out the gradient of the curve at that point.

That means taking a further derivative.

 
  Now we can start to build up an idea of what the graph of looks like. First, we plot the points where we cross the axis. 0, half pi, three halves of pi.



Plugging our solutions into the second derivative formula we get that at x=0, the second derivative is 0, that makes this an inflexion point, where the gradient is 0. Plugging half pi in most the terms inside the bracket becomes zero leaving the negative x to make the gradient negative. The same is true of three halves pi, therefore we know as the curve crosses the axis at these points it is going from above to below. Which I have tried to show in the next image.



Now we could look to see what is happening around 0, differentiating again would tell us if it is a minima, maxima or inflection point. We can do something simple though and use our intuition. We know that if the angles in the diagram of the circle are 0 there will be no area, and that moving away from zero there will be some area. Therefore we know that this plot of the derivative of area will be positive after 0. We can then fill the lines as below.


There is something curious here. After half pi the graph is going off to the negative but before three halves of pi the graph is positive. From the formula we expect the graph to be continuous here. Could that mean that it does the following?


Could the extra point here be the other solution to tanx=x?

As is often the case when sketching graphs this way the curve looks a little different from a plot:

Plot from wolfram alpha

Trying each of these points in our original formula for the area it turns out my suspicion over a semi-circle were correct. Remember here the definition of x is such that results in a semicircle.

We do see this extra crossing which it turns out, is the solution to tanx=x.


Solution

Area

0

0




The problem I have tried to solve with the lake is considerably more complex. I don’t have an intuition for the best answer and the equations lead to another transcendental result. However, the equations don’t work out quite as nicely allowing us to factor out quite so much.

I hope to finish a post including my workings on the problem so far in the near future.


Comments

Popular posts from this blog

Exploring development timing through building a simple trading game

The twelve fold way

THREE.js: minecraft in a weekend