How do we know that mathematics is independent of the definition of the cartesian product? In my first analysis lecture, I learnt what might be the most common way to rigorously deal with functions: Firstly, ordered pairs were defined and then a function was defined as a triple $(X,Y,G)$ with $G\subset X\times Y$. Since there are different "good" ways to define ordered pairs$^1$, I am wondering:
How do we know that the results we derive do not depend on the definition of $X\times Y$?

$^1$ For example, see this question and links therein.
 A: One way of doing this is to introduce new notation $a, b \mapsto (a, b)$ and the axiom $(a, b) = (c, d) \to (a = c \land b = d)$ (as well as forms of replacement and separation which can have $(a, b)$ in them) without specifying any of the other properties of pairing. $X \times Y$ is then defined as $\{(x, y) \mid x \in X, y \in Y\}$ using replacement twice. We then develop all theorems referring to this use of ordered pairs. You will find that this allows us to prove all reasonable theorems of mathematics without needing to know the specifics of what ordered pairing means.
If someone asks us to translate a theorem involving pairs into one in pure set theory, we can pick a specific implementation of pairing (such as $(a, b) = \{\{a\}, \{a, b\}\}$) and translate our statement using this definition.
Another approach is to use category theory. Lawvere came up with ETCS, the elementary theory of the category of sets, which is a reformulation of set theory purely in terms of sets and functions between them. Instead of taking elementhood as the primitive notion, ETCS takes function composition as the primitive notion. When working in ETCS or any number of similar theories, it is straightforward to prove that all properties which can be discussed in the language of ETCS are isomorphism-invariant. Since any two definitions of $X \times Y$ can be put into a unique bijection with each other, it doesn’t matter which one we pick.
ETCS is weaker than ZFC since it has no analogue of the axiom scheme of replacement and deals with a very weak version of the axiom scheme of separation. Both of these schemes can be added to ETCS to get a theory which is equivalent (in a precise way) to ZFC. Given a model of ETCS + replacement, we can construct a canonical model of ZFC and vice versa; the two constructions are inverses.
There is another foundational system created by Shulman known as SEARS (sets, elements, and relations) which is very similar in its properties to ETCS; it’s pretty easy to translate between one and the other if you know what you’re doing. This system may be pedagogically superior and easier to understand without knowing category theory. Like with ETCS, the addition of a replacement axiom scheme makes SEARS equivalent to ZFC.
A: There are multiple ways that we can handle the foundations of mathematics, one of which is set theory. Of these, there are even multiple ways to handle the foundations of set theory.
One such foundation is ZFC. The axioms of ZFC define objects called "sets", and tell us how sets should behave. For instance, given any two sets $X$ and $Y$, it's an axiom that $X=Y$ if and only if they have the same elements.
An alternative foundation is the elementary theory of the category of sets, often abbreviated ETCS, which axiomatizes the category of sets instead. So a typical axiom of ETCS doesn't say what a set is, but it does say that given two sets $A$ and $B$, there exists a set $A \times B$ which satisfies the universal property of the product. Contrast this to ZFC, which also thinks that the product exists, but where we must "build it by hand".
If you're a comfortable programmer, you can think about ETCS as describing an interface for working with sets, while ZFC merely describes the objects themselves. You then have to choose an implementation of the interface. For instance, you have to choose a particular set which should represent the product $A \times B$ promised by ETCS.
What's relevant here is that no matter which choice of definition you take for $A \times B$ in your implementation, as long as it's a reasonable definition, you'll still get a category modeling ETCS. In particular, any mathematics which doesn't break the abstraction boundary (to continue to use the programming analogy) will work equally well with either implementation.
Since most mathematics can be done working only in ETCS, this means that we're able to safely ignore the particular implementation details of functions, pairs, etc. As soon as we start asking implementation level details (for instance, what's the rank of a given set) then our implementation might matter, but these are the kinds of questions which are primarily asked by set theorists, who are well equipped to handle the implementation-specific answers they get.

I hope this helps ^_^
