Posted on May 29, 2026
Two sheep are at two random points inside a square pen. They are munching grass and staring in two random directions. Each sheep has a field of view that's 180 degrees.
What is the probability that they both see each other?
The sheep positions are almost a distraction. Once the two positions are fixed, each sheep has exactly one direction it needs to see: the direction from itself to the other sheep.
A 180-degree field of view covers half of all possible directions. Since the sheep's facing direction is random, the probability that the first sheep sees the second is
\[ \frac{1}{2}. \]
The same is true for the second sheep. Their facing directions are independent, so the probability that both events happen is
\[ \frac{1}{2}\cdot\frac{1}{2}=\frac{1}{4}. \]
This argument does not depend on the square at all. The only excluded case is that the two sheep stand in exactly the same point, which has probability zero.
Answer: \( \boxed{\frac{1}{4}} \), or \(25\%\).
Randomize the positions and directions to see how the 180-degree views behave. A green segment means the two sheep see each other, orange means exactly one sees the other, and red means neither does.
Both sheep see each other exactly when each one faces into the half-plane containing the other.
Now, three sheep are at three random points inside a square pen. They are munching grass and staring in three random directions. As before, each sheep has a field of view that's 180 degrees.
What is the probability that all three sheep see each other?
Now the shape of the triangle formed by the three sheep matters.
Fix the three positions for a moment, and call the triangle's angles \(A\), \(B\), and \(C\). At the vertex with angle \(A\), the sheep needs its 180-degree view to contain the two rays pointing toward the other two sheep.
Those two rays are separated by angle \(A\). A randomly oriented semicircle contains both rays exactly when its center direction lies in an interval of angular length \(\pi-A\). Since the center direction is uniform on an interval of length \(2\pi\), that sheep succeeds with probability
\[ \frac{\pi-A}{2\pi}. \]
The same reasoning at the other two vertices gives conditional probability
\[ \frac{(\pi-A)(\pi-B)(\pi-C)}{(2\pi)^3}. \]
So the extra-credit answer is the average of this expression over the random triangle made by three independent uniform points in the square:
\[ \mathbb{E}\left[ \frac{(\pi-A)(\pi-B)(\pi-C)}{(2\pi)^3} \right]. \]
This is the exact reduction. Unlike the two-sheep version, it is not shape-independent: choosing three random points in a disk gives a slightly different number than choosing them in a square.
I evaluated the six-dimensional square integral directly. For points \(P_1=(x_1,y_1)\), \(P_2=(x_2,y_2)\), and \(P_3=(x_3,y_3)\), compute the three triangle angles, plug them into the expression above, and average over \([0,1]^6\).
A numerical evaluation of this six-dimensional average gives
\[ 0.027206\ldots \]
or about \(2.7206\%\).
Extra credit answer: approximately \( \boxed{0.027206} \), or \( \boxed{2.7206\%} \).
Here is a compact version of the computation:
function angle(p, q, r) {
const ux = q[0] - p[0], uy = q[1] - p[1];
const vx = r[0] - p[0], vy = r[1] - p[1];
const dot = ux * vx + uy * vy;
const len = Math.hypot(ux, uy) * Math.hypot(vx, vy);
return Math.acos(Math.max(-1, Math.min(1, dot / len)));
}
function trial() {
const p = [Math.random(), Math.random()];
const q = [Math.random(), Math.random()];
const r = [Math.random(), Math.random()];
const A = angle(p, q, r);
const B = angle(q, p, r);
const C = Math.PI - A - B;
return ((Math.PI - A) * (Math.PI - B) * (Math.PI - C)) /
Math.pow(2 * Math.PI, 3);
}