TITLE: Linking the intuition of topology with its axiomatic definition
QUESTION [9 upvotes]: For a long time I have had an intuition on what topology is, without ever formally studying it. i.e the classic example of a mug being the same, topologically, as a doughnut, by stretching and reshaping while retaining "holes". 
I have recently started studying it formally, with the idea of a topology of a set being closed under unions and finite intersections etc. I can understand these definitions, but in no way can I relate these to my initial intuitive understanding of what topology is; they seem like separate subjects altogether. 
Could someone please help bridge this gap in my understanding?

REPLY [2 votes]: The idea of a topology perhaps emerges from asking oneself the question: in all of the stretching and reshaping operations that are allowed, what underlying properties of the objects are unaffected? And when the forbidden operations of ripping and tearing occur, what properties of the objects are lost?
Clearly distance itself can be rather severely affected as one stretches, as can other geometric measurements such as angle, straightness, and so on. So much of our traditional geometric intuition goes out the window.
But here's something that doesn't change when we stretch or reshape, and that does change when we rip or tear: closeness.
What is closeness?
Suppose that I take a particular stretching operation, under which a doughnut is stretched and distorted to form a coffee mug. We can think of this operation as a function $f$ from the doughnut to the coffee mug.
If I take two points $x,y$ on the doughnut that are close to each other, their images $f(x)$ and $f(y)$ on the coffee mug will still be somewhat close to each other.
If I take two points $x,y$ on the doughnut that are really close to each other, their images $f(x)$ on the coffee mug will be still closer to each other.
And so on. If you know some analysis, you may see that what I'm describing can be captured in the $\epsilon-\delta$ definition of continuity.
But if I were to actually create a rip, then there are points $x \ne y$ on either side of the rip, which were as close to each other as one could ask for, but after the rip they are not close at all.
So, how can "closeness" itself be described mathematically?
Let's think of "closeness", like beauty, as being in the eye of the beholder. We have an object, a set $X$. We have a bunch of folks observing portions of $X$. The portion of $X$ that Joe observes is a subset of points in $X$, although Joe cannot see everything, and in fact the typical situation is that Joe only sees a small part of $X$. Let's refer to the part of $X$ that Joe sees as his "neighborhood". The key intuition here is that Joe thinks that everything in his neighborhood is "close" to everything else.
The key "closeness" axiom is concocted to resolve potential disagreements between observers over what is close to what. That axiom says:

If Joe and Jane can see the same point $x \in X$ then there is a third observer, say Charlie, who can also see $x$, and furthermore both Joe and Jane will agree with anything that Charlie thinks is close. To put this in set theoretic terms, Charlie's neighborhood also contains $x$, and Charlie's neighborhood is a subset of both Joe's neighborhood and Jane's neighborhood.

This leads to one of the first definitions in topology:

Given a set $X$, a basis for a topology on $X$ is a collection of subsets $\mathcal B$ of $X$ satisfying the following properties:

If $B_1,B_2 \in \mathcal B$, and if $x \in B_1 \cap B_2$, then there exists $B_3 \in \mathcal B$ such that $x \in B_3 \subset B_1 \cap B_2$.
For each $x \in X$ there exists $B \in \mathcal B$ such that $x \in B$.


Of course Property 1 is a formalization of the discussion about Joe, Jane and Charlie. Property 2 is there just to ensure that the atlas of neighborhoods includes all the points in $X$.
One last word: Since you already know a bit about the formal definitions of topology, you've probably already seen how the concepts of "topology" and of a "basis for a topology" are related. They are quite close to each other, although they are not identical concepts. I think the concept of "basis for a topology" is more intuitive. It's definitely harder to give an intuitive explanation for the concept of a "topology" itself. Perhaps what's most important in this regard is that the logical structure of the theory becomes simpler when one adopts the concept of a "topology", without any real loss of theoretical power.