KatInterview

Average Arc Length Containing a Fixed Point on a Circle

Math & Bit ManipulationAuto-graded · 14 test cases
EasyAuto-gradedMath & Bit Manipulationprobabilitygeometryexpectation

Last updated

Tests understanding of geometric probability, the inspection paradox, and computing expectations when a random partition is observed from a fixed viewpoint.

Three points are placed independently and uniformly at random on the circumference of a unit circle (radius 1, centered at the origin). These three random points divide the circle into three arcs.

Consider the arc that includes the point (1, 0) — that is, the point at angle 0 radians. What is the expected length of this arc, measured along the circumference?

Return this expected value as a floating-point number.

Constraints:

  • The circle has radius 1, so its total circumference is 2π
  • Arc length is measured along the curved edge of the circle
  • The three points are chosen independently from a uniform distribution on [0, 2π)
  • You may assume no point lands exactly at angle 0 (probability zero event)

Examples

Example 1

Input: arc_containing_fixed_point()

Output: 3.141592653589793

Example 2

Input: arc_containing_fixed_point()

Output: 3.141592653589793

Hints

Hint 1

The arc containing angle 0 is bounded by the nearest point in each direction (clockwise and counterclockwise). What are the expected distances to these boundary points?

Hint 2

For n independent uniform random variables on [0, T], the minimum has expected value T/(n+1). Apply this to find the expected distance to the nearest point in each direction.

Hint 3

This is not simply 2π/3 (the average arc length). A fixed observation point is more likely to fall within a longer arc — this is called the inspection paradox or size-biased sampling.