In topology and related branches of mathematics, a topological space is said to be

**connected**if it cannot be divided into two disjoint nonempty open sets whose union is the entire space. Equivalently, it can't be divided into two disjoint nonempty closed sets (since the complement of an open set is closed). Some authorities accept the empty set (with its unique topology) as a connected space, while others do not.

The space *X* is said to be **path-connected** if for any two points *x* and *y* in *X* there exists a continuous function *f* from the unit interval [0,1] to *X* with *f*(0) = *x* and *f*(1) = *y*.
(This function is called a *path*, or *curve*, from *x* to *y*.)

Every path-connected space is connected.
Example of connected spaces that are not path-connected include the extended long line *L** and the *topologist's sine curve*.
The latter is a certain subset of the Euclidean plane:

- { (
*x*,*y*) in**R**^{2}| 0 <*x*and*y*= sin(1/*x*) } union { (0,*y*) in**R**^{2}| -1 ≤*y*≤ 1 }.

**R**are connected if and only if they are path-connected; these subsets are the intervals of

**R**. Also, open subsets of

**R**

^{n}or

**C**

^{n}are connected if and only if they are path-connected. Additionally, connectedness and path-connectedness are the same for finite topological spaces.

If *X* and *Y* are topological spaces, *f* is a continuous function from *X* to *Y*, and *X* is connected (respectively, path-connected), then the image *f*(*X*) is connected (respectively, path-connected).
The intermediate value theorem can be considered as a special case of this result.

The maximal nonempty connected subsets of any topological space are called the **components** of the space.
The components form a partition of the space (that is, they are disjoint and their union is the whole space).
Every component is a closed subset of the original space.
The components in general need not be open: the components of the rational numbers, for instance, are the one-point sets.
A space in which all components are one-point sets is called **totally disconnected**.

A topological space is said to be **locally connected** if it has a base of connected sets.
It can be shown that a space *X* is locally connected if and only if every component of every open set of *X* is open.
The topologist's sine curve shown above is an example of a connected space that is not locally connected.

Similarly, a topological space is said to be **locally path-connected** if it has a base of path-connected sets.
An open subset of a locally path-connected space is connected if and only if it is path-connected.
This generalizes the earlier statement about **R**^{n} and **C**^{n}, each of which is locally path-connected.
More generally, any topological manifold is locally path-connected.