### Quick description

Sometimes one is required to build a function that satisfies several constraints of a similar type in different places. Often the neatest method is to build a particularly simple class of functions that each satisfy just one of the constraints and to use these as building blocks for more complicated examples.

### Prerequisites

Basic real analysis

### Example 1

Suppose you want to find a function that is infinitely differentiable such that whenever and whenever . It seems somewhat difficult for an infinitely differentiable function to be constant and then to become non-constant, so there are going to be at least four "difficult places" to think about.

If we follow the advice given in the quick description, then we will think first about finding a function that has just one difficult place. That is, we would like *any* infinitely differentiable function that is constant on some range and non-constant on another range.

For the purposes of this article, we assume that the solution to that problem is given: let us take the best known example, which is when and when .

From this one example, we can create a family of examples: the function will be zero up to and positive after that, and the function will be positive for and zero from onwards. And if we want we can put coefficients in front of these functions, but let us not bother with this, since later we can take linear combinations.

What building methods do we have at our disposal now that we have a family of basic examples? Well, we have just mentioned linear combinations, and a product of infinitely differentiable functions is infinitely differentiable as well. We can also differentiate or integrate our existing examples. Let's see what we can do with these various tools.

A first step is to get a function that is zero outside an interval such as but not zero everywhere. For this we can take our basic function above and build the function . It is easy to see how to use functions like this to create functions that have many constant parts and many non-constant parts, but it is not so easy to see how to get the constant parts to take different values (unlike here, where the constant parts are both zero), so what else can we do?

Let's try integration. If we integrate then we will get a function that is zero up to and constant but positive beyond . Now we're in business. If we call this function , then by taking functions of the form or we can easily build functions that are up to and from onwards, or up to and from onwards. So we can solve our original problem by building one function that is up to and from onwards and another function that is up to and from onwards, and multiplying these two functions together.

### Example 2

Suppose you want to build a polynomial of degree that takes prescribed values at . That is, you would like to equal for each .

A first step might be simply to find a polynomial of degree that vanishes at every apart from and does not vanish at . How might we do that? Well, it has to be a multiple of , and ... er ... well, there's an example. By dividing by an appropriate constant (which is equal to ) we can get this polynomial to be at and at all the other . Let us call the resulting polynomial .

But now we see that takes the value at , and we are done.

### Example 3

Suppose that you want to find a polynomial that approximates some given continuous function on . An easy observation is that every continuous function on can be approximated by a piecewise linear function (since is uniformly continuous, so you can just linearly interpolate between points for some large ). So it is enough to approximate piecewise linear functions.

Again, one can start with a basic example, such as when and when . If you can approximate that on the interval , then you know how to approximate any function that is zero up to and linear with gradient from onwards. And it is easy to produce a combination of such functions (plus a constant to get started) that equals any given piecewise linear function on .

2 years 21 weeksago2 years 30 weeksago2 years 31 weeksago3 years 8 weeksago3 years 29 weeksago