Professional Documents
Culture Documents
The Goat Problem
The Goat Problem
(0 comments)
A goat is tethered on the perimeter of a circular paddock of grass by a rope of length r . What should r be to
allow the goat to graze on a maximum of half the area of the paddock?
This is a famous problem in recreational mathematics and is usually solved by approximate or numerical
methods, despite being relatively easy to express in the form of a mathematical equation (derived below). The
mathematician Ingo Ullisch recently derived an exact solution as the cosine of the ratio of two contour integrals
(https://doi.org/10.1007%2Fs00283-020-09966-0), which has been (generously) described as being in closed-
form:
Here we will take the numerical solution approach. Let the paddock be a unit circle, with area π, centred at O,
and tether the goat at point T. The extent of the goat's grazing area is ilustrated below. Our job is to find the
value of r that makes this area equal to π/2 .
r 1
T θ α Q
1 O
https://scipython.com/blog/the-goat-problem/ 1/4
24/09/2023, 23:32 The Goat Problem
(1) α = π − 2θ
sin α
(2) sin θ =
r
2
(3) r = 1 + 1 − 2 cos α = 2(1 − cos α)
r
2
(4) 1 = 1 + r − 2r cos θ ⇒ θ = arccos( )
2
The second of these is the sine rule for triangles (https://en.wikipedia.org/wiki/Law_of_sines); the third and forth
follow from the cosine rule (https://en.wikipedia.org/wiki/Law_of_cosines).
2
θ r θ
2
A1 = πr = ,
2π 2
α α
A2 = π =
2π 2
1 1
A3 = r sin θ = sin α,
2 2
The area that the goat has to graze in is therefore A = 2(A1 + A2 − A3 ) and the problem is to solve
π
2
A = r θ + α − sin α =
2
π
sin α + (π − α) cos α = .
2
This equation is readily solved using, for example, the Newton–Raphson root-finding algorithm, as implemented
by scipy.optimize.newton (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.newton.html):
import numpy as np
from scipy.optimize import newton
def func(alpha):
return np.sin(alpha) + (np.pi - alpha) * np.cos(alpha) - np.pi / 2
theta_guess = np.pi / 2
alpha = newton(func, theta_guess)
print(alpha)
1.2358969242799094
This value for α is in radians. The corresponding rope-length, r is given, from (3) as:
r = np.sqrt(2 * (1-np.cos(alpha)))
print(r)
1.1587284730181215
https://scipython.com/blog/the-goat-problem/ 2/4
24/09/2023, 23:32 The Goat Problem
The variation of the grazable fraction of the paddock, A/π as a function of the rope length, r , can be plotted as
follows:
plt.plot(rgrid, A / np.pi)
plt.hlines(0.5, 0, r, colors='k', linestyles='--')
plt.vlines(r, 0, 0.5, colors='k', linestyles='--')
plt.xlim(0, 2)
plt.ylim(0, 1)
plt.yticks([0, 0.5, 1])
plt.xlabel('$r$')
plt.ylabel('fractional grazing area')
plt.show()
https://scipython.com/blog/the-goat-problem/ 3/4
24/09/2023, 23:32 The Goat Problem
Comments
Comments are pre-moderated. Please be patient and your comment will appear soon.
New Comment
Name
required
Website
optional
Comment
required
Comment
https://scipython.com/blog/the-goat-problem/ 4/4