Suppose you have a closed subset of the plane and you want to prove something about it that seems fairly obvious but is troublesome to demonstrate rigorously.◊ Then it may well help to take a grid of small squares and replace your set by the union of all the squares that overlap it.
The basic theory of metric spaces
Let be a domain in the complex plane: that is, a connected open subset of . Let be a closed bounded subset of . Is it always possible to find a closed curve in that has in its interior?
An initially encouraging observation is that is compact (because it is a closed bounded subset of , which we can identify with ), that the complement of is closed, and that and are disjoint. This implies that there is some such that the distance from any point in to any point in is always at least . The proof is that the distance is a continuous function of . Since is compact, it must attain its infimum. But it is never zero, since , so the infimum must be some , as claimed. Or to put it another way, it implies that there is some such that for every the ball of radius about is a subset of .
This is encouraging because it tells us that we ought to have "room to get round ". But how do we turn this nice feeling into a proper argument? A very useful trick is to use a grid of squares.
What we do is write the complex plane as a union of squares of diameter less than . To be unnecessarily safe, let us take to be an integer such that , and let us take all squares of sidelength that have vertices with coordinates that are integer multiples of . Thus, a typical square in this grid will be of the form .
Once we've done this, we replace by the union of all the squares in the grid that have a non-empty intersection with . This will be a new closed set (since it is a union of finitely many closed squares), still contained in (since the diameter of each square is less than the distance from to ). Let us call it . If we can find a curve that contains in its interior, then it will obviously contain in its interior as well. In fact, one can say slightly more, and this will be useful to us. Not only is contained in , it is actually contained in the interior of , since if any point is on the boundary of a square in the grid, then the neighbouring square (or squares if is a vertex) will also intersect and so will also form part of . (In other words, it is important that we have taken closed squares and taken all the ones that intersect with , even if the intersection is just on the boundary.)
This tells us that we could if we wanted form the curve we are trying to form by going round the boundary of . And indeed, this almost works, but it leaves us with two things to do. First, we need to say what "going round the boundary of " means, and secondly we need to take account of the fact that might not be connected.
There is a nice trick that makes it possible to split the boundary of up into a union of closed curves. First, you take all the squares that make up , and you orient their edges — anticlockwise, say. Then any edge that's on the boundary of two squares will be oriented in one direction for one of the squares and the other direction for the other, so you cancel them out. What you will be left with after these cancellations is just the boundary edges of , which form a directed graph. A brief consideration of the possible cases shows that each vertex of this graph (which will be a point with coordinates that are integer multiples of ) has the same number of edges going in as coming out. This means that the graph itself can be decomposed into directed cycles using a greedy algorithm. You just start at a vertex that has at least one edge coming out of it, follow an out-edge, and keep following out-edges. Each time you arrive at a vertex and leave it, you have used one in-edge and one out-edge, so if you delete the edges that you have used, then all vertices will have the same number of in-edges as out-edges except the vertex where you are now (which has one more out-edge than in-edges) and the vertex where you started (which has one more in-edge than out-edges). This process cannot go on for ever, so at some point you must end up at the vertex where you started. If there are any edges left, then pick a new vertex with at least one edge coming out of it and repeat the process.
The above argument is slightly unsatisfactory for two reasons. First, we are trying to find one closed curve rather than several, and secondly the closed curves we have found can touch themselves, whereas we would prefer to find a simple closed curve. We shall deal with both these problems at once, again using the grid-of-squares trick.
We haven't quite stated it abstractly, but we have been using the following trivial observation: if is any closed bounded subset of that contains , and if we can find a closed curve in that contains in its interior, then we can find a closed curve in that contains in its interior. We attempted to use for the purpose, but there are two inconvenient properties that can have: it may be disconnected, in which case we will get more than one closed curve if we follow the boundary of , or it may have two parts that touch each other just at a shared vertex, in which case we may get a closed curve that is not simple, or two simple closed curves that touch (depending on whether we go round the whole of a figure of eight or round each half separately).
How could we make connected? Well, is connected, so every point in can be joined to every other point by a path in . So couldn't we just add some connecting paths to ? We could try, but it isn't quite clear how to do that and keep compact, since we might have to add infinitely many paths. (For example, might be some highly disconnected set like a Cantor set.) However, we shouldn't forget what we have already noticed: that we can contain inside a closed bounded union of squares that is still a subset of . And we can turn into a connected set by adding finitely many paths: at most one path for each pair of squares in the union that forms . Each path is compact, so adding the paths results in a compact set . We can now pick a new grid of squares, and if it is sufficiently fine, then the union of all squares that have non-empty intersection with will be a subset of . What is more, it will be connected.
We are now ready to define the curve we were looking for. There is nothing in our discussion so far to stop being a set with holes, such as an annulus. So we would like to find an external boundary point of . This we can do by looking at the components of , of which only one is unbounded. Call this set . Then let be the complement of . The set is closed and bounded, and it contains . It is not necessarily contained in (because could have holes) but the boundary of is contained in the boundary of , so the boundary of is contained in . Moreover, is a union of squares from our new grid.
To finish off the proof, let us do a little trick. We shall expand all the squares of very slightly, so that they are still contained in , but now you never have two squares intersecting in just a vertex. We then pick a boundary edge of and follow it for as long as possible. (Remember that each edge has a direction associated with it.) Each time we arrive at a vertex (or rather, very close to a vertex), we do not have any choice about what to do, since no two of the expanded squares intersect in exactly a vertex. So we just follow round until we get back to our starting point, which must eventually happen as there are only finitely many edges.
I'm slightly struggling here. I want to get away without proving (or assuming) the Jordan curve theorem, or doing something equivalent like defining winding number, but I'm not quite sure whether I can.