Why ordered n-tuple can be defined as a surjective function? I was doing this exercise and didn't understand why it specifically defined a ordered n-tuple as a surjective function rather than just a function or injective function?
The answer of this question mentioned this definition too, but I'm not sure whether I understood what this answer said.
Ordered Pairs (Ordering multiple elements)

 A: The 3-tuple $(17,42,\text{duck})$ could be viewed as the function $\{1,2,3\}\to \{\text{duck},\text{goose},\pi\}\cup \Bbb Z$ or (equally validly) as the function $\{1,2,3\}\to \{\text{duck},17,42\}$. However, only the latter function is surjective. Viewed as functions, we distinguish between these two cases (how else could we say that one is surjective and one is not?) even though their graphs are the same set of pairs. So in order to pick the function representing our tuple, we need to make a choice. The most natural choice is the surjective one, in particular because we cannot a priori restrict the range otherwise (who would have thought that a duck occurs in the 3-tuple?)
A: I bet this author defines a function $f$ to be a triple $(S,A,B)$ where $A$ and $B$ are sets and $S$ is a subset of $A \times B$ that satisfies certain properties. The set $B$ is called the codomain of $f$. You could define a new function $\hat f$ by enlarging $B$ while leaving $S$ and $A$ unaltered. The only difference between $f$ and $\hat f$ is that $\hat f$ has a larger codomain.
Given this definition of a function, if we try to define an ordered $n$-tuple to be a function $f$ with domain $\{i \in \mathbb N \mid 1 \leq i \leq N \}$, we have to worry that by enlarging the codomain of $f$ we would obtain a new function $\hat f$ that represents the same $n$-tuple. The functions $f$ and $\hat f$ satisfy $f(i) = \hat f(i)$ for $i = 1,\ldots,N$, and yet $f \neq \hat f$. This is a problem, because $n$-tuples are supposed to be equal if and only if their corresponding components are equal.
Thus, the author avoids that problem by insisting that $f$ must be surjective.
A: It's a little subtle. The key is that $X$ can vary. For example, the ordered triple of integers we write informally as $(4, 6, 4)$ would be represented using this definition as a surjective function from the set $\{1, 2, 3\}$ to the set $\{4,6\}$ in the obvious way.
Can you finish the exercise now?
A: It's not a lucky formulation, indeed. 
In short, they simply take all functions $\{1,2,\dots n\} \to X$ as $n$-tuples. 
The point is that every function $f:A\to B$ can be regarded as a surjective function $A\to\mathcal R(f)$ where $\mathcal R(f)$ is the range of $f$. 
This point of view is taken here, as implicitly indicated by the note

(so different ordered $n$-tuples are allowed to have different ranges) 

