The infamous Goat Problem; my fruitless efforts…

The Goat Problem is a centuries-old geometry problem with no closed form solution. If you tie a goat to the boundary of a circular fence that bounds 1 acre of area, how long does the rope need to be to allow the goat to roam exactly half of this area? Back in December 2020, Quanta Magazine posted a story announcing that Ingo Ullisch, a German mathematician, had reached the first exact solution. The trouble with this solution, however, is that it can only be evaluated iteratively. This is due to it being expressed in terms of a ratio of two contour integrals.

When I first heard of this problem in December, I thought it would be a piece of cake. After all, it sounds easy. Now, I can assure you with confidence that it is much more difficult than it seems. There’s a reason this problem has been unsolved for such a long time. In any case, I decided to give it a go. I spent a large chunk of my winter break (when I was supposed to be working on college applications…) trying to find a solution. Spoiler: I didn’t. However, I reached some interesting results that seem worth sharing here.

Obviously, the ideal solution to this problem would yield the correct rope length for any given fenced-in area. Let the fenced-in circle be called $A$ and the circle of points that the goat could graze if not bounded by a fence be called $B$. Let the radius of $A$ be $r_1$ and the radius of $B$, the desired length of rope, be $r_2$. When the overlap area of these two circles equals half the area of $A$, the problem’s constraint is satisfied. Now, note that we can make some simplifying assumptions without loss of generality (Don’t worry – you’re not on the AoPS forum. I’ll justify my claims that these assumptions don’t compromise generality). We can assume that both circles are fixed on the $y$-axis and let $B$ be centered at the origin. Then, $A$ is centered at $\left(0,r_1\right)$. The position of the circles in the plane does not impact generality because any circles may be moved into this position through translation and rotation. Geometry (angles, lengths, areas) is invariant under these transformations.

Note: all diagrams in this post were made with the wonderful Desmos online graphing calculator.

Just to be clear: we don’t actually know $r_2$; finding it is the objective of the problem. I just picked a value for the purposes of the diagram.

Next, it’s useful to make some initial observations. First, $r_2$ is necessarily larger than $r_1$. To see why, suppose $r_2<r_1$. Then, we’ll end up with something like this:

Clearly, the area below the horizontal diameter of $A$ is equal to half of $A$’s area. Since the region of overlap (the span of the goat’s rope) is contained in the lower semicircle, its area is strictly less than half of the area of $A$. For the same reason, both points of intersection must lie below the horizontal diameter of $A$. If they didn’t, $r_2$ would have to be greater than $r_1$.

The area of overlap of $A$ and $B$ serves as a constraint equation for the problem. That is, if we had some magical function $\text{OverlapArea}\left(A,B\right)$ that gives the overlap area, setting

$$\text{OverlapArea}\left(A, B\right)=\frac{\text{Area}\left(A\right)}{2}=\frac{\pi r_1^2}{2}\implies r_2 \text{ is the solution to the problem.}$$

Something should stand out about this: there is only one unknown variable, $r_2$. That means this is the only equation we need! However, the situation is not as ideal as it seems. $\text{OverlapArea}$ is anything but easy to come by. I’ll present several formulas for the area of overlap and how I derived them. I haven’t been able to solve any of these equations for the desired variable, but each of them can be used to give approximate solutions by numerical methods. There’s another different constraint equation that I thought of too, but as I was unable to write an equation for it, we’ll save that explanation for the end.

Intersection of two circles

Both formulas for overlap area below rely on the intersection points of the two circles, $I_1$ and $I_2$. To obtain these, construct the following kite with diagonals between $A$ and $B$:

Now, consider the kite without the circles in the way so it’s easier to see:

As we can see in the diagram, $x$ is the distance from the y axis to $I_2$. Further down, this quantity will be called $a$ but it’s $x$ here just for clarity. $y_1$ is the distance from $A$ to the intersection of the kite’s diagonals. We can use this diagram to write some formulas. Both by the Pythagorean Theorem,

$$y_{1}^2+x^2=r_{1}^2 \implies x^2 = r_{1}^2 – y_{1}^2$$

$$y_{2}^2+x^2=r_{2}^2 \implies x^2 = r_{2}^2 – y_{2}^2$$

Using the fact that both right hand sides of these equations are equal to $x^2$, we can set them equal to each other:

$$r_{1}^2 – y_{1}^2 = r_{2}^2 – y_{2}^2$$

We can now rewrite this by observing:

$$r_1=y_1+y_2 \implies y_2=r_1-y_1 \implies y_{2}^2 = r_{1}^2-2r_{1}y_1+y_{1}^2$$

Substituting for $y_{2}^2$, our equation becomes:

$$r_{1}^2 – y_{1}^2 = r_{2}^2 – \left( r_{1}^2-2r_{1}y_1+y_{1}^2 \right) = r_{2}^2 – r_{1}^2 + 2r_{1}y_1 – y_{1}^2$$

Solving for $y_1$, we obtain


From the first Pythagorean equation from above, we have:

$$x=\pm \sqrt{r_{1}^2 – y_{1}^2}$$

Since we now have a formula for $y_1$, this can be computed. The intersection points are then given by:

$$I_1, I_2 = \left(\pm \sqrt{r_{1}^2 – y_{1}^2}, r_1-y_1\right) = \left(\pm a, r_1-y_1\right)$$

We can now move on to the overlap area formulas.

Overlap area formula #1: Integral

Doing an integral is perhaps the first thing that comes to mind. It’s an obvious way to get the area. That being said, it’s usually nontrivial to solve integrals of complicated functions. The idea here is to use the inclusion-exclusion principle to get the area. First, we compute the area of this blue shaded region:

which is given by the integral of the top half of $B$ between the $x$ coordinates of the intersection points. In math,

$$\text{Area}\left(\text{Shaded}\right) = \int_{-a}^{a}\sqrt{r_{2}^2-x^2} \ \text{d}x$$

Then, we can use another integral and the principle of inclusion-exclusion to subtract away the undesired excess area, shaded below:

which is given by the integral of the bottom half of $A$ between the $x$ coordinates of the intersection points. In math,

$$ \text{Area}\left(\text{Shaded}\right) = \int_{-a}^{a} r_1 – \sqrt{r_{1}^2 – x^2} \ \text{d}x $$

Subtracting these two integrals and combining them using linearity, we get an expression for the overlap area:

$$\text{OverlapArea}\left( A,B \right) = \int_{-a}^{a}\sqrt{r_{2}^2-x^2}+\sqrt{r_{1}^2-x^2}-r_1 \ \text{d}x$$

To get an explicit formula for the area, we can solve this indefinite integral and plug in the bounds.

$$ \int{\sqrt{r_{2}^2-x^2}+\sqrt{r_{1}^2-x^2}-r_1 \ \text{d}x} $$

$$ = -r_1x + \int{\sqrt{r_{2}^2-x^2}+\sqrt{r_{1}^2-x^2} \ \text{d}x} $$

$$ = -r_1x + \int{\sqrt{r_{2}^2-x^2} \ \text{d}x} + \int{\sqrt{r_{1}^2-x^2} \ \text{d}x} $$

Now consider just the integral:

$$\int{\sqrt{r_{1}^2-x^2} \ \text{d}x} \text{ (We can piece things back together later)}$$

We can use trig substitution here:

$$\text{Let } x=r_{1}\sin\left(t_{1}\right) \implies \text{d}x=r_{1}\cos\left(t_{1}\right) \ \text{d}t_{1} \text{ and } t_{1}=\sin^{-1}\left( \frac{x}{r_1} \right)$$

The integral is then:

$$ r_1 \int\sqrt{r_{1}^2 \left( 1-\sin^{2}\left( t_1 \right) \right)} \cos\left( t_1 \right) \ \text{d}t_{1} $$

$$ = r_{1}^2 \int \cos^{2}\left( t_1 \right) \ \text{d}t_{1} \tag*{by $\sin^{2}\left(x\right)+\cos^{2}\left(x\right)=1$}$$

$$ = \frac{r_{1}^2}{2}\int 1+\cos\left(2t_{1}\right) \ \text{d}t_1 \tag*{by $\cos^{2}\left(x\right)=\frac{1+\cos\left(2x\right)}{2}$ }$$


$$ =\frac{r_{1}^{2}}{2}\left(\sin^{-1}\left(\frac{x}{r_{1}}\right)+\frac{1}{2}\sin\left(2\sin^{-1}\left(\frac{x}{r_{1}}\right)\right)\right) $$

We can simplify the term $\sin\left(2\sin^{-1}\left(\frac{x}{r_1}\right)\right)$:

$$\text{Let } y=\sin^{-1}\left(x\right)\implies x=\sin^{-1}\left( y \right)$$

$$ \implies \sin\left( 2\sin^{-1}\left( x\right) \right) = \sin\left( 2y \right) $$

$$ = 2\sin\left( y\right)\cos\left( y\right)$$


$$\cos^{2}\left(y \right) + \sin^{2}\left(y \right) = 1 \implies \cos(y) = \sqrt{1-\sin^{2}\left(y \right)} = \sqrt{1-x^2}$$


$$ \sin\left(2\sin^{-1}\left(x \right) \right) = 2\sin\left(y \right)\cos\left(y \right) = 2x\sqrt{1-x^2} $$

Using this, we can rewrite the result of the integral as follows:

$$ \frac{r_{1}^{2}}{2}\left(\sin^{-1}\left(\frac{x}{r_{1}}\right)+\frac{x}{r_{1}}\sqrt{1-\left(\frac{x}{r_{1}}\right)^{2}}\right) $$

This might look more complicated than what we had before, but two of the inverse trig functions have been eliminated and replaced with roots. Theoretically, that should be helpful when trying to solve the final equation. Anyway, this result can be used to write the solution to the entire indefinite integral as follows:


We could evaluate this as stated before from $-a$ to $a$, but it’s simpler to use the $y$ axis symmetry of this region to change the bounds to $0$ to $a$. Note that $F(a)-F(-a)=2(F(a)-F(0))=2F(a)$ since $F(0)=0$. Therefore, the area of the region of overlap is:

$$2F(a) = r_{1}^{2}\left(\sin^{-1}\left(\frac{a}{r_{1}}\right)+\frac{a}{r_{1}}\sqrt{1-\left(\frac{a}{r_{1}}\right)^{2}}\right)+r_{2}^{2}\left(\sin^{-1}\left(\frac{a}{r_{2}}\right)+\frac{a}{r_{2}}\sqrt{1-\left(\frac{a}{r_{2}}\right)^{2}}\right)-2r_{1}a$$

Set this equation equal to $\frac{\pi r_{1}^2}{2}$, solve for $r_2$, and you have a solution to the goat problem. Remember, however, that $a$ is defined in terms of $y_1$, which is in turn defined in terms of $r_2$. This equation is so complex in terms of $r_1$ that I have not yet even attempted to solve it. That brings us to the other formula for the area, which is more tractable and more likely to be solvable, in my opinion.

Overlap area formula #2: Angles

Even though the integral is a more obvious approach, this is the one I developed first. This approach relies more heavily on inclusion-exclusion and basic geometrical formulas. We begin with the same kite we used for the intersection points derivation, embedded in the region of intersection:

This time, we care more about the angles in this kite. Let $\text{Sector}(A,\theta_1)$ represent the area of the sector of $A$ within the angle $\theta_1$. Now here’s the idea: shade $\text{Sector}\left(A,\theta_1\right)$:

Then shade $\text{Sector}\left( B,\theta_2 \right)$:

Notice how these areas are bounded by the overlap region, but a certain area is counted twice, as it is part of both sectors. That is the area of the quadrilateral $AI_{1}BI_{2}$, which happens to be the kite we were using before:

So (with inclusion-exclusion), we can add up the sector areas and simply subtract out the excess area that is double counted, leaving the formula


The area of both sectors is trivial, since there’s a formula for it: $\frac{1}{2}r^{2}\theta$. That leaves the problem of finding the area of the quadrilateral, which isn’t too hard. First note that $\text{Area}\left(AI_{1}BI_{2}\right)=\text{Area}\left(AI_{1}I_{2}\right)+\text{Area}\left(BI_{1}I_{2}\right)$. Using the triangle area sine rule, each of the areas of these smaller triangles can be computed quite easily.

$$\text{Area}\left( AI_{1}I_{2} \right) = \frac{1}{2}r_{1}^{2}\sin\left(\theta_{1}\right)$$

$$\text{Area}\left( BI_{1}I_{2} \right) = \frac{1}{2}r_{2}^{2}\sin\left(\theta_{2}\right)$$


$$ \text{Area}\left( AI_{1}BI_{2} \right) = \frac{1}{2}r_{1}^{2}\sin\left(\theta_{1}\right) + \frac{1}{2}r_{2}^{2}\sin\left(\theta_{2}\right) $$


$$ \text{Area}\left(\text{Overlap}\right) = \frac{1}{2}r_{1}^{2}\theta_{1} + \frac{1}{2}r_{2}^{2}\theta_{2} – \frac{1}{2}r_{1}^{2}\sin\left(\theta_{1}\right) – \frac{1}{2}r_{2}^{2}\sin\left(\theta_{2}\right) $$

$$ =\frac{r_{1}^{2}\left(\theta_{1}-\sin\left(\theta_{1}\right)\right)+r_{2}^{2}\left(\theta_{2}-\sin\left(\theta_{2}\right)\right)}{2} $$

Setting this equal to half the area of $A$ and solving for $r_2$ is trivial. However, that’s not very useful because we haven’t made expressions for $\theta_1$ and $\theta_2$. As it turns out, both of them rely on $r_2$ (as you would expect). There are many ways to find these angles, but I’ll present the method that I figured is the best.

Consider this triangle, which is a part of the kite we used to get the intersection points:

From the diagram:

$$\cos\left( \frac{\theta_1}{2} \right) = \frac{y_1}{r_1}$$

$$ \implies \theta_1=2\cos^{-1}\left(\frac{y_1}{r_1}\right) $$

Similarly, we use this triangle from the kite:

So that

$$ \cos\left( \frac{\theta_2}{2} \right) = \frac{r_1-y_1}{r_2} $$

$$ \implies \theta_2 = 2\cos^{-1}\left( \frac{r_1-y_1}{r_2} \right) $$

Now, we can write the overlap area equation in terms of these expressions:

$$ \frac{1}{2}\left(r_{1}^{2}\left(2\cos^{-1}\left(\frac{y_{1}}{r_{1}}\right)-\sin\left(2\cos^{-1}\left(\frac{y_{1}}{r_{1}}\right)\right)\right)+r_{2}^{2}\left(2\cos^{-1}\left(\frac{r_{1}-y_{1}}{r_{2}}\right)-\sin\left(2\cos^{-1}\left(\frac{r_{1}-y_{1}}{r_{2}}\right)\right)\right)\right) $$

Now that is a mess. It looks even more complicated than the expression we got from the integral. At the very least, we need to get rid of the nested trigonometric functions. In general, trig functions will make solving the final equation much more difficult. Fair warning: this is going to get messy. But the result is worth the effort. This is a long chain of simplification, so I’ll try to explain each step as much as possible.

The goal is to simplify the inverse cosines nested in sine functions. So, start with the first one:


First, simplify the argument of sine:

$$ 2\cos^{-1}\left(\frac{y_{1}}{r_{1}}\right) $$

Substitute definition of $y_1$:

$$ = 2\cos^{-1}\left(\frac{2r_{1}^{2}-r_{2}^{2}}{2r_{1}^{2}}\right) $$

Break apart the fraction, divide the first term out and rewrite the second term as a square:


Now, bring back the sine function:


Apply the identity $\sin\left(2x\right)=2\sin\left(x\right)\cos\left(x\right)$:


Apply $\cos^{-1}\left(\cos\left(x\right)\right)=x$ and commute:

$$ = 2\left(1-\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}\right)\sin\left(\cos^{-1}\left(1-\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}\right)\right)$$

Apply $\sin^{-1}\left(x\right)=\pi-\sin^{-1}\left(-x\right)$:

$$ = 2\left(1-\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}\right)\sin\left(\pi-\cos^{-1}\left(\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}-1\right)\right) $$

Apply $\sin\left(\pi-x\right)=\sin\left(x\right)$:

$$ = 2\left(1-\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}\right)\sin\left(\cos^{-1}\left(\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}-1\right)\right)$$

Distribute the 2, expand the square, and cancel the 2s in the numerator and denominator:

$$ = \left(2-\frac{r_{2}^{2}}{r_{1}^{2}}\right)\sin\left(\cos^{-1}\left(\left(\frac{r_{2}}{\sqrt{2}r_{1}}\right)^{2}-1\right)\right)$$

Now we need a way to eliminate the trig functions. Consider the following triangle:

From this diagram,

$$ \cos\left(\theta\right) = \frac{x}{1} \implies \theta = \cos^{-1}\left(x\right) $$

$$ x^2+y^2=1 \implies y=\sqrt{1-x^2} $$

$$ \text{so } \sin\left(\cos^{-1}\left(x\right)\right) = \sin\left(\theta\right) = \frac{y}{1} = y=\sqrt{1-x^2} $$

Okay, so we can use this identity in our simplification. Applying it to what we had before,


Expanding the square:


Distribute the negative and combine like terms:


Factor the expression under the radical:


Take the squared factor out of the radical (we don’t need absolute value symbols as this quantity is guaranteed to be positive):


Expand the square and take 2 out from the radical, then cancel:


Multiply the terms outside the radical:


This is about as far as I could think to simplify it. Now, the next nested trig term. This one’s a bit cleaner since an $r_2$ cancels out. Like the previous time, start with simplifying the argument of sine:


Substitute $y_1$ definition:


Pull the $1/(2r_1)$ out, put it in the denominator, distribute the negative, and combine like terms:


Cancel the $r_2$ out:


Now, put the sine function back in:


This will now continue similarly to the last time. Apply $\sin\left(2x\right)=2\sin\left(x\right)\cos\left(x\right)$:


Apply $\cos^{-1}\left(\cos\left(x\right)\right)=x$ and cancel the 2s:


Again use $\sin\left(\cos^{-1}\left(x\right)\right) = \sqrt{1-x^2}$:


You might have noticed that you can use these two results to show that

$$ \sin\left(\theta_{1}\right)=\left(2-\frac{r_{2}^{2}}{r_{1}^{2}}\right)\sin\left(\theta_{2}\right) $$

but I couldn’t find a way to make that fact useful.

These simplifications again leave us with an equation that only has the single variable, $r_2$. I’m not going to write it out in its entirety (you can if you want) because it’s so big, but solving it will yield a solution to the Goat Problem. I think this equation is more promising because even though it looks more complex, it seems easier to solve. Note that since the two equations I presented both give the area of overlap, they are equivalent in some way. I just believe that the second one is in a form that is easier to solve.

An interesting observation

Along the way of attempting to solve the problem, I discovered that the function $F(x)$ from above, when graphed, resembles a sine wave very closely. Here it is, plotted with an extremely similar sine wave on the same interval:

You can hardly even tell those are two different curves. Zooming in on the endpoint:

You can see that there is, in fact, a difference. The function in black is $F(x)$, and the function in green is a scaled sine wave. This made me think that there are some values of $c_1$ and $c_2$ such that: $F(x)=c_{1}\sin\left(c_{2}x\right)$. Unfortunately, I managed to prove that this is not the case. If it was, it would have meant the equation would have been trivially easy to solve for $r_1$.

The way I proved that is unusual, so I might as well share it here. I’m fairly confident that this is a rigorous proof. $F(x)$ is defined on $x\in \left[-1, 1\right]$. Take a finite number of sample values $-1,-0.99,-0.98,\dots ,0.99,1$ from this interval and place them in the set $X$. Then let $Y=F(X)$. Compute the least-squares regression $\hat{Y}=c_{1}\sin\left(c_{2}X\right)$. Given the optimal values of $c_1$ and $c_2$ from this regression, compute the residual error. As the error is nonzero, there exists no function of this form that passes through all of these points. Such a function would have a smaller least-squares error of zero. Since the finite set $X\subset \left[-1,1\right]$, there is no function of that form equal to $F(x)$ for all $x$ in its interval of definition.

Alternative constraint equation

As promised, here is an alternative constraint for the Goat Problem that does not involve a formula for the overlap area. Consider this diagram:

When the sum of the red regions is equal to the blue region, the area of overlap is equal to one half the area of $A$. Imagine cutting the blue region in half and moving it below the horizontal diameter of $A$. If the areas of the red regions combined to the area of the red region, these pieces would fit perfectly under the diameter. Obviously, the total area in $A$ below the diameter is equal to half the area of $A$.

It’s easy to come up with an expression for the blue region, but the red regions are not so easy. For this reason, I haven’t been able to turn this constraint into a workable formula.

Final Remarks

You might be thinking that this was a giant waste of time. After all, there’s no definitive results here, just the remnants of a few incomplete solutions. Yet, there is still value in attempting in vain to solve a math problem. In math, there are no permanent failures. Every unsolved problem can be revisited and answered in the future. Besides, every bit of information that is gained is a success in and of itself. This is obviously a tough problem, and it’s impressive that Ingo Ullisch was able to reach an exact solution at all, albeit one that is not closed form. I encourage you to give the problem a go – build off my attempt, or take a different approach altogether! If you’ve made it this far in the post, you’re clearly interested enough to do so.

Thanks for reading! The surface algorithms post is coming… I know I said that in the last post but there has been an unforeseen issue. It’ll get here eventually.