In mathematics a constant function is a function whose values do not vary and thus are constant. For example, if we have the function f(x) = 4, then f 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.
Notice that every empty function, that is, any function whose ___domain equals the empty set, is included in the above definition vacuously, since there are no x and y in A for which f(x) and f(y) are different. However some find it more convenient to define constant function so as to exclude empty functions.
For polynomial functions, a non-zero constant function is called a polynomial of degree zero.
Properties
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.
The first characterization of constant functions given above, is taken as the motivating and defining property for the more general notion of constant morphism in Category theory.
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.
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.
Derivative
The derivative of a function measures how that function varies with respect to the variation of some argument. It follows, since a constant function does not vary, its derivative will be zero. Indeed, suppose f(x) = c for all vector x in an Euclidean space and c constant. Then, for non-zero vector
- .
It turned out the converse follows when f is real-valued; since the mean-value theorem says for f differentiable on [a, b] and some x between. The converse also holds when f maps real vectors, provided that all of its partial derivatives vanish. If only some of the partial derivatives are zero, then f is locally constant. If, however, the function is locally constant on a connected set, then it is constant.
References
- Herrlich, Horst and Strecker, George E., Category Theory, Allen and Bacon, Inc. Boston (1973)
- "Constant function". PlanetMath.