Why is it not sufficient to only check the third condition when verifying equality of functions? I have been told that two functions $f$ and $g$ are equal if and only if the domain and the subset of the cartesian product of the two functions is the same. My question is, given that a function is a special case of a relation, both $f$ and $g$ are sets, why is it not sufficient to just verify if the cartesian product is the same between the two functions?. In other words, doesn't the third condition implies that both domains are equal?
 A: A function $f:X\to Y$ consists of three pieces of information: the domain $X$, the codomain $Y$, and the graph $G_f\subseteq X\times Y$. So formally, it makes sense to define a function not just as its graph, but as the tuple $(X,Y,G_f)$, and two functions $f=(X,Y,G_f)$ and $g=(V,W,G_g)$ are equal iff $X=V$, $Y=W$, and $G_f=G_g$. In words, two functions are equal iff their domains, codomains and graphs are equal. But we get the domain for free by checking the graphs, since the graphs contain a pair $(x,f(x))$ for every $x\in X$, so we can extract the domain from the graph. So we only need to check the graph and the codomain, but not the domain.
A: In foundations of mathematics, especially set-theoretic foundations, a function is nothing more than a certain kind of set of ordered pairs, from which you can easily extract its domain and its range, and there is no such thing as a codomain of a function. Two functions are equal exactly when they are the same set, which is equivalent to when they have the same domain and the same output on every input from the domain.
This behaviour is very important when you actually want to build foundations of mathematics, especially in a proper proof of a basic recursion theorem, and for a proper proof of the full recursion theorem. In such proofs, you glue together approximations of a desired function by simply taking the union, and there is no need nor benefit in requiring functions to have "codomains" in such foundations.
So if you really want to understand how everything is built based on ZFC, indeed for two functions to be equal it suffices for them to be the same set of ordered pairs, as it implies that their domains are equal.
Concerning the arguments people are having in other comments, I will just say that it is actually standard terminology to say "$f$ surjects onto $T$" when one wants to be consistent with set-theoretic foundations, since "$f$ is a surjection" makes no sense in this setting. Foundationally, "$f : S→T$" simply means that $f$ is a function with domain $S$ whose range is a subset of $T$.
In practice people who do not have a background in foundations of mathematics tend to mean not just that but also that $f$ is 'tagged' with a codomain $T$. Foundationally, we would need to represent such a 'tagged function' by something like a pair $(f,T)$. Then again, I would say that even these people are often inconsistent with their notation, because they frequently define functions without specifying a codomain, and also they consider any function from $ℕ$ to $ℝ^+$ as also a function from $ℕ$ to $ℝ$.
