# Unit (Heaviside) Step Function

The **Heaviside step function** is defined as follows:

`u_c(t)=u(t-c)=H(t-c)={(1 if t>=c),(0 if t<c):}`

The unit step function is useful in the sense that piecewise continuous functions can be written in terms of step functions.

**Example 1**. Write `f(t)={(2 if t<1),(5 if 1<=t<4),(3 if t>=4):}` in terms of step functions.

OK. We have here two switches at points `1` and `4`, so we need 2 step functions, namely `u_1(t)` and `u_4(t)`.

When `t<1`, both step functions are `0`, and we need `2`; so, the first term is `2`.

On the interval `[1,4)`, `u_1(t)=1`, and we need `5`; so, the second term (not forgetting about the first term `2`) is `(5-2)u_1(t)`.

On the last interval, both step functions are `1`; so, the third term (don't forget that summing up the first and second terms gives us `5`) is `(3-5)u_4(t)`.

Thus, `f(t)=2+(5-2)u_1(t)+(3-5)u_4(t)=2+3u_1(t)-2u_2(t)`.

This process can be extended on functions that are not constant.

**Example 2**. Write `f(t)={(t^2 if t<1),(t if 1<=t<4),(t-1 if t>=4):}` in terms of step functions.

OK. We have here two switches at points `1` and `4`; so, we need 2 step functions, namely `u_1(t)` and `u_4(t)`.

When `t<1`, both step functions are `0`, and we need `t^2`; so, the first term is `t^2`.

On the interval `[1,4)`, `u_1(t)=1`, and we need `t`; so, the second term (not forgetting about the first term `t^2`) is `(t-t^2)u_1(t)`.

On the last interval, both step functions are `1`; so, the third term (don't forget that summing up the first and second terms gives us `t`) is `(t-1-t)u_4(t)`.

Hence, `f(t)=t^2+(t-t^2)u_1(t)+(t-1-t)u_4(t)=t^2+(t-t^2)u_1(t)-u_2(t)`.

You've already noticed that each next term is the difference between the function values multiplied by the corresponding step function:

`f(t)={(f_1(t) if t<c_1),(f_2(t) if c_1<=t<c_2),(f_3(t) if t>=c_3):}=f_1(t)+(f_2(t)-f_1(t))u_(c_1)(t)+(f_3(t)-f_2(t))u_(c_2)(t)`

This can be extended on any number of terms.

Now, let's return to the question of taking the Laplace transforms of such functions.

First, let's see what the Laplace trasform of `u_c(t)f(t-c)` is:

`L(u_c(t)f(t-c))=int_0^oo e^(-st)u_c(t)f(t-c)dt=int_c^oo e^(-st)*1*f(t-c)dt`

Notice how we used above definition of the step function: on the interval `[0,t)`, the step function is `0`; so, the integral is also `0`, and on the interval `[t,oo)`, the step function is `1`.

Now, using the change of variable, substitute `t-c=u` (or `t=u+c`); then, `du=dt`, and, since `t` is changing from `c` to `oo`, `u` is changing from `c-c=0` to `oo-c=oo`.

` `So, `int_c^oo e^(-st)f(t-c)dt=int_0^oo e^(-s(u+c))f(u)du=e^(-sc) int_0^oo e^(-su)f(u)du=e^(-sc)F(s)`

`L(u_c(t)f(t-c))=e^(-sc)F(s)`.

Taking the inverse Laplace of both sides gives that `u_c(t)f(t-c)=L^-1(e^(-sc)F(s))`.

Now, if we take `f(t)=f(t-c)=1`, we have that `F(s)=L(f(t))=1/s` and

`L(u_c(t))=e^(-sc)/s`, or `u_c(t)=L^-1(e^(-sc)/s)`.

All these results give a way to find the Laplace transform of piecewise functions: write a function in terms of step functions, perform the necessary shift, and take the Laplace transform of the given terms.

**Example 3**. Find the Laplace transform of `f(t)={(3 if t<1),(t if t>=1):}`

First, write the function in terms of step functions: `f(t)=3+(t-3)u_1(t)`.

The second term must be in the form `u_1(t)f_1(t-1)`; so, rewrite `f_1(t-1)=t-3` as `t-1-2`, so that it looks like `f_1(t)=t-2`.

Thus, `L(f(t))=3L(1)+L((t-1-2)u_1(t))=3/s+e^(-s)L(t-2)=3/s+e^(-s)(1/s^2-2/s)`

**Example 4 **. Find the Laplace transform of `f(t)={(0 if t<3),(t^2 if 3<=t<5),(cos(2t)-t^2 if t>=5):}`

Writing the function in terms of the Heaviside function gives `f(t)=t^2u_3(t)+cos(2t)u_5(t)`. However, neither of the functions is shifted, so there is a work to shift them.

`t^2` should be in the form of `f_1(t-3)`; so, rewrite it: `(t-3+3)^2=(t-3)^2+6(t-3)+9`. This gives that `f_1(t)=t^2+6t+9`.

Next, `cos(2t)` should be in the form of `f_2(t-5)`; so, rewrite it: `cos(2(t-5)+10)`. Therefore, `f_2(t)=cos(2t+10)`.

So,

`L(f(t))=e^(-3s)L(t^2+6t+9)+e^(-5s)L(cos(2t+10))=e^(-3s)(2/s^3+6/s^2+9/s)+e^(-5s)(scos(10)-2sin(10))/(s^2+4)`

Of course, finding the Laplace transform of piecewise functions with the help of the Heaviside function can be a messy thing. Another way is to find the Laplace transform on each interval directly by definition (a step function is not needed, we just use the property of additivity of an integral). However, a step function is really useful when we need to find the inverse Laplace transform.

There will not be many examples on finding the inverse Laplace transform, because partial fraction decomposition and the convolution integral are the same main techniques. Just one thing has changed: if you see `e^(-cs)` in the numerator, factor it out and keep in mind that the inverse transform will involve `u_c(t)`. The rest is the same as in the previous sections.

**Example 5**. Calculate `L^-1(e^(-5s)/(s^2+1))`.

This is a simple example. Factor out `e^(-5s)` and use the fact that `L^-1(1/(s^2+1))=sin(t)`.

`L(e^(-5s)1/(s^2+1))=u_5(t)sin(t-5)`

**Example 6**. Calculate `L^-1((se^(-3s)+e^(-2s)+se^(-5s))/((s+2)(s+3)))`.

As always, factor out the exponents:

`(se^(-3s)+e^(-2s)+se^(-5s))/((s+2)(s+3))=e^(-3s)s/((s+2)(s+3))+e^(-5s)s/((s+2)(s+3))+e^(-2s)1/((s+2)(s+3))`

Again, the problem simplifies to finding the inverse transforms of functions not involving exponents.

Since `1/((s+2)(s+3))=1/(s+2)-1/(s+3)`, we have that `L^-1(1/((s+2)(s+3)))=e^(-2t)-e^(-3t)`.

Since `s/((s+2)(s+3))=-2 1/(s+2)+3 1/(s+3)`, we have that `L^-1(s/((s+2)(s+3)))=-2e^(-2t)+3e^(-3t)`.

Finally,

`L^-1((se^(-3s)+e^(-2s)+se^(-5s))/((s+2)(s+3)))=u_3(t)(-2e^(-2(t-3))+3e^(-3(t-3)))+u_2(t)(e^(-2(t-2))-e^(-2(t-3)))+u_5(t)(-2e^(-2(t-5))+3e^(-3(t-5)))`

The answers are a bit messy and longer, but don't be afraid. The same principles apply, and we did the same work, just adding some minor effort.