I have read some books in analysis,all of them define metric space,topological space or vector space directly,without any reason. Therefore, I want to know the background of the definition, the problem the space aim to solve,is there any reference? Thanks a lot.
Originally mathematics was intended to describe the real world. We then continued to develop it using the intuition of how the real world behaves in order to describe how mathematical objects would behave.
In the 19th and 20th century mathematics had several foundational crises. It turned out that intuition is not a good enough foundation for mathematics. Instead we need to describe certain properties in a formal fashion and use logical rules of inference to deduce properties of mathematical objects.
When this is done, one can easily see that certain properties are enough to discuss certain happenings. For example, if $T$ is a linear transformation of $\mathbb R^2$ then it is surjective if and only if it is injective. However the fact that we are over $\mathbb R$ did not matter, and this is certainly true for $\mathbb R^3$ as well. It turns out that if $V$ is a finitely generated vector space over any field $\mathbb F$ then this is true.
If so, the notion of space tells us that it is a mathematical universe which has certain strutcture. These properties are the concrete properties we need to generalize the concrete real-world describing phenomenon to a general mathematical context. This abstract is very useful because it allows us to apply the same tools on seemingly different problems, simply by showing that two different objects can be seen as constructs of a similar kind.
Now we return to the particular question, vector spaces; topological spaces; metric spaces; etc. Those are often generalizations of things naturally arising during the intuition-based era of mathematics. For example, $\mathbb R$ is a metric space. It has a very natural metric, the absolute value which tells us how close are two numbers. This notion can be used to define things like continuity of a function, or convergence. It turns out that measuring distance can be done in a different way, and the distance function need only to satisfy several basic properties, to a space in which we can measure distances between points we call a metric space.
Similarly, but less clearly, topology is also a generalization of the real numbers and metric spaces. We notice that we can use open intervals in the real numbers, we notice that a sequence converges to a point $x$ if in every open interval around $x$, all but finitely many points of the sequences appear. Therefore open intervals are a good way to measure convergence. Topological spaces are very much a generalization of this notion, we define sets which we call open, and a sequence converges to a point if in every open set which contains this point almost all the sequence can be found.
Vector spaces rise naturally when solving a system of linear equations in several variables. It turned out that not only we can generalize the number of variables and equations, but also that linear functions can be used to approximate less-linear functions (e.g. differentiable functions), and that vector spaces can be used to describe many more objects in mathematics. For example "all the real-valued continuous functions from the real numbers" has a very natural structure of a vector space over $\mathbb R$. In this vector space integrating can be seen as a linear functional, and taking anti-derivative is a linear operator. Both are very natural to calculus.
All these notions, and much much more, are generalized even further in mathematics. What many mathematicians do is the study of properties, asking "what property would guarantee that a certain consequence is true?", and "what property is necessary for this consequence to hold?". That, in my eyes, the greatest beauty in mathematics. The ability to isolate and generalize properties from the particular case into an extremely abstract case.
You are quite right to ask for the context of these definitions. One place to look in this case is
There are three reasons for abstraction:
Thus the power of abstraction is also to allow for analogies.
One should also mention the amazing extension of the notion of metric space by F.W. Lawvere in
Lawvere, F. William Metric spaces, generalized logic, and closed categories With an author commentary: Enriched categories in the logic of geometry and analysis. Repr. Theory Appl. Categ. No. 1 (2002), 1–37.
Later: You should also realise that one of the driving forces of abstraction is laziness! Thus suppose we are working in the space $\mathbb R^3$ with the usual Euclidean distance, and have two points, say $P=(x,y,z), Q=(u,v,w)$. After a time we might get fed up with writing down the formula for the distance from $P$ to $Q$ and decide to abbreviate it to $d(P,Q)$. Then you start asking yourself what properties of $d(P,Q)$ am I really using, and it may be a surprise to find how few of these you need for the proofs, and how much easier it is to use these properties to write down the proofs and to understand them. Thus these properties of $d$ become the underlying structure for this situation. You find that you really understand why something is true. Then you find that these properties apply to more examples, and you are well away to an "abstract" theory.
Again the pressure might be to apply arguments you have used in one situation in another, but the notion of distance does not immediately apply. Hence the notion of "neighbouhood".
After many years it was found that in many situations the notion of "open set" is easier to work with, and has a logically simpler set of rules. So this comes to be thought of as THE definition of a topological space, and the poor students often get presented with this definition with no history, no motivation, no background, but a command to learn it! (Protests not allowed, either! We all know that the writer of:"Give pepper to your little boy/And beat him when he sneezes./He only does it to annoy,/ and can stop whenere he pleases." was a mathematician!)
One of the reasons for abstraction is also that analogies are not between things but between the relations between things. So knots are quite unlike numbers, but the rules for the addition of knots are analogous to the rules for multiplication of numbers. So one can define a "prime knot", and ask: are there infinitely many prime knots? This is how mathematics advances, often for lack of a simple idea. As Grothendieck wrote: "Mathematics was held up for thousands of years for lack of the concept of cipher [zero], and nobody was around to take such a childish step."
Grothendieck has also argued in Section 5 of his famous "Esquisses d'un programme" (1984) against the concept of topological space, as being inadequate to express geometry, or at least the geometry he had in mind. So there is nothing sacrosanct about these concepts, and their applicability and disadvantages need to borne in mind.
In a college debate (years ago!) I was taken to task by a more experienced debater who quoted: "Text without context is merely pretext." I believe that the import of this applies also to mathematics, and relates to my initial remarks.
I don't think that you will find that there were specific problems in mind in the development of these more abstract concepts. In terms of topological spaces, around the time of the development of a rigourous foundation for the calculus, mathematicians had to come to grips with what exactly a real number was, and what properties the real line had. They also discovered that they could apply certain ideas and methods from the familiar Euclidean spaces to "spaces" which were quite unlike these. As these ideas and methods gained more use, it was natural to attempt to find the central core of these arguments and develop a general theory about these sorts of "spaces".
The following is taken directly from Engelking's text (General Topology):
Well, for the metric space, it's quite obvious that the metric is just an abstraction of the common concept of distance. So in the real world, there are places. Whenever you have two places (say, New York and the place where you currently are), you can tell the distance (e.g. "I'm twelve miles from New York"). That distance is never negative (if someone says "I'm minus twenty miles from New York" you immediately know he's speaking nonsense, even if you have no idea where he is). Also, if that distance is 0, you obviously must be in New York, and if you are in New York, your distance to it must be 0. Also, if you are 12 miles from New York, New York is 12 miles away from you. There's also the observation that if you look at the distances of both you and New York to a third place (say, to Washington), that the distances add up to something at least as large as your distance to New York. Essentially that encodes the fact that the direct way to new York is the shortest way; it would be a strange distance measure where you could save by making a detour.
Now what I just described above are exactly the axioms of a metric space. The places are called "points", and since there many of them, there's a set of them. The distance is called "metric" and is required to have exactly the properties given above: It is defined for each pair of points (for each two places, there's a distance), $d(x,y)\ge 0$ (the distance cannot be negative), $d(x,y)=0$ exactly if $x=y$ (if your distance to New York is 0, you are in New York, and vice versa), $d(x,y)=d(y,x)$ (your as far from New York as New York is from you) and $d(x,y) \le d(x,z) + d(z,y)$ (the distance between you and New York cannot be larger than the distance between you and Washington plus the distance between Washington and New York).
OK, now on to the topological space. Now think not about just single places, but complete areas (for example, countries on earth). One obvious question you can ask is if you are inside the country, or at the border. Of course you can decide that by just measuring the distance to the border (which is the minimum of the distances to all points on the border) and see if it is larger than 0. However, it seems strange that you need to measure distances to do so. After all, you should be able to tell if you are on the border without that. If you are on the border none of the countries surrounds you. So you need to have a concept of "a set surrounding you" which ultimately doesn't rely on distance. This concept is given by open sets and neighbourhoods. An open set is just a set which surrounds all its points (which means it doesn't contain its own border). So whenever you are in that set, you are surrounded by it, and definitely not at its border. Of course if you are in that set, you are also surrounded by all those sets which contain that set. Such sets are called neighbourhoods. Now if you are on the border of some set, there's of course no such neighbourhood which is completely in that set. So all you need to distinguish the interior from the border is the concept of open sets (=sets which surround all their points).
Again, such "sets which surround all their points" have some general properties, which make up the definition of topological spaces. For example, the surface of earth (i.e. the set of all points) surrounds all its points. Also, the empty set surrounds all its points (because it has no points, it surrounds all of them). Moreover, if two sets surround all their points, the intersection does, too (because if you are in the intersection, you are surrounded by both sets, and thus by the intersection). And if you do an union of arbitrary "surrounding" (i.e. open) sets, again you get a "surrounding", i.e. open set. So the concept of "open set" and the topological space are actually an abstraction of the real-world concept "being surrounded by".
The problem the spaces aim to solve: They are "helpers". I mean, you have a whatever mathematical structure and you want to study it. Once you find: "Oh, my structure is metrisable (i.e., there exist a metric on it)," you can open any textbook on metric spaces and everything will be valid for your structure.
If you find a structure that is closed under multiplication by numbers and addition, you have a vector space and again, the whole theory is valid for your structure.
This is the reason why it is important to study such general structures as "spaces".