From Mathematical Proofs: A Transition to Advanced Mathematics —
Later in the 19th century, the German mathematician Richard Dedekind wrote:
A function φ on a set S is a law according to which to every determinate element s of S there belongs a determinate thing which is called the transform of s and is denoted by φ(s).
Why can't we just use this intuitive definition of functions? Why do we define functions as sets of ordered pairs?
Let's consider two variables — $x$ and $y$. And let's say, $y = x + 2$. This equation encodes the notion of relations. It's a compact way of saying, "Two variable quantities $x$ and $y$ are related, such that $y$ is the sum of $x$ and $2$." In calculus, we call this relation/rule the function. But in Set Theory, functions are redefined as sets. But we know, the set
$$ F = \{(x, y) \in \Bbb R^2 : y = x + 2\} $$
is the extension of the relation/rule, $y = x + 2$. Why then is it defined as the function itself. Here is another excerpt from Elements of Set Theory —
The set of [ordered] pairs has at times been called the graph [extension] of the function; it is a subset of the coordinate plane $\Bbb R \times \Bbb R$. But the simplest procedure is to take this set of ordered pairs to be the function.
Why do the authors think, defining functions as sets is very natural? Why not just say, the set $F$ is the extension of the relation, implied by the equation $y = x + 2$, and the relation (intension) is the function?