How to concatenate columns with column indices from a set? I will provide a very simple example to help clarify my question as much as possible. 
Let $\mathbf{M}$ be a matrix with columns $\mathbf{M}=[\mathbf{m}_1,\ldots,\mathbf{m}_{10}]$. Let also $S=\{2,6,8\}$ be a given set. I wish to construct another matrix $\mathbf{G}$ using columns from $\mathbf{M}$ whose indices are found in $S$, i.e. $\mathbf{M}=[\mathbf{m}_2,\mathbf{m}_6,\mathbf{m}_{8}]$.
How to do this mathematically and more generally since sets don't have order? We want to avoid having e.g. $\mathbf{G'}=[\mathbf{m}_6,\mathbf{m}_8,\mathbf{m}_{2}]$ since $\mathbf{G'}\neq\mathbf{G}$.
 A: Usually, we say that for $n, m \ge 1$, an $(n \times m)$-matrix with entries in $X$ is a function $\mathbf{M} \colon \{1, \dotsc, n \} \times \{ 1, \dotsc, m \} \to X$. Then, for $i \in \{ 1, \dotsc, n \}$ and $j \in \{ 1, \dotsc, m \}$, we say that the $(i, j)$-entry $\mathbf{m}_{i,j}$ is $\mathbf{M}(i, j)$ and that the $j$-column $\mathbf{m}_j$ is the function $\mathbf{M}(-, j)\colon \{ 1, \dotsc, n \} \to X$, $i \mapsto \mathbf{m}_{i,j}$.
Of course, one can also define a more general kind of object. We could say that, for $A$ and $B$ sets, an $(A \times B)$-matrix with entries in $X$ is a function $\mathbf{M} \colon A \times B \to X$. Then, for $a \in A$ and $b \in B$, the $(a, b)$-entry $\mathbf{m}_{a,b}$ is $\mathbf{M}(a, b)$ and the $b$-column $\mathbf{m}_b$ is the function $\mathbf{M}(-, b)\colon A \to X$, $a \mapsto \mathbf{m}_{a,b}$.
Finally, for a fixed subset $S \subseteq B$, one may define the submatrix $\mathbf{M}_S$ as the restriction $\mathbf{M}_{\mid A \times S}\colon A \times S \to X$, $(a, s) \mapsto \mathbf{m}_{a,s}$.
Notice that, in fact, we need to endow $A$ and $B$ with an order only when we want to represent an $(A \times B)$-matrix on a piece of paper. But, in your situation, if you want the submatrix $\mathbf{M}_S$ (which would be a function $\{1, \dotsc, n \} \times \{2, 6, 8\} \to X$) to be considered as a matrix, you would have to fix a bijection $\sigma\colon \{1, 2, 3\} \to \{2, 6, 8\}$, and then define $\mathbf{G}\colon \{1, \dotsc, n \} \times \{1, 2, 3\} \to X$ by $\mathbf{G}(i, j) = \mathbf{M}_S(i, \sigma(j))$. You can see why different choices of $\sigma$ would produce different matrices.
