In mathematics, a function on the real numbers is called a step function (or staircase function) if it can be written as a finite linear combination of indicator functions of intervals. Informally speaking, a step function is a piecewise constant function having only finitely many pieces.
Definition and first consequences
A function f : R → R is called a step function if it can be written as
f ( x ) = ∑ i = 0 n α i χ A i ( x ) for all real numbers
x where n ≥ 0 , α i are real numbers, A i are intervals, and χ A (sometimes written as 1 A ) is the indicator function of A :
χ A ( x ) = { 1 if x ∈ A , 0 if x ∉ A . In this definition, the intervals A i can be assumed to have the following two properties:
- The intervals are pairwise disjoint, A i ∩ A j = ∅ for i ≠ j
- The union of the intervals is the entire real line, ∪ i = 0 n A i = R .
Indeed, if that is not the case to start with, a different set of intervals can be picked for which these assumptions hold. For example, the step function
f = 4 χ [ − 5 , 1 ) + 3 χ ( 0 , 6 ) can be written as
f = 0 χ ( − ∞ , − 5 ) + 4 χ [ − 5 , 0 ] + 7 χ ( 0 , 1 ) + 3 χ [ 1 , 6 ) + 0 χ [ 6 , ∞ ) . A constant function is a trivial example of a step function. Then there is only one interval, A 0 = R . The sign function sgn ( x ) , which is −1 for negative numbers and +1 for positive numbers, and is the simplest non-constant step function.The Heaviside function H(x), which is 0 for negative numbers and 1 for positive numbers, is an important step function, and is equivalent to the sign function, up to a shift and scale of range ( H = ( sgn + 1 ) / 2 ). It is the mathematical concept behind some test signals, such as those used to determine the step response of a dynamical system.The rectangular function, the normalized boxcar function, is the next simplest step function, and is used to model a unit pulse.The integer part function is not a step function according to the definition of this article, since it has an infinite number of intervals. However, some authors also define step functions with an infinite number of intervals.The sum and product of two step functions is again a step function. The product of a step function with a number is also a step function. As such, the step functions form an algebra over the real numbers.A step function takes only a finite number of values. If the intervals A i , i = 0 , 1 , … , n , in the above definition of the step function are disjoint and their union is the real line, then f ( x ) = α i for all x ∈ A i . The definite integral of a step function is a piecewise linear function.The Lebesgue integral of a step function f = ∑ i = 0 n α i χ A i is ∫ f d x = ∑ i = 0 n α i ℓ ( A i ) , where ℓ ( A ) is the length of the interval A , and it is assumed here that all intervals A i have finite length. In fact, this equality (viewed as a definition) can be the first step in constructing the Lebesgue integral.