Ordered pair definition Why is the ordered pair $(x,y)$ defined to be the set $\{\{x\},\{x,y\}\}$?
My book states that it is simply defined this way and then proceeds to perform a bunch of magic using this definition.

It is solely to show that for any $x,y,$ a set $(x,y)$ exists meeting the qualities that we want an ordered pair to have: namely, that ordered pairs are equal if and only if their respective components are equal. Once the existence of such pairs is proved, there is no need to adhere to that specific definition any longer. Other definitions are sometimes given, but the Kuratowski ordered pair makes proving existence and the desired properties very simple (only Extensionality and Pairing are necessary), so tends to be used over other options.
Indeed, take any $x,y.$ By Pairing, $\{x,y\}$ exists, as does $\{x,x\}.$ Then by Extensionality, $\{x,x\}=\{x\},$ so again by Pairing, $\bigl\{\{x\},\{x,y\}\bigr\}$ exists.
Now, suppose $\bigl\{\{x\},\{x,y\}\bigr\}=\bigl\{\{u\},\{u,v\}\bigr\}.$ It can be readily shown by Extensionality that $\{x\}=\{x,y\}$ if and only if $x=y.$ In the case $x=y,$ we then have $\bigl\{\{x\}\bigr\}=\bigl\{\{u\},\{u,v\}\bigr\},$ so by Extensionality, $\{u\}=\{x\}$ (so $u=x$ by Extensionality) and $\{u,v\}=\{x\}$ (so $v=x=y$ by Extensionality). In the case $x\ne y,$ we cannot have $\{u\}=\{x,y\}$ (since we cannot have both $u=x$ and $u=y$), so we must have $\{u\}=\{x\}$ (so $u=x$ by Extensionality) and $\{x,y\}=\{u,v\}$ (so $v=y$ by a few applications of Extensionality).
