In mathematics , a function on the real numbers is called a step function if it can be written as a finite linear combination of indicator functions of half-open intervals . Informally speaking, a step function is a piecewise constant function having only finitely many pieces.
Example of a step function with n=4.
Let the following quantities be given:
a sequence of coefficients
{
α
0
,
…
,
α
n
}
⊂
R
,
n
∈
N
∖
{
0
}
{\displaystyle \{\alpha _{0},\dots ,\alpha _{n}\}\subset \mathbb {R} ,\;n\in \mathbb {N} \setminus \{0\}}
a sequence of interval margins
{
x
1
<
⋯
<
x
n
−
1
}
⊂
R
{\displaystyle \{x_{1}<\dots <x_{n-1}\}\subset \mathbb {R} }
a sequence of intervals
A
0
:=
(
−
∞
,
x
1
)
{\displaystyle A_{0}:=(-\infty ,x_{1})}
A
i
:=
[
x
i
,
x
i
+
1
)
{\displaystyle A_{i}:=[x_{i},x_{i+1})}
(for
i
=
1
,
⋯
,
n
−
2
{\displaystyle i=1,\cdots ,n-2}
)
A
n
:=
[
x
n
−
1
,
∞
)
{\displaystyle A_{n}:=[x_{n-1},\infty )}
(Although the intervals are shown as being closed below and open above, this is not necessary to the definition; all that is required is that the intervals An do not intersect, and that their union is the set of real numbers.)
Definition: Given the notations above, a function
f
:
R
→
R
{\displaystyle f:\mathbb {R} \rightarrow \mathbb {R} }
is a step function if and only if it can be written as
f
(
x
)
=
∑
i
=
0
n
α
i
⋅
1
A
i
(
x
)
{\displaystyle f(x)=\sum \limits _{i=0}^{n}\alpha _{i}\cdot 1_{A_{i}}(x)}
for all
x
∈
R
{\displaystyle x\in \mathbb {R} }
where
1
A
{\displaystyle 1_{A}}
is the indicator function of
A
{\displaystyle A}
:
1
A
(
x
)
=
{
1
,
i
f
x
∈
A
0
,
o
t
h
e
r
w
i
s
e
.
{\displaystyle 1_{A}(x)=\left\{{\begin{matrix}1,&\mathrm {if} \;x\in A\\0,&\mathrm {otherwise} .\end{matrix}}\right.}
Note: for all
i
=
0
,
⋯
,
n
{\displaystyle i=0,\cdots ,n}
and
x
∈
A
i
{\displaystyle x\in A_{i}}
it holds:
f
(
x
)
=
α
i
.
{\displaystyle f(x)=\alpha _{i}.}
Special step functions
A version of the unit step function or Heaviside step function , H 1 (x ), is the special case n =1, α0 =0, α1 =1, and x 1 =0.
See also