[Math] How to write a piecewise function in the form $u(t-a)f(t-a)$

algebra-precalculusordinary differential equations

Given a piecewise function, such as

$$f(t) =
\begin{cases}
2, & \text{if }t \lt a \\
t^2, & \text{if }t \geq a
\end{cases}$$

Or some other piecewise function, how can we write it in the form $u(t-a)f(t-a)$ for $$u(t-a) =
\begin{cases}
0, & \text{if }t \lt a \\
1, & \text{if }t \geq a
\end{cases}$$

A simple explanation that doesn't involve too much math knowledge is preferable, but I would still like to generalize this across other functions that I may come across.

Thank you.

Best Answer

Think of $u(t-a)$ as simply a "switch" that is "off" for $t<a$ and so has a value of $0$, but turns on at $t=a$ with a value of $1$ and remains "on" for $t\ge a$. This is why the function is called the unit step function (activated at $t=a$): unit because it has a value of one and step because it instantaneously steps up from a value of zero to a value of $1$ at $t=a$. Many students find it helpful to think about unit step functions as switches.

Hopefully this helps you see how a piecewise defined function can be written as a linear combination of products involving unit step functions. In your example, the function has the value $2$ for $t<a$ but at $t=a$ a switch is flipped which results in a value of $t^2$ for $t\ge a$. This last part is represented as $u(t-a)(-2+t^2)$ or if you prefer, $u(t-a)(t^2-2)$. Thus, we can write the original function as $$f(t)=2+u(t-a)(t^2-2).$$

(Note how we had to include a $-2$ there in order to eradicate the value of 2 that was "on" by default.) You might find the examples here helpful.

Techniques like this are useful when you want to rewrite a piecewise defined function as a unit step times another function, e.g., when you want to perform Laplace transforms in a differential equations course.