[Math] how to write a function in terms of Heaviside step function

functionsordinary differential equations

I'm reading Paul Online Notes. There's an example of writing a function in terms of Heaviside step function as follows:
$$
f(t) = \begin{cases}
-4 &\text{if } t < 6, \\
25 &\text{if } 6 \le t < 8, \\
16 &\text{if } 8 \le t < 30, \\
10 &\text{if } t \ge 30
\end{cases}
$$

The solution that is given by the author is as follows:

$$
f(t) = -4 + 29u(t-6) – 9u(t-8) – 6 u(t-30)
$$

But in another book, I have seen a different method to write such functions and using that method, I came up with slightly different solution:

$$
-4u(t-6) + 25(u(t-6)-u(t-8)) + 16(u(t-8)-u(t-30))+10u(t-30)
$$
$$
-4u(t-6)+25u(t-6)-25u(t-8)+16u(t-8)-16u(t-30)+10u(t-30)
$$
$$
21u(t-6)-9u(t-8)-6u(t-30)
$$

If the former answer be simplified slightly (the part that is different to mine):

$$
-4 +29\cdot\begin{cases}0 &\text {if } t < 6\\
1 &\text {if } t > 6
\end{cases} = -4 + \begin{cases}0 &\text {if } t < 6\\
29 &\text {if } t > 6
\end{cases} = \begin{cases}-4 &\text {if } t < 6\\
25 &\text {if } t > 6
\end{cases}
$$

Which is different to:
$$
\begin{cases}0 &\text {if } t < 6\\
21 &\text {if } t > 6
\end{cases}
$$

What is wrong with my answer?

Best Answer

In the second method, $$-4u(t-6)=\begin{cases} 0 , & t<6 \\ -4 , & t\ge 6\end{cases}$$ but you want a function behaves like $$\begin{cases} -4 , & t<6 \\ 0 , & t\ge 6\end{cases}$$ It sholud be $$-4(1-u(t-6))=-4(1-\begin{cases}0,&t<6\\1,&t\ge6\end{cases})=-4(\begin{cases}1,&t<6\\0,&t\ge6\end{cases})=\begin{cases}-4,&t<6\\0,&t\ge6\end{cases}$$

Related Question