Differential Equations 4.3: Step Functions

Differential Equations

Units and Topics

Unit 4. The Laplace Transform

4.3 Step Functions

Many forces switch on or off at a certain time. A voltage is connected, a motor is stopped, or a load is placed on a beam. The unit step function describes such a force with one formula, and the Laplace transform handles it with one rule. This topic covers the unit step function, the shift rule for t, and equations with forces that switch on and off.

You need Topics 4.1 and 4.2 for this topic. The topic uses functions that are defined by different formulas on different intervals.

1. The Unit Step Function

The unit step function has the value 0 before the time 0 and the value 1 from the time 0 on. With a shift, the step is at the time c.

The unit step function. For a constant c ≥ 0, the function u(t − c) is 0 for t less than c, and it is 1 for t ≥ c.

The function u(t − 3) is 0 until t = 3 and 1 after that. Multiplying a function by u(t − 3) switches the function on at t = 3. The product u(t − 3) sin t is 0 until t = 3, and it is sin t after that.

The function 1 − u(t − c) is 1 until t = c and 0 after that. Multiplying by it switches a function off at t = c.

2. Functions Defined in Pieces

A function that is given by different formulas on different intervals can be written with step functions. The method starts with the first formula. At each time where the formula changes, it adds a step function times the new formula minus the old formula.

For example, let f(t) be 2 for t less than 3, and 5 for t ≥ 3.

f(t) = 2 + (5 − 2)u(t − 3)start with 2, and at t = 3 add the new value minus the old valuef(t) = 2 + 3u(t − 3)subtract

A pulse is a function that is 1 between the times a and b and 0 at all other times. It is a step up at a followed by a step down at b.

u(t − a) − u(t − b)

As a third example, let g(t) be t for t less than 1, and 1 for t ≥ 1. The graph rises along a line and then stays level.

g(t) = t + (1 − t)u(t − 1)start with t, and at t = 1 add the new formula minus the old formulag(t) = t − (t − 1)u(t − 1)write 1 − t as −(t − 1)

3. The Transform of a Step

The transform of u(t − c) follows from the definition. The function is 0 until t = c, so the integral starts at c.

ℒ{u(t − c)} = ∫c∞ e−st dtthe function is 0 before c and 1 after c∫cb e−st dt = (e−cs − e−sb)/sthe integral from c to bℒ{u(t − c)} = e−cs/slet b grow without limit, for s greater than 0

For c = 0 the result is 1/s, the transform of the constant 1. The delay by the time c appears as the factor e−cs.

The transform of the pulse of Part 2 is

ℒ{u(t − a) − u(t − b)} = (e−as − e−bs)/s

4. The Shift Rule for t

Let f(t) have the transform F(s). The function u(t − c)f(t − c) is the function f, delayed by the time c. Its graph is the graph of f moved to the right by c, with the value 0 before the time c.

ℒ{u(t − c)f(t − c)} = ∫c∞ e−st f(t − c) dtthe function is 0 before cℒ{u(t − c)f(t − c)} = ∫0∞ e−s(τ + c) f(τ) dτsubstitute τ = t − c, so t = τ + cℒ{u(t − c)f(t − c)} = e−cs ∫0∞ e−sτ f(τ) dτmove the constant factor e−cs in frontℒ{u(t − c)f(t − c)} = e−csF(s)the remaining integral is F(s)

The shift rule for t. If f(t) has the transform F(s), then u(t − c)f(t − c) has the transform e−csF(s). In the other direction, the inverse transform of e−csF(s) is u(t − c)f(t − c).

Compare the two shift rules. Multiplying f(t) by eat shifts the transform to F(s − a). Multiplying F(s) by e−cs shifts the function to f(t − c) and switches it on at t = c.

Two examples of the inverse direction:

ℒ⁻¹{e−3s/(s + 1)} = u(t − 3)e−(t − 3)the function e−t, delayed by 3ℒ⁻¹{e−2s/s²} = u(t − 2)(t − 2)the function t, delayed by 2

5. A Function That Is Not Written with t − c

The rule needs the function in the form f(t − c). A product such as u(t − 2)t does not have this form, because the second factor contains t and not t − 2. The function is rewritten first.

t = (t − 2) + 2write t with t − 2u(t − 2)t = u(t − 2)(t − 2) + 2u(t − 2)multiply by the step functionℒ{u(t − 2)t} = e−2s/s² + 2e−2s/sthe shift rule for the first term, and Part 3 for the second term

In general, the function g(t) is written as g((t − c) + c). The rule then gives ℒ{u(t − c)g(t)} = e−cs ℒ{g(t + c)}.

For the function g(t) of Part 2, which rises along a line until t = 1 and then stays at 1, the form t − (t − 1)u(t − 1) already contains t − 1.

ℒ{t} = 1/s²the tableℒ{(t − 1)u(t − 1)} = e−s/s²the shift rule with c = 1G(s) = (1 − e−s)/s²subtract

6. An Equation with a Force That Switches On

Solve y′ + y = u(t − 2) with y(0) = 0. The right side is 0 until t = 2, and it is 1 after that.

sY + Y = e−2s/stransform both sides, with y(0) = 0Y = e−2s/(s(s + 1))divide by s + 11/(s(s + 1)) = 1/s − 1/(s + 1)partial fractions for the part without e−2sh(t) = 1 − e−tthe inverse transform of this party = u(t − 2)h(t − 2)the shift rule, with c = 2y = u(t − 2)[1 − e−(t − 2)]substitute t − 2 in h

The solution is 0 until t = 2. After that it rises toward 1 in the same way as the solution of y′ + y = 1 that starts at the time 0. The factor e−2s is set aside during the partial fractions, and it is used only in the last step.

The method for a factor e−cs. Write Y(s) = e−csH(s). Find the inverse transform h(t) of H(s) with partial fractions. The solution is u(t − c)h(t − c).

7. An Example from Physics

A block on a spring without friction is at rest at its equilibrium position. A constant force acts on it from t = 0 until t = c, and then the force is removed. With suitable units, the position x(t) satisfies

x″ + x = 1 − u(t − c)

with x(0) = 0 and x′(0) = 0.

s²X + X = 1/s − e−cs/stransform both sidesX = (1 − e−cs)/(s(s² + 1))divide by s² + 11/(s(s² + 1)) = 1/s − s/(s² + 1)partial fractions for the part without e−csh(t) = 1 − cos tthe inverse transform of this partx = h(t) − u(t − c)h(t − c)the shift rule for the term with e−csx = 1 − cos t − u(t − c)[1 − cos(t − c)]substitute h

While the force acts, the block oscillates around the position 1, between 0 and 2. After the time c, the constants cancel, and the block oscillates around the position 0.

x = cos(t − c) − cos tfor t ≥ cx = 2 sin(c/2) sin(t − c/2)the formula for the difference of two cosines

The amplitude after the force is removed is |2 sin(c/2)|. It depends on the duration of the force. For c = π, which is half of the period 2π, the amplitude is 2, the largest possible value. For c = 2π, which is one full period, the amplitude is 0. The force is removed at the moment when the block is back at its starting position with the velocity 0, so the block stays at rest.

Try it: a force that is switched off

The gray curve is the force, which is 1 from t = 0 until t = c and 0 after that. The blue curve is the position x(t) of the block. The slider sets the duration c of the force.

8. Solutions Across a Jump

The force in Part 7 has a jump at t = c. The solution x(t) has no jump there, and its derivative x′(t) has no jump either. The jump of the force appears in the second derivative x″(t), which is the acceleration.

The same holds in general. For an equation of the second order with a forcing term that has a jump, the solution and its first derivative are continuous. For the equation of the first order in Part 6, the solution is continuous, and its derivative has the jump.

Common Mistakes

  • Using the shift rule for a function that is not written with t − c. The transform of u(t − 2)t is not e−2s/s², because t must first be written as (t − 2) + 2.
  • Leaving out the step function in an inverse transform. The inverse transform of e−3s/(s + 1) is u(t − 3)e−(t − 3), which is 0 before t = 3.
  • Shifting only a part of the function. In u(t − 2)h(t − 2), each t of h(t) is replaced by t − 2.
  • Including the factor e−cs in the partial fractions. The factor is set aside, and the partial fractions use only the rest.
  • Writing a switched function without the old formula. A function that changes from 2 to 5 at t = 3 is 2 + 3u(t − 3), and it is not 2 + 5u(t − 3).
  • Mixing up the two shift rules. The factor eat in f(t) shifts s, and the factor e−cs in F(s) shifts t.

Summary

ItemResult
Unit step function u(t − c)0 for t less than c, and 1 for t ≥ c
Pulse between a and bu(t − a) − u(t − b)
Transform of a stepℒ{u(t − c)} = e−cs/s
Shift rule for tℒ{u(t − c)f(t − c)} = e−csF(s)
Function not written with t − cℒ{u(t − c)g(t)} = e−cs ℒ{g(t + c)}
Inverse transform of e−csH(s)u(t − c)h(t − c)

Practice

Work each problem on paper first. Then open the answer to check your work.

1. Write each function with step functions: the function that is 0 for t less than 4 and 7 for t ≥ 4, and the function that is 3 for t less than 2 and 1 for t ≥ 2.

The first function is 7u(t − 4).

The second function is 3 − 2u(t − 2), because the value changes by 1 − 3 at t = 2.

2. Find the transform of the function that is 5 for t between 1 and 4 and 0 at all other times.

f(t) = 5[u(t − 1) − u(t − 4)]a pulse of the height 5F(s) = (5(e−s − e−4s))/sthe transform of each step

3. Find the transform of u(t − π) sin(t − π) and the transform of u(t − 1)t².

ℒ{u(t − π) sin(t − π)} = e−πs/(s² + 1)the shift rule, with the transform of sin tt² = (t − 1)² + 2(t − 1) + 1write t² with t − 1ℒ{u(t − 1)t²} = e−s(2/s³ + 2/s² + 1/s)the shift rule for each term

4. Find the inverse transform of e−4s/(s² + 9).

ℒ⁻¹{1/(s² + 9)} = 1/3 sin 3tthe table with ω = 3ℒ⁻¹{e−4s/(s² + 9)} = 1/3u(t − 4) sin 3(t − 4)the shift rule with c = 4

5. Solve y′ + 2y = u(t − 1) with y(0) = 0.

sY + 2Y = e−s/stransform both sidesY = e−s/(s(s + 2))divide by s + 21/(s(s + 2)) = 1/2s − 1/(2(s + 2))partial fractionsh(t) = 1/2 − 1/2e−2tthe inverse transformy = 1/2u(t − 1)[1 − e−2(t − 1)]the shift rule with c = 1

6. Solve y″ + 4y = u(t − 3) with y(0) = 0 and y′(0) = 0.

s²Y + 4Y = e−3s/stransform both sidesY = e−3s/(s(s² + 4))divide by s² + 41/(s(s² + 4)) = 1/4s − s/(4(s² + 4))partial fractionsh(t) = 1/4 − 1/4 cos 2tthe inverse transformy = 1/4u(t − 3)[1 − cos 2(t − 3)]the shift rule with c = 3

Python Practice

Step 1. The unit step function

The instruction np.heaviside(t - c, 1) gives the unit step function u(t − c). The second number is the value at the step itself, which is 1 in this topic. The code below calculates the function 2 + 3u(t − 3) of Part 2 at six times.

Python

The values are 2 until t = 3 and 5 from t = 3 on. Now calculate the pulse u(t − 1) − u(t − 4) at the same times. The values should be 0, 1, 1, 1, 0, and 0.

Python

Step 2. The transform of a step

The code below calculates the transform of u(t − 2) at s = 1 as an integral and compares it with the formula e−cs/s of Part 3.

Python

Both numbers are 0.1353. Now calculate the transform of the pulse u(t − 1) − u(t − 4) at s = 1. The formula of Part 3 gives (e−s − e−4s)/s, which is 0.3496.

Python

Step 3. The shift rule for t

The code below checks the rule for the function sin t, delayed by c = 3, at s = 2. The first number is the integral of the delayed function, and the second number is e−csF(s) with F(s) = 1/(s² + 1).

Python

Both numbers are 0.000496. Now check the rule for the function t, delayed by c = 1, at s = 2. The transform of t is 1/s². Both numbers should be 0.0338.

Python

Step 4. Check the solution of Part 6

The code below checks that y = u(t − 2)[1 − e−(t − 2)] satisfies y′ + y = u(t − 2). The instruction np.gradient estimates the derivative from the values of y, so the difference is small and not exactly 0.

Python

The largest difference is about 0.5 at the one point of the step, where the estimate of the derivative is not exact. The last value shows that y approaches 1. Now check the solution y = (1/2)u(t − 1)[1 − e−2(t − 1)] of y′ + 2y = u(t − 1) from Practice 5. The last value should be 0.5.

Python

Step 5. The block on the spring

The code below calculates the position of the block of Part 7 for the duration c = π and prints the largest distance from the position 0 after t = 7. The formula of Part 7 gives the amplitude |2 sin(c/2)|.

Python

Both numbers are 2. Now use the duration c = 2π. Both numbers should be 0 up to rounding, because the block stays at rest.

Python

Quiz

This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.

Choose how your answers are checked

1. A function is 4 for t less than 2, and it is 9 for t ≥ 2. Which formula gives this function?

2. What is the transform of u(t − 5)?

3. What is the inverse transform of e−2s/(s + 3)?

4. The transform of u(t − 3)t is e−3s(1/s² + k/s). Find the number k.

5. The solution of y′ + y = u(t − 2) with y(0) = 0 is y = u(t − 2)[1 − e−(t − 2)]. Calculate y(1) and y(3). Round y(3) to three decimal places.

Next: Topic 4.4, Impulses and the Delta Function