Let \(M\) be a dataset of \(m\) components and \(n\) observations.
The Mann-Kendall's (MK) test statistic for a variable of the dataset \(M^{(u)}\) is given by:
$$M^{(u)} = \sum_{1 \leq i \leq j \leq n} sgn(x_j^{(u)} - x_i^{(u)})$$
where \(sgn(\cdot)\) is the sign function:
$$
sgn(x)=\begin{cases}
-1 \quad \text{if } x<0, \\
0 \quad \text{if } x=0, \\
+1 \quad \text{if } x>0
\end{cases}
$$
This test statistic is normal distributed, with mean and variance:
$$E(M^{(u)}) = 0$$,
$$\text{var}(M^{(u)}) = \frac{n(n-1)(2n+5)}{18}$$