Correlation between a random variable and its rank Let $X_1,\ldots,X_n$ be a random sample from $U(0,1)$ and $X_{(1)}<\ldots<X_{(n)}$ be the corresponding order statistics. 
Define,
$$
R(X_1) = r\quad \text{if}\quad X_{(r)} = X_1;\quad r = 1(1)n 
$$
i.e. $R(X_1)$ is the rank of $X_1$ in the ordered sample. Then what will be correlation between $X_1$ and $R(X_1)$ ?
 A: A generalization of the problem statement is that $X_1, \dotsc,X_n$ is exchangeable. Then we will also get $R_1, \dotsc, R_n$ is exchangeable, and even the bivariate vectors 
$$
\left( (\begin{smallmatrix} X_1\\R_1\end{smallmatrix}), \dotsc, (\begin{smallmatrix} X_n\\R_n\end{smallmatrix}) \right)
$$ is exchangeable. Let $\mu$ be the common mean of the $X_j$. The common mean of the $R_j$ is $(n+1)/2$. By exchangeability we have that $\DeclareMathOperator{\E}{\mathbb{E}} \E X_1 R(X_1) =\E X_j R(X_j)$ for $j=1, \dotsc,n$. Then we find
$$
   \E X_1 R(X_1) =\frac1{n}\sum_{j=1}^n \E X_j R(X_j) = \\
\frac1{n}\sum_j X_{(j)} R(X_{(j)}) =\frac1{n}\sum_j \E X_{(j)} j =\\
\frac1{n} \E \sum_j j X_j=\frac1{n} \mu \sum_j j =\\
\frac{n(n+1)\mu}{2 n}=\frac{\mu (n+1)}{2}
$$
and then it follows fast that the correlation is zero, under much greater generality than in the question. 
A: \begin{align}
E[X_1R(X_1)]=\frac1n\sum_{r=1}^nr\frac{\int_0^1xx^{r-1}(1-x)^{n-r}\mathrm dx}{\int_0^1x^{r-1}(1-x)^{n-r}\mathrm dx}=\frac1n\sum_{r=1}^n\frac{r^2}{n+1}=\frac{2n+1}6\;,
\end{align}
so with $E[X_1]=\frac12$ and $E[R(X_1)]=\frac{n+1}2$ we have
$$
\operatorname{Cov}(X_1,R(X_1))=\frac{2n+1}6-\frac12\cdot\frac{n+1}2=\frac{n-1}{12}\;.
$$
With $\operatorname{Var}(X_1)=\frac1{12}$ and $\operatorname{Var}(R(X_1))=\frac{n^2-1}{12}$ the correlation coefficient is
$$
\frac{n-1}{\sqrt{n^2-1}}=\sqrt{\frac{n-1}{n+1}}=\sqrt{1-\frac2{n+1}}\;.
$$
