Stated informally, connected sets are those which are in one piece. In order to define what is meant by this, I will first consider what it means for a set to not be in one piece. This is called separated. Connected sets are defined in terms of not being separated. This is why theorems about connected sets sometimes seem a little tricky.
Definition 2.7.1 Let A be a nonempty subset ℝ^{n}. Then A is defined to be the intersection of all closed sets which contain A. This is called the closure of A. Note the whole space, ℝ^{n} is one such closed set which contains A.
Lemma 2.7.2 Let A be a nonempty set in ℝ^{n}. Then A is a closed set and

where A^{′} denotes the set of limit points of A.
Proof: First of all, denote by C the set of closed sets which contain A. Then

and this will be closed if its complement is open. However,

Each H^{C} is open and so the union of all these open sets must also be open. This is because if x is in this union, then it is in at least one of them. Hence it is an interior point of that one. But this implies it is an interior point of the union of them all which is an even larger set. Thus A is closed.
The interesting part is the next claim. First note that from the definition, A ⊆A so if x ∈ A, then x ∈A. Now consider y ∈ A^{′} but y

Next suppose x ∈A and suppose x

Now is a definition about what it means to not be connected. This is called separated.
Definition 2.7.3 A set, S in ℝ^{n}, is separated if there exist sets A,B such that

In this case, the sets A and B are said to separate S. A set is connected if it is not separated. Remember A denotes the closure of the set A.
Note that the concept of connected sets is defined in terms of what it is not. This makes it somewhat difficult to understand. One of the most important theorems about connected sets is the following.
Theorem 2.7.4 Suppose U is a set of connected sets and that there exists a point p which is in all of these connected sets. Then K ≡∪U is connected.
Proof: Suppose

where ∩ B = ∩ A = ∅,A≠∅,B≠∅. Let U ∈U. Then

and this would separate U if both sets in the union are nonempty since the limit points of U ∩ B are contained in the limit points of B. It follows that every set of U is contained in one of A or B. Suppose then that some U ⊆ A. Then all U ∈U must be contained in A because if one is contained in B, this would violate the assumption that they all have a point p in common. Thus K is connected after all because this requires B = ∅. Alternatively, p is in one of these sets. Say p ∈ A. Then by the above argument every U must be in A because if not, the above would be a separation of U. Thus B = ∅. ■
The intersection of connected sets is not necessarily connected as is shown by the following picture.
Proof: To do this you show f
An arbitrary set can be written as a union of maximal connected sets called connected components. This is the concept of the next definition.
Definition 2.7.6 Let S be a set and let p ∈ S. Denote by C_{p} the union of all connected subsets of S which contain p. This is called the connected component determined by p.
Theorem 2.7.7 Let C_{p} be a connected component of a set S . Then C_{p} is a connected set and if C_{p} ∩ C_{q}≠∅, then C_{p} = C_{q}.
Proof: Let C denote the connected subsets of S which contain p. By Theorem 2.7.4, ∪C = C_{p} is connected. If x ∈ C_{p} ∩C_{q}, then from Theorem 2.7.4, C_{p} ⊇ C_{p} ∪C_{q} and so C_{p} ⊇ C_{q}. The inclusion goes the other way by the same reason. ■
This shows the connected components of a set are equivalence classes and partition the set.
A set, I is an interval in ℝ if and only if whenever x,y ∈ I then
Proof: Let C be connected. If C consists of a single point, p, there is nothing to prove. The interval is just

let C ∩
Conversely, let I be an interval. Suppose I is separated by A and B. Pick x ∈ A and y ∈ B. Suppose without loss of generality that x < y. Now define the set,

and let l be the least upper bound of S. Then l ∈A so l

contradicting the definition of l as an upper bound for S. Therefore, l ∈B which implies l
This yields a generalization of the intermediate value theorem from one variable calculus.
Corollary 2.7.9 Let E be a connected set in ℝ^{n} and suppose f : E → ℝ and that y ∈
Proof: From Theorem 2.7.5, f
The following theorem is a very useful description of the open sets in ℝ.
Theorem 2.7.10 Let U be an open set in ℝ. Then there exist countably many disjoint open sets
Proof: Let p ∈ U and let z ∈ C_{p}, the connected component determined by p. Since U is open, there exists, δ > 0 such that

This shows C_{p} is open. By Theorem 2.7.8, this shows C_{p} is an open interval,
Definition 2.7.11 A set E in ℝ^{n} is arcwise connected if for any two points, p,q ∈ E, there exists a closed interval,
An example of an arcwise connected space would be any subset of ℝ^{n} which is the continuous image of an interval. Arcwise connected is not the same as connected. A well known example is the following.
 (2.18) 
You can verify that this set of points in ℝ^{2} is not arcwise connected but is connected.
Proof: This is easy from the convexity of the set. If x,y ∈ B
Proof: Let p ∈ X. Then by assumption, for any x ∈ X, there is an arc joining p and x. This arc is connected because it is the continuous image of an interval which is connected. Since x is arbitrary, every x is in a connected subset of X which contains p. Hence C_{p} = X and so X is connected. ■
Theorem 2.7.14 Let U be an open subset of a ℝ^{n}. Then U is arcwise connected if and only if U is connected. Also the connected components of an open set are open sets.
Proof: By Proposition 2.7.13 it is only necessary to verify that if U is connected and open in the context of this theorem, then U is arcwise connected. Pick p ∈ U. Say x ∈ U satisfies P if there exists a continuous function, γ :

If x ∈ A, then Lemma 2.7.12 implies B

Then it is clear that γ_{1} is a continuous function mapping p to y and showing that B
Now consider B ≡ U ∖A. I claim this is also open. If B is not open, there exists a point z ∈ B such that every open set containing z is not contained in B. Therefore, letting B
It remains to verify the connected components are open. Let z ∈ C_{p} where C_{p} is the connected component determined by p. Then picking B
As an application, consider the following corollary.
Corollary 2.7.15 Let f : Ω → ℤ be continuous where Ω is a connected open set in ℝ^{n}. Then f must be a constant.
Proof: Suppose not. Then it achieves two different values, k and l≠k. Then Ω = f^{−1}

which is the inverse image of an open set while f^{−1}