The idea of using n-tuples to represent functions is introduced in Terence Tao's Analysis I ex 3.5.2:
Suppose we define an ordered $n$-tuple to be a surjective function $x > : \{i \in N : 1 \leq i \leq n\} \to X$ whose codomain is some arbitrary set $X$ (so different ordered n-tuples are allowed to have different ranges); we then write $x_i$ for $x(i)$ and also write $x$ as $(x_i)_{1 \leq i \leq n}$. Using this definition, verify that we have $(x_i)_{1 \leq i \leq n} = (y_i)_{1 \leq i \leq n}$ if and only if $x_i = y_i$ for all $1 \leq i \leq n$.
Question: Why does the function need to be surjective?
My Thoughts
Initially I thought this was to ensure the range of the function was fully accounted for by the n-tuple. However, Tao is quite precise in using range and codomain precisely, so I don't think this is an avenue worth pursuing.
Then I thought about the traditional textbook approach of considering the definition of surjective - that every element of the codomain has an element in the domain which is mapped to it. But that line of thinking doesn't seem to help here.
Exploring this site, I can see that surjectivity is only needed for the later part of the exercise:
Also, show that if $(X_i)_{1 \leq i \leq n}$ are an ordered n-tuple of sets, then the Cartesian product, as defined in Definition 3.5.6, is indeed a set. (Hint: use Exercise 3.4.7 and the axiom of specification.)
I can't even begin to attempt this (I'm a beginner) - so I suspect understanding the need for surjectivity may help?