 Constant Piecewise Functions: Step Functions

We are going to study a simple kind of functions. These are Piecewise constant functions or Step functions.

Although these functions are simple they are very important: we use them to approximate other more complex functions and they can help us to get an understanding of the Fundamental Theorem of Calculus from a basic point of view. For example, see Tom Apostol's book.

Some of the ideas and examples of this page are taken from two interesting articles by Gilbert Strang and Antony J. Macula.

A piecewise function is a function that is defined by several subfunctions. Each subfunction apply in a subdomain of the function's domain. In these pages, these subdomains will be intervals. We can say that these functions 'behave differently' based on the input value. For example, we use a different formula depending the input value.

If each piece is a constant function then the piecewise function is called Piecewise constant function or Step function.

For example, the following function has two parts: This is a typical notation we use for this function:

The graph of an step function is made by horizontal segments (or perhaps, rays) The Floor Function is an example of step function that has an infinite number of pieces. We remember that the function defined by f(x)=c, where c is a constant, a fixed number, is called a constant function. The graph of a constant function is a horizontal line.

A constant function is a special case of a linear or afine function. The derivative of a linear function is a basic example of derivative, it is a constant function. The derivative of a lineal function is a constant function.

The definite integral of a constant function is the area of a rectangle (positive or negative).  The indefinite integral of a constant function is a linear function.   It is easy to calculate the area under a straight line. This is the first example of integration that allows us to understand the idea and to introduce several basic concepts: integral as area, limits of integration, positive and negative areas.

Primitives of a constant function are linear functions. Slopes or these linear functions are the constant function. Tom Apostol, in his book 'Calculus', began writing about the integral of a function defining the integral of steps functions.

To compute the integral of a step function we multiply each constant value by the length of the corresponding subinterval.

Then the value of the integral is the sum of the areas (positive or negative) of the individual rectangles. Notice that this value is independent of the values of the step function at the subdivision points. (Apostol, p. 65). (After that, Apostol prove several important properties of the integral, pags 68-69, and uses this definition to define the integral of more general functions, approximating a function from above and below by step functions. He wrote: "The approach will be patterned somewhat after the method of Archimedes. The idea is simply this: We begin by approximating the function f from below and from above by step functions." (p. 72))

We denote the indefinite integral as the function F(x): In those intervals where f is constant, the function F is linear. We describe this by saying that the integral of a step function is piecewise linear.(Apostol, p. 123) Observe also that the graph of f is made up of disconnected line segments. There are points on the graph of f where a small change in x produces a sudden jump in the value of the function. Note, however, that the corresponding indefinite integral does not exhibit this behavior. A small change in x produces only a small change in F(x). That is why the graph of F is not disconnected. This illustrates a general property of indefinite integrals known as continuity. (Apostol, p. 124).

As Spivak wrote, it appears that F is always better behaved than f.

It is interesting to understand the relation between these functions, F and f, that come in pairs. F is the integral of f and f is the derivative of F.

The use of graphs and the ideas of slope and area are tremendous visual supports. In Gilbert Strang's opinion the best approach is see f as velocity and F as distance.

We already know the first pair of functions: constant f and linear F. The second pair is what we are studying now: a piecewise constant f and a piecewise linear F.

Some examples from Gilbert Strang's article (you can try to reproduce these examples using the applet).

We can see the following graph as going forward and back (positive and negative constant velocity): A steadily increasing velocity imitates f(x) = 2x An oscillating velocity imitates f(x) = cos(x) and F(x) resembles roughly a sine curve: An exponentially increasing velocity imitates f(x) = 2^x: A burst of speed (then stop) makes F imitate a step function: We see that if f is a step function, F is a continuos piecewise linear function. But this function F is not a differentiable function. At some points it is not 'smooth'. The indefinite integral of a step function is piecewise differentiable. In this case we can say that the piecewise differentiable function F has lateral derivatives but they are not equal at some points:  The average value of a function f(x) over the interval [a,b] is given by You can see the integral as an area or a distance.

One idea is that the area under the function (positive or negative) ... ... is the same as the area of a rectangle whose height is the average value.  First example (simple average):  Second example (weighted average):   Next we are going to study more about Continuous Linear Piecewise Functions and their relations with Step Functions and the Fundamental Theorem of Calculus.

REFERENCES

Tom M. Apostol, Calculus, Second Edition, John Willey and Sons, Inc.
Gilbert Strang, Sums and Differences vs. Integrals and Derivatives, The College Mathematics Journal, January 1990. JSTOR.
Anthony J. Macula, The Point-Slope Formula Leads to the Fundamental Theorem of Calculus, The College Mathematics Journal, Mathematical Association of America, 1995.
Michael Spivak, Calculus, Third Edition, Publish-or-Perish, Inc. Graphs of these functions are made of disconnected line segments. There are points where a small change in x produces a sudden jump in the value of the function. Two points determine a stright line. As a function we call it a linear function. We can see the slope of a line and how we can get the equation of a line through two points. We study also the x-intercept and the y-intercept of a linear equation. Power with natural exponents are simple and important functions. Their inverse functions are power with rational exponents (a radical or a nth root) Polynomials of degree 2 are quadratic functions. Their graphs are parabolas. To find the x-intercepts we have to solve a quadratic equation. The vertex of a parabola is a maximum of minimum of the function. Polynomials of degree 3 are cubic functions. A real cubic function always crosses the x-axis at least once. We can consider the polynomial function that passes through a series of points of the plane. This is an interpolation problem that is solved here using the Lagrange interpolating polynomial. The derivative of a lineal function is a constant function. The derivative of a quadratic function is a linear function, it is to say, a straight line. The derivative of a cubic function is a quadratic function, a parabola. Lagrange polynomials are polynomials that pases through n given points. We use Lagrange polynomials to explore a general polynomial function and its derivative. If the derivative of F(x) is f(x), then we say that an indefinite integral of f(x) with respect to x is F(x). We also say that F is an antiderivative or a primitive function of f. It is easy to calculate the area under a straight line. This is the first example of integration that allows us to understand the idea and to introduce several basic concepts: integral as area, limits of integration, positive and negative areas. To calculate the area under a parabola is more difficult than to calculate the area under a linear function. We show how to approximate this area using rectangles and that the integral function of a polynomial of degree 2 is a polynomial of degree 3. The integral of power functions was know by Cavalieri from n=1 to n=9. Fermat was able to solve this problem using geometric progressions. We can see some basic concepts about integration applied to a general polynomial function. Integral functions of polynomial functions are polynomial functions with one degree more than the original function. The integral concept is associate to the concept of area. We began considering the area limited by the graph of a function and the x-axis between two vertical lines. Monotonic functions in a closed interval are integrable. In these cases we can bound the error we make when approximating the integral using rectangles. If we consider the lower limit of integration a as fixed and if we can calculate the integral for different values of the upper limit of integration b then we can define a new function: an indefinite integral of f. The Fundamental Theorem of Calculus tell us that every continuous function has an antiderivative and shows how to construct one using the integral. The Second Fundamental Theorem of Calculus is a powerful tool for evaluating definite integral (if we know an antiderivative of the function). Archimedes show us in 'The Method' how to use the lever law to discover the area of a parabolic segment.