# Mathematical function that maps a vector to an ordered version of that vector

Given a vector $x \in \mathbb{R}^n$, I would like to refer to a vector $x'$ that contains the components of $x$ ordered in ascending order. I would like to define the function $f(x)$ that maps $x$ to $x'$. What would the right hand side of this be?

$$f(x) = \ldots$$

• I am flagging this question as off-topic as it has nothing to do with statistics. It may be suited for Mathematics though. – Wrzlprmft Aug 22 '17 at 17:06
• That being said, you already defined the function in your question. You may find it difficult to express it in terms of simpler (school) mathematical notation, but that’s a different problem, if it is a problem at all. – Wrzlprmft Aug 22 '17 at 17:09

There is a fairly standard notation: given a vector $x=(x_1, x_2, \ldots, x_n)$, its order statistics $(x_{[1]}, x_{[2]}, \ldots, x_{[n]})$ are the permutation of $x$ for which $x_{[1]} \le x_{[2]} \le \cdots \le x_{[n]}$. Some people use parentheses instead of square brackets around the indexes, as in $x_{(i)}$ instead of $x_{[i]}$.
After you have described this function, you are free to name it anything you like, using $^\prime$, "$f$", "$\operatorname{Bob}$", or anything else.
Let the permutation group $\mathfrak{S}^n$ act on $\mathbb{R}^n$ by permuting the coordinates: that is, for $\sigma\in\mathfrak{S}^n$ and $x=(x_1,x_2,\ldots, x_n)\in\mathbb{R}^n$, define $$\sigma\cdot x = \left(x_{\sigma(1)},x_{\sigma(2)}, \ldots, x_{\sigma(n)}\right).$$ For any $x\in \mathbb{R}^n$, let $\sigma_x \in \mathfrak{S}^n$ be any permutation of the coordinates of $x$ for which $x_{\sigma_x(1)} \le x_{\sigma_x(2)} \le \cdots \le x_{\sigma_x(n)}.$ Define $f:\mathbb{R}^n\to\mathbb{R}^n$ by $$f(x) = \sigma_x \cdot x.$$
(Because $\sigma_x$ is not unique whenever two or more coordinates of $x$ are the same, you still have to show that $f$ is well-defined, but that is sufficiently straightforward and obvious that you could leave it to the reader.)