# How can we write a piecewise function in the form $u(t-a)f(t-a)$?

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.

-

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.

-

\begin{align} f(t)&=2(u(t)-u(t-a))+t^2u(t-a)\\ &=2u(t)-2u(t-a)+(t-a+a)^2u(t-a)=\ldots \end{align}

-
Can you perhaps elaborate a little? Particularly, how does this apply for a problem like $f(t) = \begin{cases} \cos2t, & \text{if }0\leq t \lt 2\pi \\ 0, & \text{if }t\geq 2\pi \end{cases}$ – Bailor Tow Dec 13 '12 at 1:16
$f(t)=\cos 2t (u(t)-u(t-2\pi))=\cos 2t u(t)+\cos (2(t-2\pi))u(t-2\pi)$ because $\cos$ is a periodic function with period $2\pi$. – Artem Dec 13 '12 at 1:18
@BailorTow Plotting $u(t)-u(t-2\pi)$ might help to understand how this works. – Artem Dec 13 '12 at 1:19
What does $u(t)-u(t-2\pi)$ represent? Is the second equation you've written above a general formula that I can follow? – Bailor Tow Dec 13 '12 at 1:23
This formula is for your particular example. – Artem Dec 13 '12 at 1:25