Closed and open sets were originally defined as sets with and without boundaries, respectively.  These concepts have since been generalized to abstract sets, known as topological spaces.  Let's step back and look at open and closed sets in the plane.  The square defined by 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1 contains its boundary and is closed.  The square defined by 0 < x < 1 and 0 < y < 1 does not contain its boundary and is open.  A square that has part of its boundary is neither open nor closed.

Closed Open

The complement of a closed square, i.e. the plane with a closed square removed, does not contain its boundary.  You can approach the missing square from north south east or west, but you never reach an edge, because the edge has been removed.  The complement of a closed set is open, and in the same way, the complement of an open set is closed.

It's hard to find a boundary for the entire plane, so let the plane be both open and closed.  Take the complement, and the empty set is open and closed.

The union of open sets is open.  Put together any collection of open squares in the plane, large and small, and there is no boundary anywhere, hence the union is open.  These squares are a base for the topology, but more often the base is defined as open disks. The definitions are equivalent.  Any open square can be covered with open disks, using smaller and smaller disks as you approach the edge of the square, and any open disk can be covered with open squares.

In one dimension, an interval is closed if it contains its endpoints, and open if it does not contain its endpoints.  An open set is the union of open intervals.  The open intervals are somewhat like one dimensional disks, building the topology for the line.  Stepping up to higher dimensions, an open set in space is the union of open balls in space.  This inspires the abstract definitions to follow, wherein almost anything can be given a topology.  The points of a group, or a ring, can be gathered together into open sets.  Even the prime ideals of a ring can be given a topology, reflecting the structure of the ring. A topology is a set of points, and a collection of subsets that are designated as open.  For instance, the points inside the unit circle form a subset of the plane that is designated as open.  The empty set and the entire set are open, and open sets remain open under finite intersection and arbitrary union.  Intersect two open sets and find another open set.  Take the union of lots of open sets and find another open set.

The complement of an open set is closed, and it follows that closed sets are closed under arbitrary intersection and finite union.  By inference, the entire set and the empty set are closed.

A given set S, sometimes called a space, can have many topologies, depending on how you define the open sets in S.  The minimum topology is S and the empty set.  This is the indiscrete topology.  The maximum topology declares every subset of S open, whence every subset of S is also closed.  This is the discrete topology.

A topology is stronger than another if it contains more open sets.  The discrete topology is stronger than all other topologies.  This establishes a partial ordering on topologies for a given set S.  If A is a stronger topology than B, is stronger than C, then A is stronger than C.

Let Q be a collection of topologies on S.  Define T as the intersection over all the topologies in Q.  In other words, a set is open in T iff it is open in each Qi.  Verify that T satisfies the criteria for a topology.  The union of open sets in T is open in T, and similarly for finite intersection.

If R is a collection of open sets in S, there is a minimum topology T containing R.  Intersect all the topologies that contain R.  There is at least one such topology, namely the discrete topology.

A neighborhood is another word for an open set.  A neighborhood about the point p is an open set containing p.  This term is used even in abstract settings, where a neighborhood may not be a tiny piece of real estate in the plane. The interior of a set X is the union of all open sets within X, and is necessarily open.

The closure of X is the intersection of all closed sets containing X, and is necessarily closed.  The closure contains X, contains the interior.

The boundary of X is its closure minus its interior.  Equivalently, the boundary is the intersection of closed sets containing X and closed sets whose complement is contained in X.  Thus the boundary of X is closed.

If you think of a blob in the plane, the interior is the blob with its edges or partial edges removed, the closure is the blob with its edges filled in, and the boundary is the perimeter.  However, there are some contrived spaces in which a boundary can contain an open set.

Let a space contain the real line and the points p and q, and let a set be open if its intersection with the line is open, and it contains both p and q or neither p nor q.  A set containing only p or only q can be neither open nor closed.  Let X be some interval union p, hence the boundary of X contains the set p∪q, which is open.

The boundary of an open set cannot contain an open set.  Let U be open and suppose Y, open, is in the boundary of U.  This puts Y in the closure of U, but the closure is the intersection of all closed sets containing U, including the complement of Y.

A limit point p of the set X has X intersecting every open set containing p.  This is inspired by a point in the plane that is on the edge of an open set.  Any open set containing p includes an open disk containing p, and that open disk must intersect X if p is on the edge of X.

Let C be X union its limit points.  Thus p, not in X, is in an open set Y missing X, and Y does not contain any limit points of X, thus Y misses C.  The complement of C is a union of open sets and is open, and C is closed.  If X has all its limit points it is closed.  Conversely, if X does not have a limit point p then the complement of X cannot be open, as that open set would contain p and miss X.  X is closed iff it contains its limit points.

The closure of X is no larger than C, as that is a closed set containing X.  If the closure of X misses a limit point p then p is outside a closed set containing X, and p is in an open set missing X, which is a contradiction.  The closure of X is X union its limit points.

The subspace T of a space S has the induced topology defined by intersecting all open sets in S with T and calling them open.  Restricting to T can only increase the number of open sets in T.  If S is the plane, and T is a closed square in the plane, and U is an open disk that overlaps the square, the half disk, with the square's edge, is open in the square, but not in the plane.  It represents a new open set in T.  Verify that this meets the criteria for a topology.

If U is open / closed in S, and U is wholly contained in T, then U is open / closed in T.

If U is closed in T is closed in S then U is closed in S.  Let W be the open set in S such that W∩T is open, with complement U in T.  Union W with the complement of T in S and build an open set in S whose complement is U.  Similarly, if U is open in T is open in S, U is open in S.  Let W∩T = U, where W is open, and intersect W and T to show U is open.

A set X is dense in a space S if it intersects every nonempty open set in S.

A space S is separable if it contains a countable dense set.

The reals are separable, since the rationals are dense in the reals, and the rationals are countable. Specifying every open set in a topology is often prohibitive.  Instead, we usually define a base, an initial collection of open sets, and let union do the rest.  The standard topology in the plane appears when the base consists of open disks of all radii, centered at all points.  (Actually it is sufficient to restrict the disks to rational radii and rational centers, since an arbitrary open disk is the union of open rational disks.)  Every open blob in the plane is now a union of these open disks.  In the same way, the standard topology for 3 dimensional space has a base of open balls, and so on.

If a collection of open sets forms a base for a valid topology, it should satisfy the "base criterion", as follows.

If X and Y are two base sets, and X and Y intersect in a point p, then X and Y both contain a base set Z, which contains p.

If the base criterion fails, then X∩Y cannot be a union of base sets, and is not open; yet it must be open, as it is the intersection of two open sets.  Thus the base criterion is necessary.  We will now show it is sufficient.  That is, the base sets generate a valid topology.

First intersect two base sets.  If there is a base set Z for every p in X∩Y, then X∩Y is the union of base sets, and is open, as it should be.

Next intersect finitely many base sets.  If p is contained in finitely many base sets, let X and Y be the first two, and replace X and Y with Z, a base set in X∩Y that contains p.  If the next base set is W, then find a base set in W and Z that contains p.  Continue this process until p is contained in a base set that is contained in the finite list of base sets.  The finite intersection of base sets is thus a union of base sets, and is open, as it should be.

The union of base sets is open, because that is the definition of the topology generated by the base.  The union of open sets is still the union of base sets, and is open.  We must show the finite intersection of open sets is open.  That is, the finite intersection of arbitrary unions of base sets is covered by base sets.

Let p be a point in the intersection of n open sets.  Now p is in the intersection of base sets B1 B2 B3 … Bn, one base set taken from each union of base sets.  There may be many ways to do this, many tuples of base sets drawn from our open sets such that the base sets intersect in p.  Each tuple gives a finite collection of base open sets with p in the intersection.  Surround p with a base set Z that is contained in the finite intersection of base sets.  This base set Z contains p, and is in the intersection.  Include every Z, for every n-tuple of base sets that contains p, for every p in the intersection of open sets.  (You could choose a particular Z in a particular tuple B1 B2 B3 … Bn if you don't mind the axiom of choice.)  The union of all these base sets Z is the intersection of our original open sets, hence the finite intersection of open sets is open, and the base generates a valid topology.

When each point is a base open set, the topology is discrete.  Every set is the union of base sets and is open.  In fact, no other base will do.  If the base doesn't have p as a base set, there's no way to build p as a union of base sets.

Given a space S, with its own topology, a set of points X embedded in S is discrete if each point in X is contained in an open set that contains none of the other points of X.  In other words, the subspace X acquires the discrete topology from S.  Every point in X is its own open set.  The integers are discrete in the reals, but the rationals are not.

In the cofinite topology, all finite sets are closed, along with the entire set (as required).  If the entire set is finite, the cofinite topology gives the discrete topology.

One can define base locally, at a given point.  A collection of base open sets is a base at p if every open set containing p contains one of these base sets, which contains p.  You don't need the entire base for the topology, and you may not even need all the base sets that contain p.

B is a base for a given topology iff it includes a base at p for every point p.  Given the former, place p in an arbitrary open set W, which is the union of base sets, hence p is contained in a base open set inside W.  Conversely, if every p has a base, cover W with base open sets containing the points of W, and contained in W, and W becomes the union of base open sets, as is required by a base.  If p is in the intersection of base open sets, p is contained in a base open set that is contained in the intersection, and that takes care of the base criterion. If a space S has a base B, and every point p has a countable base drawn from B, then the base B is first countable.  This does not mean there are countably many base sets containing p.  Let B be all open disks in the plane, and p is the center of uncountably many disks, yet the disks with rational radii form a local base at p.  Thus B is first countable.  Of course, if B is countable, e.g. disks with rational centers and radii, then B is automatically first countable.

A topology is first countable if it has a first countable base.

A base is second countable if it contains a countable number of base open sets.  A topology is second countable if it has a second countable base.  As illustrated by the plane, n dimensional space is first and second countable, using balls with rational centers and radii.

The reals with half intervals [a,b) acting as the base is first countable, but not second countable.  Given p, choose [p,p+s) for s rational.  Every half interval containing p contains one of these base sets, which contains p.  The base is first countable.  However, the entire base is not countable, thus not second countable.

Perhaps we just selected a bad base.  Perhaps some other base would be countable, and would make the space second countable.  Let B be a collection of open sets from this topology that forms a base.  Each set X in B is the union of disjoint half intervals.  In fact X includes a countable number of disjoint half intervals.  Let s(X) be the start set of X, the left end points of its half intervals.  Consider all the start sets over every X in B.  The result is a countable set of points along the real line.  Let p be a point that is not in this set, and [p,p+1) is not the union of base sets.  Thus the topology itself is first countable, but not second countable. Let S be a partially ordered set.  As you recall, two elements x and y are comparable if x < y or y < x, realizing that both cannot occur simultaneously.  Every pair of comparable elements defines a base set, namely those elements z that are strictly between x and y.  These define the order topology.

Unfortunately this may not satisfy the base criterion.  Imagine a set that looks like the capital letter V with p at the base and a point q below.  Given x and y in V, x < y if x is lower than y on the same branch of V.  Note that q is less than all the points in V.  Use q and the two points at the top of V to define two chains, two base open sets, whose only intersection is p, at the base of V.  There is no chain, no base set, that contains only p.  This violates the base criterion; we don't have a valid topology.  In general, you will need to verify the base criterion when you establish an order topology.

If a set is linearly ordered, i.e. all points in a line, the order topology is valid.  The intersection of two chains is bounded below by the larger of the two lower bounds, and above by the smaller of the two upper bounds, hence the intersection is empty or it is another base set.

If there is no least element in the line, then all the points below x form an open set, the union of chains with x at the top.  If there is a least element, then for any x, the ray below x is brought in as a base open set, as though there was a point q below the set.  Similarly, the ray above x is brought in if need be.  Each ray above and below x is open, and every point in a linear topology is closed.

We've seen the linear topology before, in the real numbers of course, but also in the cantor set.  You may want to look at that example again. Hausdorff developed criteria that describe the "connectedness" of a topology.  These criteria are sometimes called the separation axioms, although this is a misnomer.  These aren't axioms, they're definitions.

A space is T0, or half Hausdorff, if every pair of points implies an open set containing one and not the other.

If two points x and y violate T0, then the topology cannot distinguish between them.  Every open set contains both or neither.  Assume y and z are also inseparable.  Let x live in an open set O that does not contain z.  If y is not in O then x and y are separable, and if y is in O then y and z are separable.  Therefore x and z are inseparable, and the relation is transitive.  Merge each group of inseparable points into one point.  This does not change the topology at all.  Thus every space can be crunched down to a space that is half Hausdorff.

A space is T1 if every pair of points x and y has an open set containing x but not y, and an open set containing y but not x.  Clearly T1 implies T0.

An equivalent criterion says every point is closed.  Given a point p, cover each point in the complement of p with an open set disjoint from p.

Let a space consist of two points, x and y, with open sets (), (y), and (xy).  This space is T0, but not T1.

A space is T2, or Hausdorff, if any two points can be contained in two disjoint open sets.  Clearly T2 implies T1.  Thus the points of a Hausdorff space are closed.

Consider the "line with two origins".  This is a real line, e.g. the x axis, but there are two origins.  Open intervals are base sets as usual, but if the interval brackets 0, it can contain one or both origins.  Verify the base criterion for these intervals; the topology is valid.  Now, either origin can be placed in an open set apart from the other, yet the origins cannot be separated in two disjoint open sets.  The space is T1, but not T2.

A space is T3, or regular, if it is T1, and any closed set and a point not in this set can be contained in two disjoint open sets.  Since points are closed by T1, T3 implies T2.

A space is T4, or normal, if it is T1, and any two disjoint closed sets can be housed in disjoint open sets.  Since points are closed by T1, T4 implies T3.

We're getting ahead of ourselves, but let's say you know what a metric space is.  If not, just think of the plane.  Let G and H be disjoint closed sets in a metric space, like two closed shapes in the plane.  Consider any point p in the space.  The distance from p to G is the greatest lower bound of the distances from p to all the points in G.  Since G is closed, p is in G iff its distance to G is 0.  In other words, G can't approach p, and come arbitrarily close to p, unless p is a limit point, and then p is part of G.

Now p also has a distance to H.  Both distances cannot be 0, else G and H intersect in p.  Assume p is closer to G, by a difference of δ.  The points in the ball, centered at p, with radius δ/2, are all closer to G than to H.  This is an open set.  The set of points that are closer to G than to H is covered by open sets, and is open.  This set also contains G.  Similarly, the set of points closer to H than to G is open, and contains H.  These to open sets are disjoint, hence G and H are separated.  Every metric space is normal.

Urysohn developed an equivalent criterion for a normal space.  A Hausdorff space S is normal iff, for every nonempty closed set E and every open set O containing E, there is some intermediate open set U such that O contains closure(U) contains U contains E.

Assume S is normal.  If O is the entire space S, then set U = O.  Otherwise let F be the complement of O and separate E and F in open sets U and V respectively.  Now the closure of U is the intersection of all closed sets containing U, including the complement of V.  Thus the closure of U is contained in the complement of V, which is contained in O.

Conversely, assume S is hausdorff, and has the intermediate open set property, and Let E and F be nonempty disjoint closed sets.  Let O be the complement of F and let U be the intermediate open set whose closure is contained in O.  Let C be the closure of U, a closed set that is disjoint from F.  Let V be the complement of C.  The open sets U and V separate E and F, and S is normal.


One can use Urysohn's lemma to build a continuous function on S that is 0 on E and 1 on F.  Assume S is normal, and let E and F be any nonempty closed disjoint sets in S.  Let O be the complement of F.  Choose any intermediate open set and call it U.  Then choose intermediate open sets U between E and U, and U between the closure of U and O.  Repeat this process until we have Uq for every rational q with a terminating binary expansion in (0,1).

Let U0 = E, and let U1 = S.

Build a map from the space S into the closed interval [0,1] as follows.  For any point x in S, let g(x) be the greatest lower bound of all the rationals q such that x is in Uq.  Note that g(E) = 0 and g(F) = 1.

Show that g() is a continuous function.  That is, the preimage of every open interval in [0,1] is an open set in S.  Given an open interval I in [0,1], choose any z in I, and rational numbers 0 ≤ b ≤ z ≤ c ≤ 1 where b and c lie in I, and have terminating binary expansions.  Every point in Uc has image at most c.  Every point outside the closure of Ub has image at least b.  The open set Uc-closure(Ub), rather like an annulus, has image inside I.  Furthermore, every x with g(x) = z lives in this annulus.  This applies to every point z in I.  Therefore the preimage of I is covered by open sets in S, and is open.

A Hausdorff space S is normal iff, for every pair of disjoint nonempty closed sets E and F, there is a continuous map g(S) into [0,1] such that g(E) = 0 and g(F) = 1.  We already proved normal implies g(x).  Conversely, given g(x), let U be the preimage of the points below and V the preimage of the points above .  This gives separation, and combined with Hausdorff, S is normal.

A hausdorff space S is completely regular if, for every closed set E and every point x not in E, there is a continuous real valued function that is 0 on E and 1 on x.  Each normal space is completely regular by Urysohn's lemma, as shown above.  And any completely regular space is regular.  Take the preimages of [0,) and (,1] to separate E and x.  Thus completely regular is sometimes referred to as T3.5. Let S be normal, and A a closed subset of S.  If f(A) into R1 is continuous, then there is g(S) into R1, continuous, with g(A) = f(A).  In other words, g is an extension of f across all of S.  This is Tietze's extension theorem.

First assume f is bounded.  Adjust the range, so that f(A) fits within (-1,1).

Let B be the set of all x in A with f(x) ≤ -1/3, and let C be the set of all x in A with f(x) ≥ 1/3.  Since B and C are closed in A, and A is closed, B and C are closed in S.  Using Urysohn's lemma, there is a continuous function h1 that is -1/3 on B and 1/3 on C.  If you review the construction of this function, you'll note that h1 attains its minimum on B, and its maximum on C.  Thus -1/3 ≤ h1(S) ≤ 1/3. In other words, h1 is bounded, in absolute value, by 1/3.

Select an x in A, and it is in B, on its way from B to C, or in C.  In each case |f(x) - h1(x)| < 2/3.  Call this difference e1.  Think of e1 as an error function, as h1 approximates f on A: f = h1 + e1.  Recall that h1 was bounded by1/3; e1 is bounded by 2/3.

Apply the above procedure, substituting e1 for f.  This time the image of B is bounded above by -2/9, and the image of C is bounded below by 2/9.  This gives a function h2 with h2(S) trapped between -2/9 and 2/9.  Let e2 = e1 - h2, and |e2| < 4/9.  This is the next approximation of f on A: f = h1 + h2 + e2.

Build h3, differing from e2 by an error function e3 that is bounded by 8/27.  Repeat this process, building an infinite sequence of functions hi and ei.

Let g(x) be the infinite sum over hi(x).  Since hi is bounded by a geometric series, g(x) is well defined.  Also, each hi is continuous.  Use the weierstrass m test to show that convergence is uniform, whence g(S) is continuous.  If you haven't seen the m test before, it's not hard.  Let g(x) = y, and restrict to an open interval of width ε about y.  Remember that the functions hi are bounded by the powers of 2/3, and their sum is bounded by the corresponding geometric series.  Choose m so that the sum of the powers of 2/3, beyond m, is less than ε/2.  Let tm be the sum of h1 through hm.  Now tm is within ε/2 of g, across all of S.  Choose an open set U in S such that tm(U) is within ε/2 of tm(x).  Put this all together and g(U) is within ε of g(x).  Thus g is continuous on S.

The error functions ei approach 0, at least on A, hence g(a) = f(a), and g is a continuous extension of f.

With |h1| ≤ 1/3, and |h2| ≤ 2/9, and |h3| ≤ 4/27, and so on, evaluate the geometric sum and show that |g| ≤ 1.  The bound of g is the bound of f with the endpoints brought in.  Let Z be the preimage of ±1 in S.  Z and A are disjoint closed sets, and can be separated in disjoint open sets.  The topology of Z union A, as a closed set in S, is the topology of Z, and the topology of A, as separate spaces.  Define a new function f′ that agrees with f on A, and is equal to 0 on Z.  Extend this to a function g′ across all of S.  This may also have points that map to 1 or -1, but they will not belong to A or Z.  Take the average of g and g′.  This is continuous, and agrees with f, and its image lies in (0,1).

Now generalize the theorem to an unbounded function f.  Set d = atan(f) over (π/2), so that |d| < 1.  Extend d to a function k across all of S as shown above.  Remember that k is still bounded by, and never equal to, 1.  Let g = tan(kπ/2).  Note that g is continuous, and agrees with f on A.  That completes the proof.

If A is an open set the theorem fails.  Let S be the real line and let A be the complement of 0.  Let f(x) = sin(1/x).  The image is bounded, and f is continuous, but f cannot be extended to x = 0. Let s be a sequence of points in a topological space.  The limit point p of the sequence s is quite different from the limit point of the set s.  As you recall, p is a limit point of the set s if s intersects every open set containing p.  When s is viewed as a sequence, p is the limit of s if every open set containing p contains almost all of s.  In other words, every open set containing p implies an index n, such that the open set contains sj whenever j ≥ n.

It is equivalent to make the same statement about the base open sets containing p, or the base open sets assigned to p as a local base.  After all, every open set contains one of these base sets. The point p is a cluster point of s if every base open set containing p contains infinitely many points of s.  Here s may be viewed as a set or a sequence; there is no difference.

A limit point of the sequence s is a cluster point of s.  And a cluster point of s is a limit point of the set s.

Let t be a subsequence of s.  If p is a limit point of s, then p is a limit point of t.  If p is a limit point or a cluster point of t, then p is a cluster point of s.

If the space is Hausdorff, the limit of the sequence s is unique.  If p and q are both limits, separate them in open sets, place all of s beyond sn in the open set containing p, and the open set containing q cannot contain anything beyond sn.

In contrast, consider the line with two origins, which is not hausdorff.  Both p and q are limits of the reciprocal sequence sn = 1/n.

Let p be a limit point of the set R in a first countable space.  Enumerate the base open sets assigned to p, and select s1 in O1, s2 in O1∩O2, sn in the intersection of the first n open sets, and so on.  Of course each point in the sequence s is taken from R, which we can do, since p is a limit point of the set R.  Now every open set containing p contains some On, and the entire sequence beyond sn.  Thus the set R, with limit point p, includes a sequence s whose limit is p.

If the set R takes the form of a sequence, this transformation need not produce a subsequence.  Let R3 = p and let all the other points of R be far away from p.  Yes, p is a limit of the set R, in fact it is contained in R, and the new sequence s is constant at p, yet s is not a subsequence of R.  However, if p is a cluster point of the sequence R there is a convergent subsequence.  Reconstruct s as above.  When O is the intersection of the first n base open sets, there are infinitely many terms of R to choose from.  Select one that is beyond the last one chosen, thus building a convergent subsequence.

In summary, the following holds in a first countable space.

It takes some work to find a cluster point with no converging subsequence, but it's worth it.  Start with the positive integers and let a set be open if the number of integers in the set below n divided by n approaches 1.  It is easy to show the union of open sets is open.  The number of integers below n can only increase.  Finite intersection is trickier, but not too bad.  If n is large enough so that two sets include 99% of the numbers below n, their intersection contains at least 98% of the numbers below n.  Apply this reasoning for 1-ε and indeed the finite intersection is another open set.

Add 0 to the space and to each nonempty open set.  The topology is still valid.

Let s be the sequence of positive integers.  That is, sn = n.  The point 0 is in every open set that intersects s; in fact 0 is in every nonempty open set.  Thus 0 is a limit of the sequence s, and of the set s.

View s as a set, and let O be an open set containing 0.  Clearly O is not finite, hence it contains infinitely many points of s.  Thus 0 is a cluster point of s.

Suppose there is a convergent subsequence t taken from the set s.  We will build an open set that excludes infinitely many terms of t.  Thus 0 cannot be a limit of the sequence t.

If t has finitely many distinct integers, let an open set be the complement of t.  This excludes all of t.  Otherwise throw in the integers 1 through 100, and then all subsequent integers until you reach something in t.  Leave this integer out.  Then throw in the next thousand integers, and all subsequent integers, until you reach another term in t, which we will leave out.  Do this for ten thousand, 100 thousand, a million, and so on.  The result is an open set that omits infinitely many terms of t.  0 is not the limit of t.  s has a cluster point of 0, but 0 is not the limit of any sequence drawn from s. This is inspired from continuous functions on real variables, but the definition is generalized to arbitrary topological spaces, where distances of δ and ε are not even well defined.  Step back and look at a continuous function from the plane into the line, i.e. f maps R2 into R1.  This can still be graphed, and visualized, in three dimensions.  For instance, f might be the surface z = xy.  This is continuous by the δ ε definition.  At any point z = xy, and for any interval of width ε about z, there is an open disk of radius δ about the point (x,y), such that points within this circle map to points within ε of z.  (This is the assertion that multiplication is continuous.)  If you step back and think about open sets, the interval of width ε is a base open set in R1, and z, in this interval, is in the image of an open disk in the xy plane that maps entirely into this interval.  At the same time, v could be any other point in this interval, any other point strictly between z-ε and z+ε, and there will be a possibly smaller disk in the xy plane whose image is entirely inside the interval and contains v.  Put all these images together and the preimage of the interval is an open set in the plane.  Intervals are base sets, so combine intervals together, and the preimage of any open set in R1 is open in the plane.  The preimage of an open set is open.

Conversely, assume the preimage of an open set is open.  Build an open interval about z of width ε and take its preimage.  This is open in the plane, hence some base open set lives in the preimage and contains (x,y).  This is a disk of radius δ.  The definitions are equivalent.

As indicated above, we have found an abstract definition of continuity that is backward compatible with the definition in real space.  Let f be a function from the space S into the space T.  Note that the image of f could be a subspace of T.  Let p be a point in S and let q = f(p) be a point in T.  f is continuous at p if every open set containing q has a preimage in S that contains an open set in S, that contains p.  The entire preimage may or may not be open.

If f is continuous at every point then f is continuous.

Assume f is continuous and fix any open set in T, and let p be any point in the preimage, with q = f(p).  Now q has an open set around it, hence the preimage includes an open set about p.  The entire preimage is covered by open sets, and is open.  Thus we have an equivalent definition; f is continuous if the preimage of every open set in T is open in S.

The identity function is continuous.

Yet another definition is couched in terms of closed sets; f is continuous if the preimage of every closed set in T is closed in S.

Restrict the function to a subspace of S and it remains continuous, since the restriction can only create more open sets in the domain.

An open set in g(f()) pulls back to an open set in f(), which pulls back to an open set in the domain.  The composition of continuous functions is continuous.  Also, g(f()) is continuous at p if f is continuous at p and g is continuous at f(p).



Let R be a set in S, with p as its limit or cluster point.  Assume f is continuous at p.  Every open set about q pulls back to include an open set about p, which contains a point, or infinitely many points, from R.  These points map forward into the open set about q.  Thus the image of a limit or cluster point is the limit or cluster point of the image.  As a corollary, the image of the closure of R is contained in the closure of the image of R. A collection of sets in a space S is locally finite if every point x in S is contained in an open set that intersects a finite number of these sets.  In other words, sets do not pile up at any one point.

The arbitrary union of closed sets need not be closed, but if those closed sets are locally finite, the union is indeed closed.  Prove this by covering the complement with open sets.

Let U be the union of a locally finite collection of closed sets.  Let x be any point not in U and let Q be an open set that intersects T1 T2T3 … Tn, a finite subcollection of closed sets.  Let Wi be the intersection of Q with the complement of Ti.  Now each Wi is open.  Their intersection is also open, contained in Q, disjoint from U, and containing x.  Thus x is in an open set apart from U.  This holds for all x outside of U, so U is closed. Let a collection of open sets cover the domain of a function f, and assume f is continuous on each open set.  Let R be open in the range and let Q be the preimage.  Let W be an open set in the cover and let V = W∩Q.  Since f is continuous on W, V is open in W.  And W is open in the domain, hence V is open in the domain.  There is a V for each W in the cover, and their union gives Q.  Hence the preimage of R is open and f is continuous.

If the domain is covered by closed sets, and the cover is locally finite, then f is again continuous.  The preimage of a closed set is divided into chunks, a closed piece V for each W in the cover.  Each x has an open set intersecting finitely many sets from Wi, and finitely many sets from Vi.  The collection V[i] is locally finite, and its union is closed.  The preimage of a closed set is closed, and f is continuous. Two spaces are isomorphic if a 1-1 function maps one space onto the other, and preserves the topology.  In other words, a set is open in one space iff its counterpart is open in the other.  Since the preimage of open sets is open, in both directions, the function is continuous, and its inverse is continuous.  Such a function is called bicontinuous.

Now for the confusing part.  Instead of calling the spaces isomorphic, as we do with groups, rings, fields, and modules, the spaces are called homeomorphic, and the function is called a homeomorphism.

If S is homeomorphic to T is homeomorphic to U, then S is homeomorphic to U.  Simply compose the two functions.  Thus homeomorphic spaces form equivalence classes in the universe of topological spaces.  In fact, a homeomorphism is an equivalence in the category of spaces and continuous functions.

Let's consider an example.  The punctured sphere is the same space as the plane.  Pull the sphere apart and lay it flat, and spread it out to infinity.  If you want to be analytic, do the following.  Place a sphere on the xy plane, its south pole at the origin.  Delete the north pole; that's the point that is missing.  Now draw a ray from the north pole to any point in the xy plane.  The ray intersects the sphere in exactly one point.  This is the 1-1 map equating the punctured sphere and the plane, and if you write it as a formula, it is an algebraic expression employing trig functions, and is bicontinuous, hence it is a homeomorphism.

In another example, center the sphere at the origin and remove the north and south poles.  Enclose the sphere in an infinite cylinder, the points that are 1 unit away from the z axis.  Draw rays from the origin to the cylinder.  These rays map the cylinder onto the sphere, and vice versa.  The map is bicontinuous, and the spaces are homeomorphic. Think of topological spaces as a category, with continuous functions as morphisms.  What is the product space in this category?  This is more complicated than it has a right to be, so let's begin with the finite case.

Given a finite collection of topological spaces, let P be their cross product.  The best example is R1 cross R1 cross R1 to build R3.  In other words, take the real line cross the real line cross the real line and get 3 space, with the usual assortment of boundaryless open sets.

Let Ci be a finite collection of component spaces and build P, the product space, as follows.  As a set, P is the cross product of all the component sets Ci.  For instance, a point in 3 space is given by 3 coordinates, where each coordinate specifies a point in one of the three component spaces.  This is what we mean by cross product: a point in x and a point in y and a point in z gives a unique point in the product space.

If S is a set in the product space, the projection onto the ith component is the set of points from Ci that are present in S.  The projection of a sphere in 3 space into any of the coordinate axes gives a line segment whose length is the diameter of the sphere.  Or, think of 3 space as the topological product of the xy plane and the z axis.  Now the projection of the sphere into the xy plane is a disk bounded by the equator of the sphere.  In most applications, the projection keeps one or two coordinates and throws the others away.

The topology of P is defined by a base, where a base set in P is given by the cross product of open sets in the component spaces.  For instance, cross the open unit intervals in x y and z to get the interior of the unit cube in 3 space, which is an open set.

If the component topologies are defined by bases, you can use those base sets.  You don't have to cross every open set with every other open set to build a base for P, it is enough to cross base open sets.  To see this, let S be the cross product of arbitrary open sets in the component spaces.  Replace each open set with a union of base sets.  Take any of the base sets in the first open set, cross with a base set from the second open set, cross with a base set from the third open set, and so on.  Call this set Q.  But there are many such sets; all the ways you can select a base set from each of the open sets.  Each of these sets Qj is open by definition, and their union gives the cross product of the original open sets.  Thus S is open.

We still need to show the base is valid.  Let z be a point in the intersection of two base open sets in P.  Project z onto each component, giving the points z1 z2 z3 … in the component spaces C1 C2 C3 etc.  Project the two open sets onto the first component and find two base open sets in C1, both containing z1.  Since this is a base, there is a third open set Q1 containing z1, and inside both open sets.  Find Q2 Q3 … similarly and take their cross product, giving Q.  Now Q is a base open set in P that contains z, and is entirely inside both of the original open sets.  Therefore the topology is valid.

In the plane, two open rectangles that intersect in z intersect in an open rectangle that contains z.

Recall that open sets in the real line are based on open intervals at arbitrary locations and having arbitrary lengths.  (You can use rational end points if you want a second countable base.)  Cross intervals with intervals with intervals to build a base for the product topology of 3 space.  In other words, the topology of R3 is based on open boxes at arbitrary locations and with arbitrary dimensions.  I know, we usually base our open sets on balls at arbitrary centers and having arbitrary radii, but these different bases, balls or boxes, produce the same topology.  An open box can be covered with open balls, and an open ball can be covered with open boxes.  The open sets are the same.

If S is open in P it is the union of base sets, each having open projections in the component spaces.  Thus the projection of an open set onto any component is open.  However, the converse is not true.  The annulus 1 ≤ r < 2 has open projections on the x and y axes, yet it is not an open set in the plane. 

Projection onto any component is a continuous function.  Cross an open set in the projected dimension with the entire space in each of the remaining dimensions to find the preimage, which, being the cross product of open sets, is open in the product space.  This makes the function continuous, and since the projection of an open set is open, projection is bicontinuous.

If product is a binary operator on topological spaces, verify that product is commutative and associative.  No matter how we put the spaces together, the base is still the cross product of base open sets in the component spaces.

That wasn't too painful, but let's assume there are infinitely many component spaces Ci.  The product, as a set, is an infinite cross product.  This is called a direct product, and assuming the axiom of choice, as I do in this book, each point in the direct product looks like an infinite sequence of points from the component spaces Ci.

There are two possible topologies for the product space P, strong and weak.  The strong topology is defined as above: a base set in P is the cross product of base sets in the component spaces.  The earlier proof shows this is a valid base.  In the weak topology however, each base set in P is built from component base sets as before, but only finitely many of these base sets are used.  The other components are not constrained.  Looking at R, we might select open intervals from components 1, 3, and 7.  All the other components are taken in their entirety.  Let Q be the resulting cross product, where three coordinates are restricted to open intervals and the other coordinates are unconstrained.  This is a base open set in the weak topology.  Once again, verify that the base for the weak topology is valid.  Intersect base sets per component as usual, and finitely many components exhibit proper base open sets.

The weak and strong topologies are the same when finitely many spaces are involved.

The weak topology produces the product in the category of spaces.  Here's the idea, without all the category theory.

Let P be R, as described earlier.  Map R1 into P by setting f(x) = x,x,x,x,x… and so on through all the components.  Compose f with any projection and get a continuous function, in fact the identity map.  But is f continuous into P?  Let Ni be the open neighborhood in the ith component, centered at 0 with radius 1/i.  In the strong topology, the direct product of these neighborhoods is an open set containing the origin.  Yet the preimage is the origin, which is closed, hence f is not continuous.  With the weak topology, the product function is continuous iff the component functions are all continuous.  Let's prove this now.

Let S be a base open set in P with preimage W.  A point z is in W iff the image of z is in S, iff each component function maps z into the projection of S, iff z is in the preimage of each projection.  With the weak topology, there are finitely many projections to consider.  When the preimages of the projections are open sets, their intersection is open, hence W is open.  When the component functions are continuous, so is the product function.

Conversely, assume f is continuous, and compose this with projection, which is also continuous.  This function is the same as the function that maps the domain directly into the component space.  Therefore f is continuous iff each component function is continuous.

The weak topology also offers advantages when dealing with convergent sequences.  If z is the limit of a sequence s in the product space P, let zi be the ith component of z in Ci, and let si be the projection of the sequence s in Ci.  Select a base open set in Ci that contains zi and cross with all the other components to get an open set in P that contains z.  This contains most of s, i.e. all the terms of s after some index n, and the same holds in the space Ci.  Thus the limit of the projected sequence is the projection of the limit.

Conversely, let zi be the limit of the component sequence si, for each component space Ci in the product.  Given a base open set about z, find the base open set Qi containing zi in the space Ci.  Now Qi contains the entire sequence beyond some index ni.  Since there are finitely many components to consider, finitely many base open sets Qi building the open set about z, there are finitely many indexes ni, and we can set n to the largest of these.  Now everything in s, beyond n, lies in the open set about z, and s converges to z.  A sequence converges in P iff it converges per component.

Unless otherwise stated, a product space has the weak topology.

The direct product of j copies of a space S is written Sj, and depends only on the cardinality of j.  Thus the notation Rn, for the product of n copies of the real line with the implied topology.  Similarly, R is the product of infinitely many copies of the real line.

Here is a simple application of the product topology.  Let S be a space and let P be the product space S cross S.  Let D, a subset of P, consist of the points x,x for all x in S.  This is the diagonal set.

If the complement of D is open, select any point q,r not in D, pick any base open set in the complement that contains q,r, take the projections in S and S, and find disjoint open sets in S separating q and r.  Conversely, if q and r can always be so separated, the complement of D is covered by open sets and is open.  The diagonal map in S cross S is closed iff S is Hausdorff.

The cross product of two open sets is open in the product topology, as this is the union of the cross product of various base open sets, but the cross product of closed sets is also closed.  Take the union of everything cross O2, and O1 cross everything; this is open and its complement is C1 cross C2.  This can be generalized to a finite product of topological spaces.

Let P be the product of indiscrete spaces.  Each component of a base open set is everything or nothing.  The result is everything or nothing, and P is indiscrete.

Let P be the finite product of discrete spaces.  Every point in every component is open, every point in the cross product is open, and P is discrete.  This is not the case for an infinite product, since we can't combine an infinite number of open sets together to make an open set. The coproduct of spaces is their disjoint union, where a set is open iff its intersection with each subspace is open.  If each component space has a base, put all these base sets together to form a base for the coproduct topology.

Yes, this is a coproduct in category theory.  A continuous function from the coproduct C into any other space R defines, and is defined by, continuous functions from the component spaces into the range R.

The coproduct of discrete spaces is discrete.  Every subset of C is a union of subsets of the component spaces, and is open. Let Ci be an infinite collection of topological spaces and let P be the product space, as described in the previous section.  Assume each component space has a designated point, which I will call 0.  Let the set S be the direct sum of the component spaces.  Every point in S has coordinates taken from Ci, such that finitely many coordinates are nonzero.  The rest of the coordinates are all set to zero.

If there are finitely many component spaces, the direct sum and the direct product are the same.  That's not very interesting, so assume there are infinitely many component spaces.  Furthermore, assume each Ci has at least two points, else Ci contributes 0 every time, and doesn't really change P or S.

Note that S is a subset of P, so declare it a subspace and give it the subspace topology from P.  A base open set in P restricts finitely many components to open sets and leaves the remaining components unconstrained.  If z is any point in this open set, set most of its components to zero to get a point y in S.  Thus S intersects every open set, and is dense in P.  The base of P establishes the base of S.

If S wholly contains a base open set from P then S contains some point z in this open set, such that z is nonzero on all the unconstrained coordinates.  Yet the points of S are zero almost everywhere, hence S cannot contain a base open set from P.  Therefore S is not open in P.  Since S is dense in P, it is not closed in P either. A set is connected if it cannot be partitioned into two nonempty subsets that are enclosed in disjoint open sets.  Applying this definition to the entire space, the space is connected if it cannot be partitioned into two open sets.  Equivalently, the only sets that are both open and closed are the entire space and the empty set.

If T is the image of S through a continuous function f, and two open sets separate two pieces of T, pull these back to find two open sets that separate S.  If T is disconnected then so is S.  Turn this around, and the continuous image of a connected set is connected.  A continuous function may blend components together, but it can't pull them apart.

Consider the closed unit interval from 0 to 1.  Let this be the entire space, or embed it in n dimensional space if you prefer.  If it is not connected then partition it into sets S and T.  Assume, without loss of generality, that T contains 1.  Let u be the upper bound of S.  Now u is in S or in T.  Suppose u is in S.  Every open set containing S contains some of T, and S and T cannot be housed in disjoint open sets.  Similar trouble arises if u is in T, hence the unit interval is connected. A path is the image of the closed interval [0,1] under a continuous function.  Since the unit interval is connected, every path is connected.

If h is a path's function, the path connects x and y if h(0) = x and h(1) = y.  x is connected to itself by the trivial path.  Reverse the path to show path connectivity is symmetric.  Put two paths together, as the image of [0,] and the image of [,1], to show path connectivity is transitive.  That is, x connects to y and y connects to z then x connects to z.  This is an equivalence relation.  All the points in a path connected component can be connected to each other.  A set, or space, is path connected if it consists of one path connected component.

The continuous image of a path is another path; just compose the functions.  The image of a path connected component is another path connected component.  A continuous function may blend path components together, but it cannot pull them apart.

If two spaces are homeomorphic, connected components, or path connected components, correspond 1 for 1.  The number of components and path components is a topological invariant.  Two disjoint spheres cannot be homeomorphic to one sphere.  This is the beginning of a parade of topological invariants, used to show various spaces cannot be homeomorphic.

Let C be a path connected component and suppose it is not connected.  Separate C into two disjoint open sets and draw a path from a point in one set to a point in the other.  Our path is now separated into two open sets.  This contradicts the fact that every path is connected.  Therefore path connected implies connected.

The converse is not true.  Consider the curve sin(1/x) for x > 0, union the origin.  This is called the topologist's sine curve.  Try to disconnect this set into two pieces A and B, where A houses the origin.  Let t be the lower bound of the x coordinates of the points in B.  If t is positive, look at t,f(t) on the curve.  Every open ball about this point includes points from A and B, so if t,f(t) belongs to either A or B, that set is not open.  This is a contradiction, hence t = 0.  B includes x coordinates arbitrarily close to 0.  Now A is open, so A includes a positive x coordinate.  Let A include the x coordinate t, while B includes the x coordinate s, with s < t.  Now A and B disconnect the curve from s to t, which is a path.  A path cannot be disconnected, hence this set is connected.

Next suppose the set is path connected, hence there is a path from the origin to the point 1,sin(1) contained within the curve.  Let f be the continuous function that implements the path, with f(0) = 0.  Let t be the lower bound of the values of x for which f(x) is not 0.  Everything below t maps to 0, and by continuity f(t) equals 0.  The path just sits at the origin for a while, then moves on.  We may as well remove the segment from 0 to t.  Reparameterize the path so that f(x) is nonzero for values of x arbitrarily close to 0.

Remember that f is continuous at 0.  Use the δ ε definition of continuity, with ε set to .  Thus an open interval (0,δ) maps to a portion of the curve whose y coordinate is never more than .  The image is restricted to one arc of the sine curve.  This arc stands apart from the origin.  Now f maps the closed interval [0,δ] to the origin and this arc.  f disconnects a closed interval, which is a contradiction.  The set is connected but not path connected.

You can also join sin(1/x) with the y axis from -1 to 1, or the entire y axis.

This is faairly intuitive: connecting connected sets produces a connected set.  Let an arbitrary number of connected sets share a common point x.  Let U be the union of these sets.  Separate U into O1 and O2 and assume x is in O1.  Each connected set lies entirely in O1, else it would be separated.  Therefore all of U lies in O1, and U is connected.  A similar result holds for path connected sets.  Draw a path from any point w in any set, to x, and on to any point y in any set. Assume S is a connected set, and a larger set T is trapped between S and the closure of S.  Try to split T into T1 and T2, contained in disjoint open sets O1 and O2.  Intersect with S and find S1 and S2 in O1 and O2.  This is a contradiction, assuming S1 and S2 are nonempty.  If all of S is in O1, then the complement of O2 contains the closure of S, and none of T is in O2.  We did not split T after all.  Everything between a connected set and its closure, including its closure, is connected.  The open disk in the plane is connected, and so is the closed disk, and the open disk union any portion of its boundary.

The closure of a path connected set may not be path connected, as shown by sin(1/x) for x in (0,1]. A set S in a space T is locally connected if, for every point x in S, and every open set U containing x, there is an open set Q ⊆U containing x such that Q is connected.  Note that Q∩S is actually the connected set, that is, Q is an open set in the subspace S, and is connected.  Of course, if Q could be separated by open sets in T, intersect these sets with S and Q could be separated inside S, hence Q is connected from the get-go.

A similar definition exists for locally path connected.  Every x,U has its open neighborhood Q in U such that Q is path connected.

If a space has two connected components, it is locally connected but not connected.

With some imagination, you can build a connected space that is not locally connected.  Let x be the troublesome point.  An open set containing x is disconnected, and x is in one of the two open components.  This too is disconnected, and x is in one of the open components, and so on.  We're going to need a descending chain of open sets.  Let U1 U2 U3 etc be such a chain, intersecting in the point x.  Each Ui is both open and closed.  Now include a connecting point c.  The only open set containing c is the entire space.  Thus the space is connected, even though it is not locally connected at x.

A variation of the above builds a path connected space that is not locally path connected.  Each Ui - Ui+1 is a separate open interval in [0,1), and c is a point in the plane below the real line.  Draw a path from c to the center of each interval of Ui that is not part of Ui+1, and from c to the origin.  The set is path connected through c, but not locally path connected at 0.

Some connected sets aren't even locally path connected.  The earlier curve sin(1/x) union the origin is not locally path connected; the origin always causes trouble.  If it were locally path connected it would be path connected, as shown by the next theorem. Let C be a connected set that is also locally path connected.  Pick any point x in C, and let U be the set of points in C that are path connected to x.  Thus U is a subset of C.

Let y be any point in U.  Enclose y in an open set H in C, such that y is path connected to all of H.  Since an arc can run from x to y to anything in H, H is in U.  Therefore U is the union of open sets, and is open.

Let y be a point in C that is a limit point of U.  Put an open set H around y such that H is path connected.  Let z be common to H and U.  Now x connects to z connects to y, and y is in U.  Since U contains its limit points it is closed.  U is both open and closed in C.  If U is not all of C, separate U and the rest of C in open sets.  This contradicts the fact that C is connected.  Therefore U is all of C, and C is path connected.

In n dimensional space, every open ball is path connected, and every open set is locally path connected, hence every open connected set is path connected. Let P be the product of many spaces, using the weak product topology.  We went to a lot of trouble to show that a function into P is continuous iff all its component functions are continuous.  Now all that work pays off.  Let the domain be the unit interval, and a path in P corresponds to paths in the component spaces.  Thus P is path connected iff all its components are path connected.

If P is the product of finitely many spaces, it is locally path connected iff its components are locally path connected.  Find path connected open sets in the components and put them together to build a path connected open set in P; or take the path connected base open set in P and find path connected open sets in the components.

Now ask whether P is connected.  Suppose C, one of the component spaces, is not connected.  Projection is a continuous function, hence P is not connected.  A similar argument applies when W, a subspace of P, has a projection that is disconnected in one of the components.  If something casts two separate shadows, it must be in two pieces.

A disconnected set can have connected projections.  Let S be the points in the plane satisfying x ≠ y.  S is disconnected, yet it projects to all of x and all of y. A topological space is simply connected if it is path connected, and it has no holes.  Formally,any two paths connecting a and b can be continuously "moved" towards each other, until they coincide.  An equivalent definition says any circle in the space can shrink continuously to a point.

The plane is simply connected, but the plane without the origin is not.  Draw a circle around the origin, and we cannot shrink it down to a point.  No matter how we slide the circle about, it always crashes into the hole at the origin.  Similarly, 3 space without the z axis is not simply connected.  This is all intuition for now, a formal proof is part of algebraic topology.

What about 3 space without the origin?  This is simply connected.  A circle around the origin can always move out of plane, then shrink to a point.  However, there are times when the definition changes with the dimension.  It all depends on context.  If spheres must shrink continuously to a point, then 3 space without the origin is no longer simply connected, as the unit sphere about the origin cannot shrink to a point.

Unless otherwise stated, simply connected refers to paths and circles, regardless of the dimension of the containing space. Let S and T be spaces, such that a subspace S0 and a subspace T0 are homeomorphic courtesy of a function h.  Note that the subspaces are usually borders, and the homeomorphism is often quite straightforward.  For instance, two squares can be sewn together at a common edge to make a rectangle.  The homeomorphism is the identity map, and it doesn't get any simpler than that.

The new space, call it U, consists of the points of S, and the points of T without T0.  (Since T0 is already represented by S0, we need not count it twice.)  A set is open in U if it is the union of two open sets A in S and B in T such that A∩S0 and B∩T0 correspond under h.  In other words, A and B agree at the common border.  Note that A and B could miss the border entirely; whence their intersections with the border (empty) still correspond under h.  Set B to the empty set, for example, and A could be any open set in S that misses the border.  This remains open in U, along with open sets in T-T0, and open sets A+B that coincide at the border.

Take a moment to verify this is a topology.  The union of open sets A1+B1, A2+B2, A3+B3 … is built from two open sets A1∪A2∪A3∪… + B1∪B2∪B3∪ …, which have a common border under h.  Thus the arbitrary union of open sets is open.  In the same way, the intersection of two open sets is open.

Continue the example of two squares sewn together to make a rectangle.  Let A be a half open disk against the right edge of the leftmost square.  Can we extend this to an open set A+B in the rectangle?  In this case B might be the other half disk, the mirror image, and A+B becomes an open disk in the middle of the rectangle.  In general, one can always extend an open set across the border.

Remember that S0 and T0 are homeomorphic under h.  Within the topology of S0, inherited from S, A∩S0 is open, because A is open.  Apply h and find an open set in T0.  This has to come from an open set B in T.  Therefore A+B does the trick. Instead of sewing two squares together, imagine sewing the left and right edges of one square together.  This is easily visualized in three dimensions.  Curl a piece of paper up until its edges touch, forming a tube.

The technical definition is practically the same, but there is only one space S, and S0 and T0 both come from S.  The new space U is S with S0 joined to T0 through a homeomorphism h.  An open set A in S becomes an open set in U if A intersect S0 = A intersect T0 through h.  An argument similar to the above shows this is a topology.

If U is S and T sewn together, one cannot combine the bases for S and T to build a base for U.  It is tempting to combine base sets sharing the same border, to complement those base sets that are entirely in S-S0 or T-T0, but a base set on one side of the border may not line up with a base set on the other.  Let S and T be adjacent squares building a rectangle.  Let open squares (i.e. the interior of squares) with rational corners form a base for the euclidean topology of S.  Let open squares with irrational corners form a base for the euclidean topology of T.  A base set from S intersects the common border in an open interval with rational endpoints.  A base set from T intersects the common border in an open interval with irrational endpoints.  Two base sets cannot combine to produce an open set across the border.

Even a space pasted to itself can exhibit the same problem.  Sew the left and right edges of a square together to make a tube.  Let the base consist of rational open squares at the left, irrational open squares at the right, and arbitrary open squares down the middle.  Once again base sets do not combine across the border.

Return to our earlier example, a square sewn together to make a tube.  This time sew the top and bottom together as well.  The first step creates the paper tube, and if the paper was flexible, like a vacuum cleaner tube, you could bend the tube around until the top circle meets the bottom circle, forming a torus.  Often the square is a simpler representation of the torus.  As you slide off the top edge, you reappear at the bottom, and as you slide off the right side, you reappear at the left.

A three dimensional torus, denoted T3, can be constructed by sewing opposite faces of a cube together.  Top = bottom, front = back, left = right.  The space has a finite volume, yet you can travel in one direction forever.

Going backwards, the one dimensional torus T1 is a line segment with its ends joined together.  This is a circle.  In general, Tn is the topological product of n circles, one for each dimension of travel.

There are many other examples.  Consider the hemisphere, i.e. a bowl sitting on the table.  It has one edge, the circular rim of the bowl.  Sew the left half of this edge to the right half.  The left and right open semicircles merge into one open interval, and the bowl closes up into a shape that is homeomorphic to the sphere.

A more interesting example sews the circle to itself with a 180 degree phase shift.  In other words, h carries each point on the circle to its opposite point.  Let an ant crawl along this bowl, up to the edge.  As he passes through the edge, he appears on the other side crawling down.  This is projective space, denoted P2.  It is equivalent to lines passing through the origin in 3 space, or if you prefer, the intersection of these lines with the unit sphere.  Since each point is equivalent to the point on the other side, there is no need for the northern hemisphere, the southern hemisphere will serve.  That leaves only the equator.  Diameters run through the equator, so that each point is the same as the point 180 degrees around.  This is the bowl with half the equator sewn onto the other half, as described above. Take a long thin strip of paper, twist it 180 degrees, and sew (staple) the two ends together.  The result is a mobius strip, also called a mobius band.  This shape only has one side and one edge.

Use a square to represent a mobius strip.  Let h merge the top and bottom edges of the square, but this time h implements a reflection.  The top left corner is mapped onto the bottom right corner, and so on.  If a fish swims up through the top, his head reappears at the bottom, but he is reflected.  His dorsal fin is on the other side.  If he swims the circuit again he will be reflected back into his original orientation.

Draw a vertical line up the center of the square.  Place the fish to the right of this center line and let him swim up through the top.  He appears at the bottom, reflected, to the left of the center line.  Let him swim up through the top again and he is back on the right.  The space remains connected, even if it is cut down the middle.  Try this with your paper mobius strip.  Poke a hole with your scissors and cut it down the middle, all the way around.  The result is a band with a double (360 degree) twist.

Cut a mobius strip into thirds and find two separate loops that are interlocked.  One has a 180 degree twist and the other has a 360 degree twist. The klein bottle is represented by a square with its left and right edges sewn together, and its top and bottom edges sewn through a reflection.  It is not possible to model this with paper, even stretchable paper, but let's try anyways.  Take a tall sheet of paper and curl it up until its left and right edges coincide.  This creates a tall tube.  Paint a red line where the left and right edges meet.  This is the seam, if you will, running up the front of the tube.  Assume the paper can twist and stretch like rubber.  In an earlier example we bent the tube around to the right and joined the two circular ends together to make a torus.  The red seam becomes a circle that runs around the front of the torus, and a blue seam joins the top and bottom circles together.  However, to make a klein bottle, you must reflect one of the circles before sewing the two ends together.  How can we do that?

Return to the tall tube with its red seam running up the front.  Expand the bottom and shrink the top, so the tube has the shape of a bottle with a tall thin neck.  Pretend like you are a glass blower, and bend the neck over to the right.  This glass can do more than twist and stretch, it can pass through itself.  After you have pulled the tall narrow neck to the right, and around, and down, push it through the side of the wider base.  The top has now reentered the bottle, pointing down.  Fan out the top circle like a funnel, and sew it to the bottom circle.  Notice that the red seam meets itself, but this time the blue seam joins the top and bottom circles through a reflection.

Suppose you are a fly trapped inside such a bottle.  You are at the base, and there seems to be no way out.  The neck is sewn to the floor, and there are walls all around.  What to do?  Fly up the bottle, moving into the narrow neck.  Move up around the curved neck and back down, passing through the glass wall, the same way the narrow neck passes through the wall.  Travel through the inverted funnel and out the bottom, and you are free.  The klein bottle is a continuous surface with no edge and no inside.  This is quite different from the sphere and the torus, which have a definite inside - thus the air stays in your beach ball, and in your tire.

What does the klein bottle have to do with the mobius strip?  Start with a square and sew the top and bottom edges together through a reflection.  This is the mobius strip, one step away from the klein bottle.  Connect the left and right edges to get the klein bottle.  But this is a single edge on the mobius strip.  If you represent the single edge as a circle, opposite points are identified.  Projectively close the single edge of a mobius strip to get the klein bottle.  Alternatively, sew two mobius strips together to get the klein bottle.  Of course this can't be done in the real world, you just have to paste squares together and verify the relationships.

Although the klein bottle has no direct representation in 3 space, it embeds nicely in 4 space.  The neck need not punch through the wall, it can use the fourth dimension to sneak in the back door.  Suddenly it is just there, inside the walls of the base, whence the top fans out to meet the bottom.

If you want to apply a reflection to the left/right seam of a square, as well as the top/bottom seam, you'll see that opposite points on the perimeter correspond.  In this regard the square is not terribly different from the circle, and we already cross connected the perimeter of a bowl in an earlier example.  The result is homeomorphic to P2.

There is much more to say about sewing spaces together, and sewing spaces to themselves.  The resulting structures are called manifolds (a many folded thing), and like the klein bottle, they often have counterintuitive properties. Let S be a topological space and let r be an equivalence relation on the points of S.  Let Q, the quotient space (or factor space) of S, be the equivalence classes of S, as determined by r.  A subset U of Q is open iff the union of the points in the equivalence classes of U form an open set in S.  Take a moment to show that the arbitrary union and finite intersection of open sets in Q is open.  (These properties are inherited from S.)  Therefore Q has a valid topology.

Let f be a function from S onto Q, taking each point to its equivalence class.  By construction, f is continuous, but it need not be bicontinuous.  Let S consist of 3 points a b and c, where {a} is an open set.  Let r equate a and b, and leave c alone.  Thus Q consists of two points, ab and c.  Only ∅ and Q are open in Q.  The open set {a} maps to the set ab in Q, which is not open.

A quotient space often compresses a portion of S down to a point.  If T is a subspace of S, let r declare all the points of T as equivalent, whence they are represented by a single point p.  Every point outside of T remains in its own equivalence class.  Let's look at an example.

Let S be the unit disk in 2 dimensions and let T be its boundary.  Thus T is the unit circle.  Taking advantage of the third dimension, pull the unit circle out of plane, turning the disk into a bowl.  Then draw the rim of the bowl together into a single point p.  The result is a sphere.  In general, the quotient of an n dimensional ball by its boundary gives an n dimensional sphere.

If g is a continuous function on Q, compose g with the map from S onto Q to get a continuous function f that is constant across equivalence classes.

Conversely, let f(S) be a continuous function that is constant across equivalence classes.  This induces a well defined function g(Q).  The preimage of an open set O, under f, yields an open set U in S.  Pull O back through g to get a set V in Q.  Since U includes all the points in the equivalence classes of V, V is open by definition.  Therefore g is continuous.