In this paper we analyze some properties of the empirical diagonal and we obtain its exact distribution under independence for the two and three-dimensional cases, but the ideas proposed in this paper can be carried out to higher dimensions. The results obtained are useful in designing a nonparametric test for independence, and therefore giving solution to an open problem proposed by Alsina, Frank and Schweizer [2].