540. The knowledge of ten students was tested in two tests: $A$ and $B$. The scores on a hundred-point scale were as follows (the first row shows the scores for test $A$, and the second row shows the scores for test $B$):

| 95 | 90 | 86 | 84 | 75 | 70 | 62 | 60 | 57 | 50 | (*) |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| 92 | 93 | 83 | 80 | 55 | 60 | 45 | 72 | 62 | 70 | (*) |

Find the sample Spearman's rank correlation coefficient between the scores of the two tests.
The solution is as follows. Assign ranks $x_{i}$ to the scores of test $A$. These scores are arranged in descending order, so their ranks $x_{i}$ are equal to their ordinal numbers:

$$
\begin{array}{lllllrrrrrrrr}
\text { ranks } x_{i} \\
\text { scores of } & & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
\text { test } & A & 95 & 90 & 86 & 84 & 75 & 70 & 62 & 60 & 57 & 50
\end{array}
$$

Assign ranks $y_{i}$ to the scores of test $B$, by first arranging these scores in descending order and numbering them:

$$
\begin{array}{rrrrrrrrrr}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
93 & 92 & 83 & 80 & 72 & 70 & 62 & 60 & 55 & 45
\end{array}
$$

Recall that the index $i$ for $y$ should be equal to the ordinal number of the student's score in test $A$.

Find the rank $y_{1}$. The index $i=1$ indicates that we are considering the score of the student who ranks first in test $A$ (this score is 95); from the condition, it is clear that the student received a score of 92 in test $B$, which is ranked second in (**). Thus, the rank $y_{1}=2$.

Find the rank $y_{2}$. The index $i=2$ indicates that we are considering the score of the student who ranks second in test $A$; from the condition, it is clear that the student received a score of 93 in test $B$, which is ranked first in (**). Thus, the rank $y_{2}=1$.

Similarly, find the other ranks: $y_{3}=3, y_{4}=4, y_{5}=9$, $y_{6}=8, y_{7}=10, y_{8}=5, y_{9}=7, y_{10}=6$.

Write down the sequences of ranks $x_{i}$ and $y_{i}$:

$$
\begin{array}{rrrrrrrrrrr}
x_{i} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
y_{i} & 2 & 1 & 3 & 4 & 9 & 8 & 10 & 5 & 7 & 6
\end{array}
$$

Find the differences in ranks: $d_{1}=x_{1}-y_{1}=1-2=-1 ; d_{2}=x_{2}-y_{2}=$ $=2-1=1$. Similarly, we get: $d_{3}=0, d_{4}=0, d_{5}=-4, d_{6}=-2$, $d_{7}=-3, d_{8}=3, d_{9}=2, d_{10}=4$.

Calculate the sum of the squares of the differences in ranks:

$$
\sum d_{i}^{2}=1+1+16+4+9+9+4+16=60
$$

Find the desired Spearman's rank correlation coefficient, considering that $n=10$:

$$
\rho_{\mathrm{B}}=1-\frac{6 \sum d_{i}^{2}}{n^{3}-n}=1-\frac{6 \cdot 60}{10^{3}-10}=0.64
$$

Thus, $\rho_{\mathrm{B}}=0.64$.