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 structure. 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.