Constant function

In mathematics, a **constant function** is a function whose output value is the same for every input value. For example, the function  is a constant function because the value of    is 4 regardless of the input value  (see image).

## Basic properties

Formally, a constant function _f_(_x_):**R**→**R** has the form  . Usually we write   or just  .
- The function _y_=_c_ has 2 variables _x_ and _у_ and 1 constant _c_. (In this form of the function, we do not see _x_, but it is there.)
    - The constant _c_ is a real number. Before working with a linear function, we replace _c_ with an actual number.
    - The domain or input of _y_=_c_ is **R**. So any real number _x_ can  be _input_. However, the output is always the value _c_.
    - The range of _y_=_c_ is also **R**. However, because the output is always the value of _c_, the codomain is just _c_.

**Example:** The function    or just    is the specific constant function where the output value is  . The domain is all real numbers ℝ. The codomain is just {4}.  Namely, _y_(0)=4, _y_(−2.7)=4, _y_(π)=4,.... No matter what value of _x_ is input, the output is "4".

- The **graph** of the constant function  is a **horizontal line** in the plane that passes through the point .
- If _c_≠0, the constant function _y_=_c_ is a polynomial in one variable _x_ of degree zero.
    - The _y_-intercept of this function is the point (0,_c_).
    - This function has no _x_-intercept. That is, it has no root or zero. It never crosses the _x_-axis.
- If _c_=0, then we have _y_=0. This is the zero polynomial or the **identically zero function**. Every real number _x_ is a root. The graph of _y_=0 is the _x_-axis in the plane.
- A constant function is an even function so the _y_-axis is an axis of symmetry for every constant function.

## Derivative of a constant function

In the context where it is defined, the derivative of a function measures the rate of change of function (output) values with respect to change in input values. A constant function does not change, so its derivative is 0. This is often written:   .

**Example:**    is a constant function. The derivative of _y_ is the identically zero function     .

The converse (opposite) is also true. That is, if the derivative of a function is zero everywhere, then the function is a constant function.

Mathematically we write these two statements:

## Generalization

A function _f_ : _A_ → _B_ is a constant function if _f_(_a_) = _f_(_b_) for every _a_ and _b_ in _A_.

## Examples

**Real-world example:** A store where every item is sold for 1 euro. The domain of this function is _items in the store_. The codomain is _1 euro_.

**Example:** Let _f_ : _A_ → _B_ where _A_={X,Y,Z,W} and _B_={1,2,3} and _f_(_a_)=3 for every _a_∈_A_. Then _f_ is a constant function.

**Example:** _z_(_x_,_y_)=2 is the constant function from _A_=ℝ² to _B_=ℝ where every point (_x_,_y_)∈ℝ² is mapped to the value _z_=2. The graph of this constant function is the horizontal plane (parallel to the _x_0_y_ plane) in 3-dimensional space that passes through the point (0,0,2).

**Example:** The polar function _ρ_(_φ_)=2.5 is the constant function that maps every _angle_ φ to the _radius_ ρ=2.5. The graph of this function is the circle of radius 2.5 in the plane.

## Other properties

There are other properties of constant functions.

## Related pages

- Matrix
- Calculus
- Function
- Arithmetic
- Integration
- Polynomial
- Differentiation
- Quadratic function
- Differential equation
- Multivariable calculus
- List of mathematical symbols