In mathematics, a constant function is a function whose values do not vary and thus are constant. For example the function f(x) = 4 is constant since f maps any value to 4. More formally, a function f : A → B is a constant function if f(x) = f(y) for all x and y in A.
In the context of polynomial functions, a non-zero constant function is called a polynomial of degree zero.
A function is said to be identically zero if it takes the value 0 for every argument; it is then trivially a constant function.
Constant functions can be characterized with respect to function composition in two ways.
The following are equivalent:
- f : A → B is a constant function.
- For all functions g, h : C → A, f o g = f o h, (where "o" denotes function composition).
- The composition of f with any other function is also a constant function.
In contexts where it is defined, the derivative of a function measures how that function varies with respect to the variation of some argument. It follows that, since a constant function does not vary, its derivative, where defined, will be zero. Thus for example:
- If f is a real-valued function of a real variable, defined on some interval, then f is constant if and only if the derivative of f is everywhere zero.
For functions between preordered sets, constant functions are both order-preserving and order-reversing; conversely, if f is both order-preserving and order-reversing, and if the domain of f is a lattice, then f must be constant.
Other properties of constant functions include:
- Every constant function whose domain and codomain are the same is idempotent.
- Every constant function between topological spaces is continuous.
- Herrlich, Horst and Strecker, George E., Category Theory, Allen and Bacon, Inc. Boston (1973)
- Constant function, PlanetMath.org.