In mathematics, a locally constant function is a function from a topological space into a set with the property that around every point of its domain, there exists some neighborhood of that point on which it restricts to a constant function.
Definition Let f : X → S {\displaystyle f:X\to S} be a function from a topological space X {\displaystyle X} into a set S . {\displaystyle S.} If x ∈ X {\displaystyle x\in X} then f {\displaystyle f} is said to be locally constant at x {\displaystyle x} if there exists a neighborhood U ⊆ X {\displaystyle U\subseteq X} of x {\displaystyle x} such that f {\displaystyle f} is constant on U , {\displaystyle U,} which by definition means that f ( u ) = f ( v ) {\displaystyle f(u)=f(v)} for all u , v ∈ U . {\displaystyle u,v\in U.} The function f : X → S {\displaystyle f:X\to S} is called locally constant if it is locally constant at every point x ∈ X {\displaystyle x\in X} in its domain.
Examples Every constant function is locally constant. The converse will hold if its domain is a connected space. Every locally constant function from the real numbers R {\displaystyle \mathbb {R} } to R {\displaystyle \mathbb {R} } is constant, by the connectedness of R . {\displaystyle \mathbb {R} .} But the function f : Q → R {\displaystyle f:\mathbb {Q} \to \mathbb {R} } from the rationals Q {\displaystyle \mathbb {Q} } to R , {\displaystyle \mathbb {R} ,} defined by f ( x ) = 0 for x < π , {\displaystyle f(x)=0{\text{ for }}x<\pi ,} and f ( x ) = 1 for x > π , {\displaystyle f(x)=1{\text{ for }}x>\pi ,} is locally constant (this uses the fact that π {\displaystyle \pi } is irrational and that therefore the two sets { x ∈ Q : x < π } {\displaystyle \{x\in \mathbb {Q} :x<\pi \}} and { x ∈ Q : x > π } {\displaystyle \{x\in \mathbb {Q} :x>\pi \}} are both open in Q {\displaystyle \mathbb {Q} } ). If f : A → B {\displaystyle f:A\to B} is locally constant, then it is constant on any connected component of A . {\displaystyle A.} The converse is true for locally connected spaces, which are spaces whose connected components are open subsets. Further examples include the following:
Given a covering map p : C → X , {\displaystyle p:C\to X,} then to each point x ∈ X {\displaystyle x\in X} we can assign the cardinality of the fiber p − 1 ( x ) {\displaystyle p^{-1}(x)} over x {\displaystyle x} ; this assignment is locally constant. A map from a topological space A {\displaystyle A} to a discrete space B {\displaystyle B} is continuous if and only if it is locally constant.
… excerpt ends here. Continue reading the full article.


