TITLE: Show that $0 < \frac{y-x}{1+xy} < 1$.
QUESTION [6 upvotes]: Let $E$ a finite set of real, with at least 5  elements.
I remember that my teacher proved that there exist two of its elements $x<y$, such that $0 < \dfrac{y-x}{1+xy} < 1$.
Unfortunately I can not find my notes and (inevitably..) I do not remember how to prove this result.

REPLY [10 votes]: Hint: try the pigeonhole principle.
Use the formula $$
\tan (a-b) = \frac{\tan a - \tan b}{1+\tan a \tan b}
$$

details:
Take $\arctan$ of each element, you get elements of the set
 $$(-\pi/2,\pi/2) =(-\pi/2,-\pi/4]
\cup(-\pi/4,0] \cup (0, \pi/4]
\cup (\pi/4, \pi/2).$$
There are $5$ elements, so at least two of them have are
in the same interval
and then
$$
0<\arctan y - \arctan x <\frac\pi 4.
$$(0 is excluded, because the elements are different and $\arctan$ is into).
$$
\frac{y-x}{1+xy}=
\tan (\arctan y - \arctan x)\in(0,1).
$$