How I am supposed to transform the following function in order to apply the laplace transform.
$f(t) = t[u(t)-u(t-1)]+2t[u(t-1) - u(t-2)]$
I know that it has to be like this
$L\{f(t-t_0)u(t-t_0)\} = e^{-st_0}F(s), F(s) = L\{f(t)\}$
How I am supposed to transform the following function in order to apply the laplace transform.
$f(t) = t[u(t)-u(t-1)]+2t[u(t-1) - u(t-2)]$
I know that it has to be like this
$L\{f(t-t_0)u(t-t_0)\} = e^{-st_0}F(s), F(s) = L\{f(t)\}$
You're using the formula ${\cal L}\{f(t-t_0)\,{\cal U}(t-t_0)\} = e^{-t_0s}F(s).$ where, ${\cal U}(t-t_0)=\cases{0,& $0 \le t \lt t_0$ \cr 1,& $t\ge t_0$ } .$
As an example of using the above formula, let's consider the transform of $ t \, {\cal U}(t-1)$. Note that this function is not in a form where the formula is directly applicable. However, we can first write $t \,\,{\cal U}(t-1) = \bigl((t+1)-1\bigr)\,{\cal U}(t-1).$
Then, we can apply the formula with $f(t)=t+1$, $t_0=1$, and $F(s)={\cal L}\{ t+1\}= {\cal L}\{ t \}+{\cal L}\{ 1\} ={1\over s^2}+{1\over s^{\vphantom2}}$ to obtain $ {\cal L}\bigl\{ t\, {\cal U}(t-1)\bigr\}={\cal L}\bigl\{ \bigl((t+1)-1\bigr)\, {\cal U}(t-1) \bigr\}=e^{-1s}F(s)=e^{- s} \Bigl({\textstyle{1\over s^2}+{1\over s^{\vphantom2} }}\Bigr). $
The above "trick" can be generalized to produce the formula: $ {\cal L}\{f(t )\,{\cal U}(t-t_0)\} = e^{-t_0s}{\cal L}\bigl\{f(t+t_0) \bigr\}. $
A couple of points to be made:
Your function, after expansion, becomes: $\eqalign{ t\,{\cal U}(t)-t\,{\cal U}(t-1)+2t\,{\cal U}(t-1) -2t\,{\cal U}(t-2)&= \color{maroon}{t\,{\cal U}(t)} + \color{darkgreen}{t\,{\cal U}(t-1)} - \color{darkblue}{2t\,{\cal U}(t-2)}\cr } $ The Laplace transform is linear; so, we can compute the Laplace transforms of each colored term above ind the invoke: $\tag{1}{\cal L}\bigl\{ \color{maroon}{t\,{\cal U}(t)} + \color{darkgreen}{t\,{\cal U}(t-1)} - \color{darkblue}{2t\,{\cal U}(t-2)}\bigr\} = {\cal L}\bigl\{ \color{maroon}{t\,{\cal U}(t)}\bigr\} + {\cal L}\bigl\{ \color{darkgreen}{t\,{\cal U}(t-1)}\bigr\} -2{\cal L}\bigl\{ \color{darkblue}{ t\,{\cal U}(t-2)}\bigr\} $ We have $\tag{2} \color{maroon}{ {\cal L}\bigl\{ t\, {\cal U}(t ) \bigr\}= {\cal L}(t)= {\textstyle{1\over s^2} } } . $
$\tag{3}\color{darkgreen}{ {\cal L}\bigl\{ t\, {\cal U}(t-1)\bigr\}={\cal L}\bigl\{ \bigl((t+1)-1\bigr)\, {\cal U}(t-1) \bigr\}=e^{-1s}{\cal L}\{t+1\}=e^{- s} \Bigl({\textstyle{1\over s^2}+{1\over s^{\vphantom2} }}\Bigr)}, $ and $\tag{4}\color{darkblue}{ {\cal L}\bigl\{ t\, {\cal U}(t-2)\bigr\}= {\cal L}\bigl\{ \bigl((t+2)-2\bigr)\, {\cal U}(t-2) \bigr\}= e^{-2s} {\cal L}\{t+2\}= e^{-2 s} \Bigl({\textstyle{1\over s^2}+{2\over s^{\vphantom2} }}\Bigr)}, $
So, substituting the results of $(2)$, $(3)$, and $(4)$ into $(1)$: $\eqalign{ {\cal L}\{ t\,{\cal U}(t) + t\,{\cal U}(t-1) -2t\,{\cal U}(t-2)\} &={\textstyle{1\over s^2} }+e^{- s} \Bigl({\textstyle{1\over s^2}+{1\over s^{\vphantom2} }}\Bigr) -2e^{-2 s} \Bigl({\textstyle{1\over s^2}+{2\over s^{\vphantom2} }}\Bigr)\cr } $
It would be simpler for this problem to just use the definition of the Laplace transform to find the transform of your function, as Unreasonable Sin does in his answer. Of course, the method used here proves to be the shorter one when dealing with more complicated functions.
Since $u(t) = 1$ if $t \ge 0$ and $0$ otherwise, then $u(t) - u(t - 1) = 1$ only on the interval $[0, 1]$, and $u(t - 1) - u(t - 2) = 1$ only on the interval $[1, 2]$. You can then take the laplace transform of $t$ and $2t$ using these intervals in the integral:
$F(s) = \int_{0}^{1}te^{-st}dt + \int_{1}^22te^{-st}dt$
Since $\int te^{-st}\;dt = \frac{e^{-st}(st + 1)}{s^2}$, the solution comes out to be
$F(s) = \frac{e^{-s} - 4e^{-2s}}{s} + \frac{e^{-s} + 1 - 2e^{-2s}}{s^2}$