Show that given seven real numbers, it is always possible take two of them, such that $\left\vert\frac{a-b}{1+ab}\right\vert<\frac{1}{\sqrt{3}}$

Solution 1:

Assume that $x_1\leq x_2\leq x_3\leq x_4\leq x_5\leq x_6\leq x_7$ and set $\theta_i = \arctan(x_i)$. We have $\theta_1\leq\theta_2\leq\theta_3\leq\theta_4\leq\theta_5\leq\theta_6\leq\theta_7$ and for any $i\in[1,7]$, $\theta_i$ is an element of the open interval $\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$ having length $\pi$. It follows that the distance between the closest $\theta$s, say $\theta_j$ and $\theta_{j+1}$, is $<\frac{\pi}{6}$ and:

$$ \frac{1}{\sqrt{3}}=\tan\frac{\pi}{6}>\tan\left(\theta_{j+1}-\theta_j\right) = \frac{x_{j+1}-x_j}{1+x_j x_{j+1}}.$$

Solution 2:

(using the idea of @Wojowu:)

HINT: write $a_i = \tan \alpha_i$ with $\alpha_i = \arctan(a_i) \in (-\frac{\pi}{2}, \frac{\pi}{2})$. Say $$a_1 \le a_2 \le \cdots \le a_7$$ and so $$-\frac{\pi}{2} < \alpha_1 \le \alpha_2 \le \cdots \le \alpha_7 < \frac{\pi}{2}$$

We have $$ (\alpha_2 -\alpha_1) + ( \alpha_3 - \alpha_2) + \cdots + (\alpha_7 - \alpha_6) = \alpha_7 - \alpha_1 < \frac{\pi}{2} - (-\frac{\pi}{2}) < \pi$$ so at least one of the numbers $\alpha_{i+1} - \alpha_i$ is $< \frac{\pi}{6}$ (the sum had six terms). For that difference we have $$0 \le \alpha_{i+1} - \alpha_i < \frac{\pi}{6}$$ so $\tan ( \alpha_{i+1} - \alpha_i ) \in ( 0, \tan \frac{\pi}{6})$

Use now the formula for the tangent of the difference and the value $\tan \frac{\pi}{6}$

$\bf{Added:}$ Since OP mentioned the pigeon-hole principle, let's give a solution using it. Consider the partition of the interval $(-\frac{\pi}{2}, \frac{\pi}{2}]$ into $6$ parts: $$\left(-\frac{\pi}{2}, \frac{\pi}{2}\right] = \bigsqcup_{k=0}^5 \left(-\frac{\pi}{2}+ k\frac{\pi}{6}, -\frac{\pi}{2}+ (k+1)\frac{\pi}{6}\right] $$ At least two of the number $\alpha_i$ ( there are $7$ of them) will be in the same part, so their difference will be $\ge 0$ and $< \frac{\pi}{6}$.