What is a function at all? Let $$f:\{1,2,3\}\rightarrow \{1,4,9\}$$
$$f(x)=x^{2}$$
Then I can represent it as ordered pairs as follows
$$f=\{(1,1),(2,4),(3,9)\}$$
Let me know if I am going right.
My question is, can the function also be represented as ordered pairs consisting of all $y$-coordinates i.e is
$$f=\langle 1,4,9\rangle$$
I got this question due to answer given to this question. He gives an example at last, saying that the ordered pair $\langle 1,3 \rangle$ can be represented by the function $f:\{1,2\}\rightarrow \{1,2,3\}$ and $1\rightarrow 1$ and $2 \rightarrow 3$
Now I am having a hard time understanding all these stuff. Any help is appreciated.
 A: On a function you have domain set $\{1,2,3\}$ which is a set of all possible things that get maps.  And you have a codomain $\{1,4,9\}$ which is the set of all the possible things that might get mapped to.
But a function has to be the mapping and how the items must exist. One way or another there is the concept that $1$ is mapped to $1$, and the $2$ is mapped to $4$.  And the $3$ is mapped to $9$.  Any mechanism that does this will be okay.
The conventional way is to have a set of ordered pairs, $(\text{the thing being mapped},\text{the thing being mapped to})$ so you function can be written as $\{(1,1),(2,4),(3,9)\}$.
(Note: when you said "Let
f:{1,2,3}→{1,4,9}
Then I can represent it as ordered pairs as follows..." you never stated what the actually mapping is.  We know that $1,2$ and $3$ each get mapped to one of $1,4,9$ but we have no idea which.)
Now although conventionally we can represent a mapping of $1\mapsto 1; 2\mapsto 4;3\mapsto 9$ as  $\{(\text{the thing being mapped},\text{the thing being mapped to})\}$ of for you function $\{(1,1),(2,4),(3,9)\}$, but that is not the only possible way.
We could represent it as pair of $n$-tuples (assuming the domain is finite or even countable) but letting one $n$-tuple be $\langle\text{first thing being mapped},\text{second thing being mapped}.....\rangle$ and the other $n$-tuple being $\langle\text{what the first thing is being mapped to},\text{what the second thing is being mapped to}....\rangle$
For your function that is $\langle 1,2,3\rangle \to \langle 1,4,9\rangle$.
These are just notations.  They express the same thing.
A: So typically we define a function as follows:
Let $A,B$ be sets. A function is some $f \subseteq A \times B$ such that for each $a \in A$, there is a unique $b \in B$ such that $(a,b) \in f$.
Now we write $f(a)$ to mean the unique $b \in B$ such that $(a,b) \in f$.
Now, this coincides with one of your representations, where you've written out all the ordered pairs, hence a subset of $A \times B$.
But there are some other ways you can think of it, as long as its consistent with the original definition. If your domain set $A$ is finite (say $A = \{a_1, ..., a_n\}$) or at least countable, then representing a function $f$ as
$$f = \langle f(a_1), ..., f(a_n) \rangle $$
seems totally fine to me, but I don't think its super conventional (at least not outside of set theory). The only issue with this is that it doesn't reference the domain, so you need to be careful.
