The interval (-π/2, π/2) can be split into four disjoint intervals: (-π/2, -π/4], (-π/4, 0], (0, π/4] and (π/4, π/2). If there are five points: θ1 = tan(a1), ..., θ5 = tan(a5) lying in these four intervals, then there is an interval with at least two points, say, θi and θj. This is the essence of pigeonhole principle. This means that |θi - θj| < π/4.

Tangent is a monotonic function, so θi - θj < π/4 implies that tan(θi - θj) < tan(π/4) = 1. According to the hint, the left-hand side is equal to (tan(θi) - tan(θj)) / (1 + tan(θi)tan(θj)), i.e., (ai - aj) / (1 + ai * aj) < 1.