Why does the distance function (between $x\in A$ and $A\subseteq X,$ $X$ a metric space) use $\inf$ and not $\sup$? Given a subset $A\subset  X$ of a metric space (X, d) and $x\in X$. The distance between the
point x and the set A is the infimum of the distances between the point and those in the set:
$$d(x,A)  = \inf_{a\in A} \{d(x, a)\}.$$
I need  explanation of this definition with examples. 
Why do we take infimum of distances?  Why not take the supremum?
Why do we find distance between points and sets?  
Thanks for giving me time.
 A: The distance function $d$ in a metric space $(X,d)$ is defined for two points, i.e. we can calculate the distance between any two points in a metric space. So if we need to calculate the distance between a set and a point what shall we do? A real life example will help. 
Suppose you are standing on point $x$ and you want to go to town A. Now A is a large town and has many entrances. Which one will you choose? Of course you will choose the one closeset to your position $x$ and if you are asked to calculate the distance between your position and the town A you will actually calculate the shortest distance, i.e the distance between you and the entrance which is closest to you.  
Translating this idea into the terms of metric spaces we see this definition says that the distance between a set $A$ and a point $x$ in the metric space is actually the distance between the point $x$ and the point in the set $A$ which is closest to $x$. As in some cases a "closest" point can not be found, we are using infimum, instead of minimum.
One other way of observing the usefulness of taking infimum in the definition is if you think that the point $x$ is inside $A$. Taking the supremum will give a positive distance (unless $A$ is a singleton). But if you are standing in town A, would you like to say that the distance between you and this town is, say, 5 kms?
A: Usually we consider the distance of a point from a subset when we want to treat the whole subset as a single point. Therefore, the new distance of any two points inside the subset should be zero. This condition is achieved by inf. When $A$ is a closed subset of $X$, the above formula actually defines a metric on the quotient space $X/A$. It is the quotient space defined by the relation $\sim$ defined as follows: $a\sim b$ iff $a,b\in A$.   
A: A key theorem in the Calculus of Variations says that if $H$ is a Hilbert space, $K\subseteq H$ is closed and convex, and $x\in H$, there is a unique $y\in k$
so that
$$d(x,y) = \inf_{z\in K} d(x,z).$$
This gives the existence of orthogonal projection onto a closed subspace of a Hilbert space.  
A: For example, in calculus and linear algebra you want to define the distance between a point and a line or plane. Then you find the minimum distance between your point and a point of your plane. In this case you talk about the projection of the point in the hiperplane set. Proyections are so important because many of study is used when are dealing with inner product spaces.
The generalization of this idea is when minimum doesn't exist and you must to search infimum that have the same rol that minimum in the sense that is the greatest lower bound of distances that can you compute.
Futhermore, supremum don't always exists because are many unbounded possible sets in some metric spaces, but infimum always exists because always we have that $d(x,y)\geq 0$.
Of course you only work with distance notion if you are in a metric space. In topologycal spaces this definition don't have sense.
A: In some cases, we could take the supremum--though not in every case, consider a line in the plane, in which we can find points as far from a given point off of the line as we care to--but even when we can, we'd generally prefer to look at the infimum. Again, it is probably useful to consider a line in the plane. When we wish to know how far a given point is from a given line, we find the point on the line that is the least far from the given point. Looking at arbitrary sets, we can't always deal with minima, and instead deal with infima.
For example, consider the point $(2,0)$ in the plane, and the set $A=\{(x,y):x^2+y^2<1\}$. In this case, $A$ has no point closest to $(2,0)$, but the infimum of the distances between the points of $A$ and $(2,0)$ is $1$.
As for why we do this, I know it comes in handy in many proofs. We can further generalize to distances between two given sets, which allows us to separate sets (of positive distance from each other) by disjoint open sets--which, again, is very useful in many proofs.
