0% found this document useful (0 votes)
56 views

5 Piecewise-Defined Functions

The document discusses piecewise-defined functions, which have different formulas defining them on different parts of their domain. It provides examples of commonly used piecewise functions, including absolute value, signum, ramp, floor/ceiling, fractional part, and Heaviside (step) functions. The Heaviside function is particularly important as it can be used to write any piecewise function using a single formula by modeling switches at points where the function definition changes.

Uploaded by

a2hasija
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

5 Piecewise-Defined Functions

The document discusses piecewise-defined functions, which have different formulas defining them on different parts of their domain. It provides examples of commonly used piecewise functions, including absolute value, signum, ramp, floor/ceiling, fractional part, and Heaviside (step) functions. The Heaviside function is particularly important as it can be used to write any piecewise function using a single formula by modeling switches at points where the function definition changes.

Uploaded by

a2hasija
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

5

Piecewise-Dened Functions

We will sometimes encounter functions which are dened by dierent formulas on dierent parts of their domains. For example, we might have
5

f ( x) =

x, 4, x2 ,

if x < 0 if 0 x < 2 if x 2
-5 -4 -3 -2 -1

-1

Such functions might seem articial, but there are many physical phenomena which need to be described piecewise. For example, consider the density of water; it undergoes an abrupt change at 0 C.

Figure 1:
(Figure from Wikipedia: https://en.wikipedia.org/wiki/Properties_of_water)

There are several simple piecewise-dened functions which are used quite commonly. One of them should already be familiar to you: the absolute value function is of great importance in calculus.

5.1

The Absolute Value Function

The absolute value of a number x is dened as x, if x 0 if x < 0. always

| x| =

Alternatively, we could dene it as |x| = denotes the positive square root1 ).

x,

x2 (this works because the symbol

It will be useful to think of |x| is as the distance between x and zero on the number line. Similarly, we can think of |x a| as being the distance between x and a specic number a. Example: The inequality |x 5| < 2 is satised by the set of points within 2 units of 5: Why is this true? Consider the denition: Figure 2: If x 5, then |x 5| < 2 means x 5 < 2, so x < 7. If, instead, x < 5, then |x 5| < 2 means (x 5) < 2, i.e. x 5 > 2, so x > 3 (recall that if we multiply an inequality by a negative number, then the inequality reverses direction). Hence we may have x [5, 7) OR x (3, 5). Combining these, we know that x (3, 7). Although we will often be able to nd shortcuts, it is essential that you be able to use the denition of |x|. It allows us to break dicult problems down into cases, so that we can analyze them one piece at a time. Example: Solve the inequality |x + 3| |2x + 1|. Solution: The expressions |x + 3| and |2x + 1| each have two possible meanings, so it seems as though we should have four cases to consider. However, if you try to identify the four cases youll realize that there are only three, since it is impossible to have x + 3 < 0 and 2x + 1 0 at the same time (this would mean that x < 3 and x 1/2). The easiest way
Also, if were working with real numbers, then the notation x1/2 means exactly the same thing as x, 2 1/ 2 2 1/ 2 so we could also write |x| = x . This might be a slight surprise, because it means that x is NOT always equal to x!
1

to see this is to realize that the meaning of our inequality changes at two values of x: -3 and -1/2. That means there are just three intervals to consider! Case I Suppose x < 3. Then both x + 3 and 2x + 1 are negative, so the inequality reads x 3 2x 1 = x 2.

Think about what that tells us for a moment: if we assume that x < 3, then the inequality requires that x 2, which is guaranteed anyway! So, the inequality is solved by any number less than 3. Case II Suppose x 3, 1 2 . Then x + 3 is positive, but 2x + 1 is still negative, so x + 3 2x 1 = 3x 4

the inequality reads

4 x . 3 4 That is, of the value of x in the interval 3, 1 2 , only the values less than 3 satisfy the 1 inequality (the values in 4 3 , 2 are excluded from our solution set). = Case III Suppose x 1 2 . Then both x + 3 and 2x + 1 are positive, so the inequality is x + 3 2x + 1 = This excludes the values between 1 2 and 2. Combining the results, we can conclude that the inequality |x + 3| |2x + 1| is satised by x , 4 (2, ) . 3 x 2.

5.2

The Signum Function

Youre unlikely to see this one often, but well mention it briey. The signum function simply assigns a value to the sign of x: 1 0 1 if x < 0 if x = 0 if x > 0.

sgn (x) =

Notice that xsgn (x) = |x|.

5.3

Ramp Functions

This is another simple one which is useful in signal processing:


4

r ( t) =

0,

3.2

if t < 0 if t 0

2.4

1.6

(where c is a constant)

ct,

0.8

-1

-0.5

0.5

1.5

2.5

-0.8

5.4

The Floor and Ceiling Functions

The oor function has innitely many pieces, but it can be dened simply in words: x = greatest integer x (to put it another way, rounds the input down!). Example 1: 4.17 = 4, rounds down !). Example 2: Describe the action of f (x) = x + 1 2 . Answer: Observe that f (2.1) = 2, f(2.5) = 3, f (2.7) = 3, f (3) = 3, etc. This function describes our standard rounding procedure! 7 = 7, and 2.32 = 3 (not -2; we just said the function

Example 3: What does the function g (x) =

1 10

[10x] do?

Answer: Notice that we have g (2.1) = 2.1, g (2.13) = 2.1, g (2.1313...) = 2.1, and so on. This function truncates the input after one decimal place. The counterpart to the oor function is the ceiling function: x = least integer x (this rounds up instead of down). We dont really need both of these, since x = x.

5.5

The Fractional-Part Function

Heres another simple idea, which can most easily be dened this way:

F RACP T (x) = x x Examples: F RACP T (2.71828) = 0.71828, F RACP T (4.23) = 0.77.

Note that F RACP T (x) is periodic. This gives it some interesting applications. For example, if we are given an angle (, ), we can obtain the corresponding angle in the interval [0, 2 ] by using the function f () = 2 F RACP T . Try it! 2

5.6

The Heaviside Function (a.k.a. the Unit Step Function)

This is perhaps the simplest piecewise-dened function we can imagine, and for that reason its also one of the most important (along with the absolute value function). This is all it is: 0 1

H ( t) =

if t < 0 if t 0

This can be used to write any piecewise-dened function in single-line form. In fact, youll need to be able to do this in your third calculus course, so well try to get you used to the idea now. First, notice that f (t) H (t) = 0,

if t < 0 if t 0 5

f ( t) ,

, so if we think of moving from left to

right (increasing time), then multiplcation by H (t) can be thought of as a switch, to activate the signal f (t) at time t = 0. Example: et H (t) has this graph:
2

1.6

1.2

0.8

0.4

-0.8

-0.4

0.4

0.8

1.2

1.6

2.4

2.8

3.2

3.6

-0.4

Figure 3:

-0.8

Also, we can shift this eect, since H (t a) =

0, 1,

if t < a if t a

Example: Consider f (t) = t2 H (t 1). We can express this as f (t) = the graph looks like this:
4

0,

if t < 1 if t 1

t2 ,

, so

3.2

2.4

1.6

0.8

-1

-0.5

0.5

1.5

2.5

Figure 4:

-0.8

Thats really all we need to know; with this tool we can produce an innite variety of functions with nite numbers of discontinuities. Example: Sketch f (t) = t + (2 t) H (t + 2) + t2 1 H (t) + 2 t t2 H (t 1). Solution: First write the function is piecewise-dened form (just apply the denition of H (t)):

If t (, 2), then If t [2, 0), then If t [0, 1), then If t [1, ), then Now we can sketch it:

f ( t) = t f (t) = t + (2 t) f (t) = t + (2 t) + t2 1 f (t) = t + (2 t) + t2 1 + 2 t t2


2.4

=2 = t2 + 1 = 3 t.

1.6

0.8

-1.6

-0.8

0.8

1.6

2.4

3.2

4.8

-0.8

Figure 5:

-1.6

Of course, for this to be useful we must be able to do it in reverse. That is, given the piecewise denition, can we write a function in terms of Heaviside functions? Actually, there are many ways we could do this, but theres one simple strategy which turns out to be the most useful. The idea is to begin with whatever we have on the left-most portion of the graph, and use the Heaviside function to impose changes at each break. We need the Heaviside function only in the form H (t a); all we need to do is set the values of a and work out what we need to multiply by. Example: The absolute value function can be rewritten. We have |t| = t when t < 0, and we need to change it to +t for t 0. We must do this by addition / subtraction only, but thats not dicult: |t| = t + 2tH (t) . Example: Consider the function t, t , 4,
2

for t < 0 for 0 t < 2 for t 2.

f ( t) =

We want to write this in the form f (t) = t + ____H (t) + ____H (t 2) . What should go in the spaces? Well, at time t = 0, we need to replace t with t2 , so we simply add t + t2 . At time t = 2, we need to replace t2 with 4, so thats exactly what we do: we add 4 t2 ! f (t) = t + t + t2 H (t) + 4 t2 H (t 2) .

The Shortcuts When the given functions are more complicated it can be harder to do these calculations in our heads, so some people prefer to use a couple of tricks to write down and expression quickly, and then simplify it afterwards. This actually ends up requiring more work, but it might help avoid mistakes. Consider that 1 H ( t a) = so its graph looks like this: 1 0

if t < a if t a

This can be used as a mathematical o switch! Also consider the combination 0 1 0 if t < a if a t < b if t b.

H ( t a ) H ( t b) =

whose graph looks like this:

We can use this as a single on / o switch!

With these, we can proceed formulaically. That is, given a function with, say, four pieces g 1 ( t) g ( t)
2

if t < a if a t < b if b t < c if t c,

f ( t) =

we can immediately write

g 3 ( t) g 4 ( t)

f (t) = g1 (t) [1 H (t a)] +g2 (t) [H (t a) H (t b)] +g3 (t) [H (t b) H (t c)] + g 4 ( t) H ( t c ) We can then simplify this by collecting Heaviside functions:

f (t) = g1 (t) + [g2 (t) g1 (t)] H (t a) + [g3 (t) g2 (t)] H (t b) + [g4 (t) g3 (t)] H (t c) . Remark: You might be wondering how we deal with functions such as t in which if t 1 if t > 1,

f ( t) =

there appears a instead of a (so our intervals are closed on the right instead of on the left). It is possible to deal with these (for this example wed need to use the expression H (1 t)), but in applications we will not usually need to worry about what the values are at the breaks. For example, if you imagine trying to use mathematics to model what happens when you turn a light on, it doesnt matter whether we consider the light to be on or o at the precise moment when we ick the switch! In fact, various textbooks dene the Heaviside function dierently; you may see it dened

as H ( t) = or even as H ( t) =

0 0 1 1

if t 0 if t > 0

if t < 0 if t > 0.

We simply wont need to worry about the distinction once we start using the function in applications.

10

You might also like