We've now defined open sets and closed sets as subsets of metric spaces. Every point in an open set has a neighborhood of points that are also entirely within the open set. The neighborhood is defined relative to the space, so the neighborhood is a subset of the space. That neighborhood is then also a subset of the open set. There is no restriction on how big the neighborhood must be, but in order for the set to be open, every point in the set must have a neighborhood of some size that is a subset of the open set.
Every limit point of a closed set is a member of the closed set. A limit point of a set is a point such that every neighborhood of that point contains at least one point, other than the point itself, which is a member of the set. In general, a limit point of a set is not necessarily a member of the set itself. A closed set does not have to have any limit points, but if it does, all of the limit points must be members of the set.
"Open" and "closed" have an intuitive relationship which these definitions do not obviously have. Let's look at some examples to further clarify the relationship between open sets and closed sets.
Let's look at some metric space X. The set X is itself a subset of the space. It should be obvious that X is both open and closed according to the definitions. Since every point in the space is a member of X, every neighborhood of every point must be a subset of X, so X is open. Likewise, since every limit point of X (if it has any) is a member of X, X must be closed.
It's kind of weird to think of a set as both open and closed. There's one more important example. The null set, ∅, is a subset of every set. It has no points, which means that it is open. The definition of an open set doesn't require that there actually be any points in the set, just that every point that is in the set has a neighborhood in the set. Since the null set doesn't have any point, it doesn't have to have any neighborhoods. Likewise, since the null set has no points, it has no limit points. Any set with no limit points is closed. Therefore, the null set is both open and closed.
Whether a set is open or closed is dependent on both the set and the space. For example, consider the rational numbers as a set. If the space is the rational numbers, with the standard distance function d(p,q)=|p−q|, then the set is both open and closed. However, if the space is the real numbers, with the same distance function, then the set of rational numbers is neither open nor closed, as we've previously discussed. Every neighborhood of a rational number in the real space includes an irrational number, and every irrational number is a limit point of the rational numbers in the real space.
While we're here, we can introduce another definition. A set is dense in a space if every point in the space is either a member of the set or a limit point of the set (or both). The rational numbers are dense in the real space. (We may not actually use this definition much, but it shows a conceptual relationship between rational numbers and the real numbers.)
Let's look at another example in the real space. A segment is the set of real numbers such that a<x<b, for real numbers a and b where a<b. We can show that every segment is an open set in the space of real numbers. For any x in the segment, find x−a and b−x. Take the smaller of the two values, and call it r. Then a≤x−r<x<x+r≤b, so the neighborhood of x with radius r is a subset of the segment. Therefore, every x in the segment has a neighborhood in the segment, so the segment is an open set.
Since we've previously proved that every neighborhood is an open set, we also have a slightly more direct proof. Given a and b, find x=(a+b)/2 and r=(b−a)/2. Then the segment (a,b) is equal to the neighborhood of x with radius r, and since every neighborhood is an open set, the segment must be an open set.
We now have the fact that a segment is an open set in the space of real numbers. But what about the space of complex numbers (again, with the standard distance function)? Given a real number x and a radius r, there exists a real number y such that 0<y<r. Then the complex point x+iy is a member of the neighborhood of x with radius r. Since y≠0, x+iy is not a real number, and so isn't a member of the segment. Therefore, the segment is not an open set in the complex space. (Note that the segment is also not a closed set in the complex space, since a and b are both limit points of the segment and neither point is a member of the segment.)
Let's look at this in general terms. Suppose X is a metric space. Then suppose Y is some subset of X. Y is also a metric space with the same distance function as X. Finally, suppose E is an open subset of Y, or specifically that E is open relative to Y. Then E is not necessarily an open subset of X. In our specific case, X is the complex numbers, Y is the real numbers, and E is a real segment. We can say more about the relationships between X, Y, and E, but first we need to develop some more theory about intersections and unions of sets in metric spaces.