5. Let $a_{1}, a_{2}, \cdots, a_{n}$ be given real numbers, not all zero. If real numbers $r_{1}, r_{2}, \cdots, r_{n}$ satisfy the inequality
$$
\sum_{k=1}^{n} r_{k}\left(x_{k}-a_{k}\right) \leqslant\left(\sum_{k=1}^{n} x_{k}^{2}\right)^{\frac{1}{2}}-\left(\sum_{k=1}^{n} a_{k}^{2}\right)^{\frac{1}{2}}
$$

for any real numbers $x_{1}, x_{2}, \cdots, x_{n}$, find the values of $r_{1}, r_{2}, \cdots, r_{n}$.
(CMO - 3 Problem)
5. Let $x_{1}=x_{2}=\cdots=x_{n}=0$, by the assumption we get $\sum_{k=1}^{n} r_{k} a_{k} \geqslant\left(\sum_{k=1}^{n} a_{k}^{2}\right)^{\frac{1}{2}}$.

Let $x_{k}=2 a_{k}(k=1,2, \cdots, n)$, we also get $\sum_{k=1}^{n} r_{k} a_{k} \leqslant\left(\sum_{k=1}^{n} a_{k}^{2}\right)^{\frac{1}{2}}$.
(1) and (2) imply $\sum_{k=1}^{n} r_{k} a_{k}=\left(\sum_{k=1}^{n}\left(a_{k}^{2}\right)^{\frac{1}{2}}\right)$.

By the Cauchy-Schwarz inequality, we have $\sum_{k=1}^{n} r_{k} a_{k} \leqslant\left(\sum_{k=1}^{n} r_{k}^{2}\right)^{\frac{1}{2}} \cdot\left(\sum_{k=1}^{n} a_{k}^{2}\right)^{\frac{1}{2}}$, and since $a_{1}, a_{2}, \cdots, a_{n}$ are not all 0, we can further get from (3) that $\sum_{k=1}^{n} r_{k}^{2} \geqslant 1$.

On the other hand, let $x_{k}=r_{k}(k=1,2, \cdots, n)$, using (3) and the assumption, we get $\sum_{k=1}^{n} r_{k}^{2} \leqslant\left(\sum_{k=1}^{n} r_{k}^{2}\right)^{\frac{1}{2}}$. Thus, from (1) we can deduce that $\sum_{k=1}^{n} r_{k}^{2} \leqslant 1$.
Therefore, (4) and (5) give us $\sum_{k=1}^{n} r_{k}^{2}=1$.
From (6) and (3), we know that $\sum_{k=1}^{n} r_{k} a_{k}=\left(\sum_{k=1}^{n} r_{k}^{2}\right)^{\frac{1}{2}} \cdot\left(\sum_{k=1}^{n} a_{k}^{2}\right)^{\frac{1}{2}}$.
According to the condition for equality in the Cauchy-Schwarz inequality, there exists a real number $\lambda$, such that $r_{k}=\lambda a_{k}, k=1,2, \cdots, n$. From (3), we get $\lambda=$ $\left(\sum_{k=1}^{n} a_{k}^{2}\right)^{-\frac{1}{2}}$. Thus, $r_{i}=\frac{a_{i}}{\sqrt{\sum_{k=1}^{n} a_{i}^{2}}}, i=1,2, \cdots, n$.