The points traced by a path from ${\displaystyle A}$ to ${\displaystyle B}$ in ${\displaystyle \mathbb {R} ^{2}.}$ However, different paths can trace the same set of points.

In mathematics, a path in a topological space ${\displaystyle X}$ is a continuous function from the closed unit interval ${\displaystyle [0,1]}$ into ${\displaystyle X.}$

Paths play an important role in the fields of topology and mathematical analysis. For example, a topological space for which there exists a path connecting any two points is said to be path-connected. Any space may be broken up into path-connected components. The set of path-connected components of a space ${\displaystyle X}$ is often denoted ${\displaystyle \pi _{0}(X).}$

One can also define paths and loops in pointed spaces, which are important in homotopy theory. If ${\displaystyle X}$ is a topological space with basepoint ${\displaystyle x_{0},}$ then a path in ${\displaystyle X}$ is one whose initial point is ${\displaystyle x_{0))$. Likewise, a loop in ${\displaystyle X}$ is one that is based at ${\displaystyle x_{0))$.

## Definition

A curve in a topological space ${\displaystyle X}$ is a continuous function ${\displaystyle f:J\to X}$ from a non-empty and non-degenerate interval ${\displaystyle J\subseteq \mathbb {R} .}$ A path in ${\displaystyle X}$ is a curve ${\displaystyle f:[a,b]\to X}$ whose domain ${\displaystyle [a,b]}$ is a compact non-degenerate interval (meaning ${\displaystyle a are real numbers), where ${\displaystyle f(a)}$ is called the initial point of the path and ${\displaystyle f(b)}$ is called its terminal point. A path from ${\displaystyle x}$ to ${\displaystyle y}$ is a path whose initial point is ${\displaystyle x}$ and whose terminal point is ${\displaystyle y.}$ Every non-degenerate compact interval ${\displaystyle [a,b]}$ is homeomorphic to ${\displaystyle [0,1],}$ which is why a path is sometimes, especially in homotopy theory, defined to be a continuous function ${\displaystyle f:[0,1]\to X}$ from the closed unit interval ${\displaystyle I:=[0,1]}$ into ${\displaystyle X.}$ An arc or C0-arc in ${\displaystyle X}$ is a path in ${\displaystyle X}$ that is also a topological embedding.

Importantly, a path is not just a subset of ${\displaystyle X}$ that "looks like" a curve, it also includes a parameterization. For example, the maps ${\displaystyle f(x)=x}$ and ${\displaystyle g(x)=x^{2))$ represent two different paths from 0 to 1 on the real line.

A loop in a space ${\displaystyle X}$ based at ${\displaystyle x\in X}$ is a path from ${\displaystyle x}$ to ${\displaystyle x.}$ A loop may be equally well regarded as a map ${\displaystyle f:[0,1]\to X}$ with ${\displaystyle f(0)=f(1)}$ or as a continuous map from the unit circle ${\displaystyle S^{1))$ to ${\displaystyle X}$

${\displaystyle f:S^{1}\to X.}$

This is because ${\displaystyle S^{1))$ is the quotient space of ${\displaystyle I=[0,1]}$ when ${\displaystyle 0}$ is identified with ${\displaystyle 1.}$ The set of all loops in ${\displaystyle X}$ forms a space called the loop space of ${\displaystyle X.}$

## Homotopy of paths

 Main article: Homotopy
A homotopy between two paths.

Paths and loops are central subjects of study in the branch of algebraic topology called homotopy theory. A homotopy of paths makes precise the notion of continuously deforming a path while keeping its endpoints fixed.

Specifically, a homotopy of paths, or path-homotopy, in ${\displaystyle X}$ is a family of paths ${\displaystyle f_{t}:[0,1]\to X}$ indexed by ${\displaystyle I=[0,1]}$ such that

• ${\displaystyle f_{t}(0)=x_{0))$ and ${\displaystyle f_{t}(1)=x_{1))$ are fixed.
• the map ${\displaystyle F:[0,1]\times [0,1]\to X}$ given by ${\displaystyle F(s,t)=f_{t}(s)}$ is continuous.

The paths ${\displaystyle f_{0))$ and ${\displaystyle f_{1))$ connected by a homotopy are said to be homotopic (or more precisely path-homotopic, to distinguish between the relation defined on all continuous functions between fixed spaces). One can likewise define a homotopy of loops keeping the base point fixed.

The relation of being homotopic is an equivalence relation on paths in a topological space. The equivalence class of a path ${\displaystyle f}$ under this relation is called the homotopy class of ${\displaystyle f,}$ often denoted ${\displaystyle [f].}$

## Path composition

One can compose paths in a topological space in the following manner. Suppose ${\displaystyle f}$ is a path from ${\displaystyle x}$ to ${\displaystyle y}$ and ${\displaystyle g}$ is a path from ${\displaystyle y}$ to ${\displaystyle z}$. The path ${\displaystyle fg}$ is defined as the path obtained by first traversing ${\displaystyle f}$ and then traversing ${\displaystyle g}$:

${\displaystyle fg(s)={\begin{cases}f(2s)&0\leq s\leq {\frac {1}{2))\\g(2s-1)&{\frac {1}{2))\leq s\leq 1.\end{cases))}$

Clearly path composition is only defined when the terminal point of ${\displaystyle f}$ coincides with the initial point of ${\displaystyle g.}$ If one considers all loops based at a point ${\displaystyle x_{0},}$ then path composition is a binary operation.

Path composition, whenever defined, is not associative due to the difference in parametrization. However it is associative up to path-homotopy. That is, ${\displaystyle [(fg)h]=[f(gh)].}$ Path composition defines a group structure on the set of homotopy classes of loops based at a point ${\displaystyle x_{0))$ in ${\displaystyle X.}$ The resultant group is called the fundamental group of ${\displaystyle X}$ based at ${\displaystyle x_{0},}$ usually denoted ${\displaystyle \pi _{1}\left(X,x_{0}\right).}$

In situations calling for associativity of path composition "on the nose," a path in ${\displaystyle X}$ may instead be defined as a continuous map from an interval ${\displaystyle [0,a]}$ to ${\displaystyle X}$ for any real ${\displaystyle a\geq 0.}$ A path ${\displaystyle f}$ of this kind has a length ${\displaystyle |f|}$ defined as ${\displaystyle a.}$ Path composition is then defined as before with the following modification:

${\displaystyle fg(s)={\begin{cases}f(s)&0\leq s\leq |f|\\g(s-|f|)&|f|\leq s\leq |f|+|g|\end{cases))}$

Whereas with the previous definition, ${\displaystyle f,}$ ${\displaystyle g}$, and ${\displaystyle fg}$ all have length ${\displaystyle 1}$ (the length of the domain of the map), this definition makes ${\displaystyle |fg|=|f|+|g|.}$ What made associativity fail for the previous definition is that although ${\displaystyle (fg)h}$ and ${\displaystyle f(gh)}$have the same length, namely ${\displaystyle 1,}$ the midpoint of ${\displaystyle (fg)h}$ occurred between ${\displaystyle g}$ and ${\displaystyle h,}$ whereas the midpoint of ${\displaystyle f(gh)}$ occurred between ${\displaystyle f}$ and ${\displaystyle g}$. With this modified definition ${\displaystyle (fg)h}$ and ${\displaystyle f(gh)}$ have the same length, namely ${\displaystyle |f|+|g|+|h|,}$ and the same midpoint, found at ${\displaystyle \left(|f|+|g|+|h|\right)/2}$ in both ${\displaystyle (fg)h}$ and ${\displaystyle f(gh)}$; more generally they have the same parametrization throughout.

## Fundamental groupoid

There is a categorical picture of paths which is sometimes useful. Any topological space ${\displaystyle X}$ gives rise to a category where the objects are the points of ${\displaystyle X}$ and the morphisms are the homotopy classes of paths. Since any morphism in this category is an isomorphism this category is a groupoid, called the fundamental groupoid of ${\displaystyle X.}$ Loops in this category are the endomorphisms (all of which are actually automorphisms). The automorphism group of a point ${\displaystyle x_{0))$ in ${\displaystyle X}$ is just the fundamental group based at ${\displaystyle x_{0))$. More generally, one can define the fundamental groupoid on any subset ${\displaystyle A}$ of ${\displaystyle X,}$ using homotopy classes of paths joining points of ${\displaystyle A.}$ This is convenient for the Van Kampen's Theorem.